Sunday, May 1, 2011

LVM commands

LVM commands:
Show lvm
#pvs
#vgs
#lvs
#pvdisplay
#vgdisplay
#lvdisplay

To add a disk
#pvcreate /dev/

to create a Volume group
#vgcreate /dev/

to create a Logical Volume
#lvcreate -L <###>

To extend
#lvextend -L +### /dev/vg_name/lv_name
#resize2fs /dev/vg_name/lv_name

To reduce
unmount the filesystems first

# e2fsck -f /dev/vg_name/lvname
# resize2fs /dev/vg_name/lv_name 100m
 # lvreduce -L -100 /dev/vg_name/lv_name

Moving data
# pvcreate /dev/sdc
# vgextend vg_group01 /dev/sdc
# lvcreate -L 100 -n lvol01 vg_group01
# pvmove /dev/sdb /dev/sdc


Removing
#dmsetup info -c /dev/vg_group01/lv_group01
#dmsetup remove /dev/vg_group01/lv_group01
#vgremove -f /dev/vg_group01
#pvremove /dev/sdb
 

No comments:

Post a Comment