Wednesday, February 22, 2012

Resizing LVM partitions

Need to add space to a partition by taking it from another?  I did, when I found that /var was suddenly way too small and /home had lots of unused space.  In this scenario, /home gets reduced to 250G and /var is grown by the same amount.  Here it is:
  • telinit 1
  • umount /dev/group/home
  • e2fsck -f /dev/group/home
  • resize2fs /dev/group/home 250G
  • lvreduce -L 250G /dev/group/home
  • mount -t ext3 /dev/group/home /home
  • umount /dev/group/var
  • lvextend -L +250G /dev/group/var
  • e2fsck -f /dev/group/var
  • resize2fs /dev/group/var
  • mount -t ext3 /dev/group/var /var
  • telinit 2
Use lvscan -v to get the names of all the lvm partitions and adjust the commands accordingly.  Turned out that my users weren’t really using anything, but the departments decided that using the web server was a good idea.  LVM made the adjustment painless.

No comments:

Post a Comment