28 December 2012

LVM Quickstart - Creating a Volume

Add the device and then perform an FDISK.
fdisk /dev/sdb
For an LVM partition, select "8e" when creating the partition in FDISK.
Assign the disk partition to the physical volume: 
pvcreate /dev/sdb1
Next create the volume group. Physical volumes are assigned to the volume group.
vgcreate vg_websvc /dev/sdb1
Once that is done, logical volumes can be created. This is what will actually hold the file system. Logical volumes are assigned to a volume group.
lvcreate --name lv_websvc --size 10G vg_websvc
Now it is possible to create the file system.
mkfs.ext4 /dev/vg_ijet/lv_websvc
And then either manually mount the file system:
mkdir /websvc
mount /dev/vg_websvc/lv_websvc /websvc
Or set it to automatically mount via /etc/fstab:
/dev/mapper/vg_websvc-lv_websvc /websvc ext4 defaults 1 2

Much more detailed information can be found here: 
http://www.howtoforge.com/linux_lvm

No comments: