Sunday, July 22, 2007

LVM notes

Commands

ls /sbin/vg* /sbin/lv*/sbin/pv*
Xscan, Xdisplay, Xcreate, Xremove, Xextend

Initialize for lvm
  • pvcreate -v /dev/md3
  • pvdisplay /dev/md3
Scan & build /etc/lvmtab stuff
  • vgscan
  • create the volume group /dev/vg from /dev/md3
  • vgcreate vg /dev/md3
  • vgdisplay
  • show Allocated and Free space
  • sudo vgdisplay | egrep '^[AF].*Size'
Create a partition
  • lvcreate --size 2048m vg
  • ls -l /dev/vg
  • mke2fs -j /dev/vg/lvol
  • mkdir /test
  • mount -t ext3 /dev/vg/lvol /test
  • lvdisplay /dev/vg/lvol[n]
expand it!
  • umount /dev/vg/lvol?
  • lvextend -L + /dev/vg/lvol?
  • e2fsck -f /dev/vg/lvol?
  • resize2fs -p /dev/vg/lvol?
  • mount it
remove it!
  • umount /dev/vg/lvol?
  • lvremove /dev/vg/lvol?
  • rmdir mountpoint
  • vi /etc/fstab