Creating LVM

1. We prepared disk, we need mark to PV

[root@bogon ~]# pvcreate /dev/sdb{1,2,3}
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdb2" successfully created.
  Physical volume "/dev/sdb3" successfully created.

We can see the PV has already done

[root@bogon ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree  
  /dev/sda2  centos lvm2 a--  <19.00g      0 
  /dev/sdb1         lvm2 ---  100.00m 100.00m
  /dev/sdb2         lvm2 ---  100.00m 100.00m
  /dev/sdb3         lvm2 ---  100.00m 100.00m

2. Make VG (which we will start with two production VG)

[root@bogon ~]# vgcreate vg0 /dev/sdb{1,2}
  Volume group "vg0" successfully created

Check out our VG, vg0 size of 192M (VG will occupy part of the space created)

[root@bogon ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree  
  centos   1   2   0 wz--n- <19.00g      0 
  vg0      2   0   0 wz--n- 192.00m 192.00m

3. Make LV, I gave the space lv050M

[root@bogon ~]# lvcreate -L 50M -n /dev/vg0/lv0 vg0 
  Rounding up size to full physical extent 52.00 MiB
  Logical volume "lv0" created.

View lv0

[root@bogon ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- <17.00g                                                    
  swap centos -wi-ao----   2.00g                                                    
  lv0  vg0    -wi-a-----  52.00m       

4. Create a file system, where I chose xfs format, and mount to see 

[root@bogon ~]# mkfs.xfs /dev/vg0/lv0
[root@bogon ~]# mount /dev/vg0/lv0 /mnt/lv0/
[bogon the root @ ~] DF # - Th 
file system type has been used with the available capacity % mount point
 / dev / Mapper / CentOS the root-XFS. 17G   . 4 .5 g 13G    27 % / 
devtmpfs devtmpfs 470M      0   470M     0 % / dev 
tmpfs 487m tmpfs      0   487m     0 % / dev / SHM 
tmpfs tmpfs 487m   8.3 M   479M     2 % / RUN 
tmpfs tmpfs 487m      0   487m     0 % / SYS / FS / a cgroup
/dev/sda1               xfs      1014M  166M  849M   17% /boot
tmpfs                   tmpfs      98M   12K   98M    1% /run/user/42
tmpfs                   tmpfs      98M     0   98M    0% /run/user/0
/dev/mapper/vg0-lv0     xfs        49M  2.8M   46M    6% /mnt/lv0

Here we are even built the lvm

Guess you like

Origin www.cnblogs.com/loganSxb/p/11013446.html
LVM