Increase Linux Partition dynamically?
Here is what I have on my Linux Box
[root@linxuph53 logs]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linuxph53-lv_root
38G 11G 26G 29% /
tmpfs 4.0G 0 4.0G 0% /dev/shm
/dev/sda1 485M 54M 406M 12% /boot
/dev/mapper/vg_linuxph53-lv_home
35G 30G 3.9G 89% /home
/home is being used by website content and I'd like to shift unused space from / to /home like 6-10 of additional GBs
Is this possible? I can't shutdown the service, is there anyway dynamically allocate more space to /home partition?
I can do this in windows without any issues, but have no idea how to do it on Linux
OS - Fedora Core 14
thanks, Dmitry
Solution 1:
If you are shrinking the filesystem, you have to work in exactly reverse order than when expanding the fs: first you shrink the FS, then you shrink the LV. Don't resize the LV to exact size of the filesystem or you will face data corruption that's not obviously apparent! First resize the filesystem to a bit below the amount you want it to take on the disk, then resize the LV to the size you want your FS to take and then expand the FS to take available space.
Assuming that you use ext2/ext3 or ext4, first shrink the /
:
resize2fs /dev/mapper/vg_linuxph53-lv_root $((16*1024-256))MB
lvresize -L $((16*1024))MB
resize2fs /dev/mapper/vg_linuxph53-lv_root
Then expand the /home
:
lvresize -L +16GB /dev/mapper/vg_linuxph53-lv_home
resize2fs /dev/mapper/vg_linuxph53-lv_home
Solution 2:
http://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/s1-system-config-lvm-editing-lv.html should see you right.
Those are the Fedora documents on managing LVM filesystems and logical volumes, including the details of how to achieve exactly what you ask about.