Wednesday, 22 August 2007

Linux LVM basics

Prepare disk
dd if=/dev/zero of=/dev/sdb bs=1k count=1
pvcreate /dev/sdb

Setup a volume group
vgcreate my_volume_group /dev/sdb

Change status of volume group
vgchange -a y my_volume_group
vgchange -a n my_volume_group (deactivate)

Extend or reduce volume group
vgextend my_volume_group /dev/hdc1
vgreduce my_volume_group /dev/hda1 (removing)

Create logical volume group
lvcreate -L1500 -ntestlv my_volume_group
lvcreate -- logical volume "/dev/my_volume_group/testlv" successfully created

Create the file system
mke2fs /dev/my_volume_group/testlv

Mount the file system
mount /dev/my_volume_group/testlv /disk2

Resizing of a logical volume
e2fsadm /dev/my_volume_group/testlv -L+100

Detailed information:

No comments: