Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Your file systems is important too, some FS can be shrunk online while others can't be shrunk at all: you have to re-create the FS and recover from backups. –  Hubert Kario Jan 31 '12 at 9:08

3 Answers 3

up vote 2 down vote accepted

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
share|improve this answer
    
thank you! Do I need to unmount filesystem first? –  DmitrySemenov Feb 1 '12 at 2:11
    
@DmitrySemenov: With ext you don't have to. –  Hubert Kario Feb 1 '12 at 16:58

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.

share|improve this answer
    
Great thank you! Is there any way to use CLI interface? –  DmitrySemenov Jan 31 '12 at 5:41
    
Yes, all the tools are available on the command line too; I don't have a convenient reference, but I assume the documentation contains it. If not, find a suitable "LVM" guide out there. –  Daniel Pittman Jan 31 '12 at 5:43
    
vgxxxx and pgxxxx will give you the required results –  Vick Vega Jan 31 '12 at 5:44

vgdisplay first to see if you have room. If you do, you can then extend the LV for /home and resize dynamically.

if you do not have room, you will want to

reduce / filesystem reduce LV mounted as / filesystem

That requires booting into rescue mode because you cannot have / mounted when you reduce.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.