Logical Volume Management in Linux

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search

There are 3 steps to this. Create a partition Use fdisk to create your partitions. Use fdisk /dev/DISKID to do this. DISKS is generally something like sdb

fdisk /dev/sdb

Press "p" to print the partitions, there will be none on an empty disk

Press "n" to create a new partition

Create a primary partition on partition number 1 for a new disk. Accept defaults to use full disk for first and last cylinders.

Press "t" to change the type of the partition to 8e (Linux LVM)

Press "p" to double check the new parition and then press "w" to write the changes

Format partition

Create LVM disk pool

pvcreate /dev/sdb1
vgcreate vgpool /dev/sdb1
lvcreate -l 100%FREE -n lvstuff vgpool
mkfs -t xfs /dev/vgpool/lvstuff
mkdir /mnt/data
mount -t xfs /dev/vgpool/lvstuff /mnt/data

Now check that the disk shows up and you can get to it

df -h
cd /mnt/data/


You can use "pvdisplay" command to display the physical volumes now on the system