Difference between revisions of "LVM"

From Nuclear Physics Group Documentation Pages
Jump to navigationJump to search
Line 6: Line 6:
 
# mount as normal with <code> mount /dev/vg_(machine-name)/(distro-name) /location/to/mount/to</code>.
 
# mount as normal with <code> mount /dev/vg_(machine-name)/(distro-name) /location/to/mount/to</code>.
 
==Maintenance==
 
==Maintenance==
Expand a volume:
+
===Expand a volume===
##umount /dev/vg_machine/lv           #Resizing a mounted partition is generally a no-no.
+
In order to expand a logical volume and its corresponding filesystem:
##lvresize -L +2G /dev/vg_machine/lv   #Adds 2G to the logical volume lv.
+
 
##e2fsck -f /dev/vg_machine/lv        #fsck the filesystem up
+
#umount /dev/vg_machine/lv
##resize2fs /dev/vg_machine/lv         #Expands the filesystem to fill available space.
+
#lvresize -L +2G /dev/vg_machine/lv
##reboot
+
#e2fsck -f /dev/vg_machine/lv         
 +
#resize2fs /dev/vg_machine/lv
 +
#reboot

Revision as of 13:52, 19 July 2007

Logical Volume Management is used to treat seperate disks as one. However, this can cause trouble when trying to access the disks from a recovery CD, etc.

Mounting

To mount lvm partitions from a livecd (for purposes of recovery/emergency maintenance), simply:

  1. modprobe dm-mod to load required modules
  2. lvm vgchange -ay to become aware of the volume groups
  3. mount as normal with mount /dev/vg_(machine-name)/(distro-name) /location/to/mount/to.

Maintenance

Expand a volume

In order to expand a logical volume and its corresponding filesystem:

  1. umount /dev/vg_machine/lv
  2. lvresize -L +2G /dev/vg_machine/lv
  3. e2fsck -f /dev/vg_machine/lv
  4. resize2fs /dev/vg_machine/lv
  5. reboot