【Linux】LVM逻辑卷管理和RAID
2019-04-11 09:50:22来源:博客园 阅读 ()
[root@localhost ~]# fdisk -l /dev/sdb /dev/sdc | grep "LVM" /dev/sdb1 1 9660 77593918+ 8e Linux LVM /dev/sdc1 1 9660 77593918+ 8e Linux LVM
↑正确分区结果
[root@localhost ~]# vgcreate mail_store /dev/sdb1 /dev/sdc1 Volume group "mail_store" successfully created
[root@localhost ~]# lvcreate -L 60G -n mail mail_store /dev/cdrom: open failed: Read-only file system Logical volume "mail" created [root@localhost ~]# mkfs -t ext3 /dev/mail_store/mail ……
[root@localhost ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created [root@localhost ~]# pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created [root@localhost ~]# pvdisplay "/dev/sdb" is a new physical volume of "100.00 GiB" --- NEW Physical volume --- PV Name /dev/sdb VG Name PV Size 100.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID mBETMZ-d9Nh-AEr0-OyXO-h6N7-Dw2y-UqKAq4 "/dev/sdc" is a new physical volume of "200.00 GiB" --- NEW Physical volume --- PV Name /dev/sdc VG Name PV Size 200.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID vvp3Kg-UcbH-imNJ-Mwjl-asAz-5FM1-q8hj98 [root@localhost ~]# pvs PV VG Fmt Attr PSize PFree /dev/sdb lvm2 ---- 100.00g 100.00g /dev/sdc lvm2 ---- 200.00g 200.00g [root@localhost ~]# vgcreate mail_vg /dev/sdb Volume group "mail_vg" successfully created [root@localhost ~]# vgdisplay --- Volume group --- VG Name mail_vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 100.00 GiB PE Size 4.00 MiB Total PE 25599 Alloc PE / Size 0 / 0 Free PE / Size 25599 / 100.00 GiB VG UUID 0HEnBL-7RV9-CkxU-dyD3-zAqB-ra0o-UkqxZF [root@localhost ~]# lvcreate -L 150G -n mail_lv mail_vg Volume group "mail_vg" has insufficient free space (25599 extents): 38400 required. [root@localhost ~]# lvcreate -L 50G -n mail_lv mail_vg Logical volume "mail_lv" created. [root@localhost ~]# lvdisplay --- Logical volume --- LV Path /dev/mail_vg/mail_lv LV Name mail_lv VG Name mail_vg LV UUID wgNvn6-WEJh-FfZA-TZAS-lfrC-gWed-nxMRzw LV Write Access read/write LV Creation host, time localhost.localdomain, 2019-01-06 17:42:56 +0800 LV Status available # open 0 LV Size 50.00 GiB Current LE 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@localhost ~]# ll /dev/mail_vg/mail_lv lrwxrwxrwx. 1 root root 7 Jan 6 17:42 /dev/mail_vg/mail_lv -> ../dm-0 [root@localhost ~]# ll /dev/dm* brw-rw----. 1 root disk 253, 0 Jan 6 17:42 /dev/dm-0 [root@localhost ~]# ll /dev/mapper/ total 0 crw-rw----. 1 root root 10, 58 Jan 6 17:35 control lrwxrwxrwx. 1 root root 7 Jan 6 17:42 mail_vg-mail_lv -> ../dm-0 [root@localhost ~]# pvs PV VG Fmt Attr PSize PFree /dev/sdb mail_vg lvm2 a--u 100.00g 50.00g /dev/sdc lvm2 ---- 200.00g 200.00g [root@localhost ~]# vgs VG #PV #LV #SN Attr VSize VFree mail_vg 1 1 0 wz--n- 100.00g 50.00g [root@localhost ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert mail_lv mail_vg -wi-a----- 50.00g [root@localhost ~]# mkfs.ext4 /dev/mapper/mail_vg-mail_lv mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 3276800 inodes, 13107200 blocks 655360 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 400 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 29 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@localhost ~]# mkdir /mail [root@localhost ~]# mount /dev/mail_vg/mail_lv /mail/ [root@localhost ~]# mount /dev/sda3 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) /dev/mapper/mail_vg-mail_lv on /mail type ext4 (rw)
[root@localhost ~]# blkid /dev/mapper/mail_vg-mail_lv /dev/mapper/mail_vg-mail_lv: UUID="8ab67eeb-0b5a-43e3-b940-bef0f14bf1b1" TYPE="ext4" [root@localhost ~]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Fri Nov 2 22:37:22 2018 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=c42ec363-df57-48b3-89a9-0685544602bd / ext4 defaults 1 1 UUID=27ab8d75-5b06-42e4-b0b4-0cb2376e9ea4 /boot ext4 defaults 1 2 UUID=b8bee5a5-ea40-476a-98c3-250707895638 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 UUID=8ab67eeb-0b5a-43e3-b940-bef0f14bf1b1 /mail ext4 defaults 0 0 ~
设置完成保存退出
原文链接:https://www.cnblogs.com/qq1148932219/p/10684982.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:服务器端 安装svn
下一篇:nginx配置url重写
- Linux系统如何设置开机自动运行脚本? 2020-06-11
- Linux指令和shell脚本 2020-06-11
- 适合开发者的最佳Linux发行版 2020-06-11
- RAID 1 软件实现(Linux 系统) 2020-06-10
- linux各级目录 2020-06-08
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash