[[email protected] ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name rhel PV Size 7.51 GiB / not usable 3.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 1922 Free PE 10 Allocated PE 1912 PV UUID qMyN56-3szx-N7EG-s5Zh-YsrE-eScv-fdEHHZ
"/dev/sdc" is a new physical volume of "2.00 GiB" --- NEW Physical volume --- PV Name /dev/sdc VG Name PV Size 2.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID A1eJ9z-GBd1-HdB4-m9Mh-IVSk-7CTY-TCKFUC
"/dev/sdb" is a new physical volume of "1.00 GiB" --- NEW Physical volume --- PV Name /dev/sdb VG Name PV Size 1.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID zYkj1L-uojt-XGyM-craq-t8nQ-b6tl-Z84bfq
[[email protected] ~]# vgcreate rusky /dev/sdb /dev/sdc Volume group "rusky" successfully created
在创建好VG以后,我们也可以使用 vgdisplay 或者 vgs 命来来查看VG的信息
[[email protected] ~]# vgs VG #PV #LV #SN Attr VSize VFree rhel 1 2 0 wz--n- 7.51g 40.00m rusky 2 0 0 wz--n- 2.99g 2.99g [[email protected] ~]# vgdisplay --- Volume group --- VG Name rusky System ID Format lvm2 Metadata Areas 2 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 2 --当前这里有两个PV,分别是我们的 /dev/sdb 和 /dev/sdc Act PV 2 VG Size 2.99 GiB --当前VG的大小 PE Size 4.00 MiB --LVM默认的PE大小就是4M Total PE 766 --因为VG里面存放的就是各个PV中的PE,所以PE的数量就是VG大小除以默认PE的大小 Alloc PE / Size 0 / 0 Free PE / Size 766 / 2.99 GiB VG UUID Giffac-ePqA-taJU-9wCc-v910-GQbc-047yvE
--- Volume group --- VG Name rhel System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 7.51 GiB PE Size 4.00 MiB Total PE 1922 Alloc PE / Size 1912 / 7.47 GiB Free PE / Size 10 / 40.00 MiB VG UUID e3iOPE-zKM4-yxRI-9IfH-rjeY-hXAT-5DPGcE
[[email protected] ~]# mkfs.ext4 /dev/rusky/mylv mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 128016 inodes, 512000 blocks 25600 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=34078720 63 block groups 8192 blocks per group, 8192 fragments per group 2032 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done
格式化我们的逻辑卷以后,就可以使用 mount 命令将其进行挂载,我们将其挂载到 /mnt/myLvm 目录下
[[email protected] ~]# mkdir -p /mnt/myLvm [[email protected]calhost ~]# mount /dev/rusky/mylv /mnt/myLvm/ [[email protected] ~]# mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=926752k,nr_inodes=231688,mode=755)