Showing posts with label lvm. Show all posts
Showing posts with label lvm. Show all posts

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

12 July 2010

Extend/Grow a ext4 LVM volume

To extend a LVM volume that holds a ext4 filesystem can be tricky, as many tools only can process ext2 and ext3. But with the correct tools, this is straightforward. 

Ensure e4fsprogs is installed. 

Unmount the volume to be expaneded: 
umount /websvc

Extend the volume:
lvextend -L+10G /dev/mapper/VolGroup01-LogVol01

The option +10G extends the volume 10 GB. Another method would be to give a TOTAL desired size:
lvextend -L30G /dev/mapper/VolGroup01-LogVol01

 Run a file system check:
e4fsck -f /dev/mapper/VolGroup01-LogVol01

Then extend the filesystem:
resize4fs /dev/mapper/VolGroup01-LogVol01

That is it. 

16 June 2010

lvm and ext4

During OS install, allow the new partition to be created by LVM, for example /websvc

This filesystem will be ext3. Note the Volume group and logical volume (VolGroup01-LogVol01)

yum install e4fsprogs

umount /websvc

mkfs.ext4 /dev/mapper/VolGroup01-LogVol01 -- this will wipe out everything on the filesystem and transform it to ext4

when complete, do a test mount:
mount -t ext4 /dev/mapper/VolGroup01-LogVol01 /websvc

df -T will show which file type is running.

last step is to modify /etc/fstab: change the ext3 entry to ext4 for this filesystem.