logical volume manager
Builds logical disk volumes on top of physical ones. Especially useful for resizing and reordering disks.
setup
I have 3 harddisk of 1 GB each, and combine these into one logical volume.
physical volumes
These are just LVM physical disks the size of the underlying hardware :
To prepare these for LVM, partition them as /dev/sdb1, /dev/sdc1 and /dev/sdd1 and give them type 8e (Linux LVM) Then make them physical volumes using pvcreate :
The reverse action would be pvremove pvdisplaym and pvs would show your volumes.pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup lvm2 a-- 7.51g 0
/dev/sdb1 fileserver lvm2 a-- 1016.00m 0
/dev/sdc1 fileserver lvm2 a-- 1016.00m 1008.00m
/dev/sdd1 fileserver lvm2 a-- 1016.00m 1016.00m
volume group
You can now bind physical volumes into a volume group.
vgcreate fileserver /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Again, useful commands are vgremove, vgdisplay, vgrename, and
vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 7.51g 0
fileserver 3 1 0 wz--n- 2.98g 1.98g
logical volumes
Lvm it is called, and here they are. Let's create two logical volumes.
''' lvcreate --name small --size 1G fileserver lvcreate --name big --size 1.8G fileserver '''
There is probably some overhead since asking for 2G was too much, so i made 1.8G Listing these volumes can be done with lvs
lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root VolGroup -wi-ao---- 6.71g
lv_swap VolGroup -wi-ao---- 816.00m
big fileserver -wi-a----- 1.80g
small fileserver -wi-a----- 1.00g
using the volumes
Now they are just like normal partitions, reachable in /dev/. So
Format and mount :