AWG Blogs

  • Getting ADB Working for SPH-M840 - Had a SPH-M840 Galaxy Ring Virgin Mobile 3G Android version 4.1.2, attempting to install apps from Android Studio failed to detect device. Installed SAMSUN...
    7 months ago
  • How to check if I have write permissions to an Oracle table - SELECT CASE WHEN COUNT(*) > 0 THEN 'YES' ELSE 'NO' END AS PERMISSIONS FROM ( SELECT privilege FROM ( select * from dba_tab_privs where (grantee = 'MY_USE...
    7 months ago
  • JSF vs Struts 2 - JSF was designed in part by the authors of Struts to create a "Struts" that did a more accurate implementation of MVC (Struts is technically "Model 2") a...
    8 months ago
  • XML Beans vs JAXB - Seems XML Beans is superior: JAXB provides support for the XML schema specification, but handles only a subset of it; XMLBeans supports all of it. Also, by...
    1 year ago
  • Algorithms and OOP - In addition to DCI, "generic programming" as well as the move to functional programming appears to add nuance to the OOP notion of joining behavior with da...
    1 year ago
  • Flyweight vs Singleton - Implementations seems to be virtually identical, differing only in style, where the flyweight object is created and held by associated objects (containers:...
    1 year ago
  • init-param vs context-param - see http://javahash.com/difference-between-servlet-init-and-context-parameter/ for background. Gist: context-param variables are global and accessible thro...
    1 year ago
  • rbenv vs RVM - RVM is responsible not only for changing Ruby versions, but for installing rubies and managing gemsets, as well. ...Along with rbenv [to manage ruby versi...
    2 years ago

Sunday, December 6, 2009

Resize Root Filesystem (/) with LVM

I made the mistake of accepting the default LVM options during a Debian Lenny installation, only to find out that the root / had filled up quite quickly, having started out with only around 300mb.

I wanted to transfer some free space from /home to /; so did as follows:

Select filesystem (e.g. /dev/mapper/debian-home ... 2.5G) to shrink from Filesystem column in df -h
I chose /home, so must be ssh'd as root; use 'who' command to verify no other users are logged in and have the home dir open.

Resize /home:
#umount /dev/mapper/debian-home
#e2fsck -f /dev/mapper/debian-home
#resize2fs /dev/mapper/debian-home 1G
select the corresponding volume to shrink from lvdisplay, i.e., the LV Name field (e.g. /dev/debian/home)
#lvreduce -L -1.3G /dev/debian/home

Extend root volume (/):
verify there is Free PE in vgdisplay. Check this value against the following lvextend command size option
To extend root volume (/), find it's coresponding name by looking up [LV Name] (e.g.
/dev/debian/root) containing 'root' in lvdisplay
then:
#lvextend -L +1G /dev/debian/root
resize the root file system. Find out the Filesystem name for the / mount by checking df
# resize2fs /dev/mapper/debian-root
check df to verify / is resized.
remount home:
#mount /dev/mapper/debian-home

Warning! This procedure is very risky. A full backup of the system immediately before resizing volumes is strongly advised on production systems. After the volumes are resized, run fsck to fix any errors.


refs:
ref for shrinking: http://www.linuxquestions.org/questions/linux-enterprise-47/shrink-lvm-without-dataloss-557746/
ref for extending /: http://www.linuxquestions.org/questions/linux-general-1/lvm-resizing-the-root-partition-361663/

No comments:

Post a Comment