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

I recently installed a VM version of Oracle Linux 6.3 and began installing applications for testing. I realized that the "/" mount is small and the "/home" mount is way oversized, See output below.

df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_vvfishn1-lv_root 50G 16G 32G 33% /

tmpfs 7.8G 272K 7.8G 1% /dev/shm

/dev/xvdb1 485M 55M 405M 12% /boot

/dev/mapper/vg_vvfishn1-lv_home 195G 189M 185G 1% /home

Both root and "/home" are ext4 FS . How can i resize these mounts without having to reinstall the OS?

Thanks in advanced

share|improve this question
1  
The correct order is as follows: umount /dev/mapper/vg_vvfishn1-lv_home e2fsck -fyv /dev/mapper/vg_vvfishn1-lv_home resize2fs /dev/mapper/vg_vvfishn1-lv_home <SIZE> lvreduce -L <SIZE> /dev/mapper/vg_vvfishn1-lv_home e2fsck -fyv /dev/mapper/vg_vvfishn1-lv_home lvextend -L +<size> /dev/mapper/vg_vvfishn1-lv_root resize2fs /dev/mapper/vg_vvfishn1-lv_root reboot –  Kwazii Dec 19 '12 at 22:31
add comment

2 Answers

up vote 0 down vote accepted

Go to rescue mode or make sure that nothing - no user or process is accessing your /home. Use lsof or fuser to confirm.

umount /dev/mapper/vg_vvfishn1-lv_home
e2fsck -fyv /dev/mapper/vg_vvfishn1-lv_home
lvreduce -L -<size> /dev/mapper/vg_vvfishn1-lv_home
resize2fs /dev/mapper/vg_vvfishn1-lv_home
e2fsck -fyv /dev/mapper/vg_vvfishn1-lv_home
lvextend -L +<size> /dev/mapper/vg_vvfishn1-lv_root
resize2fs /dev/mapper/vg_vvfishn1-lv_root

Reboot

Note that lvreduce is really a troublesome command. Please back up all your data and don't be surprised if your fs goes into read-only mode because of any,anyyy silly mistake or overlooking.

share|improve this answer
    
Hello Soham, thank you for this solution i will be testing it shortly. Obviously, these steps has a risk invovled with data lose. How likely is it to lose data from a installed application on / –  Kwazii Dec 19 '12 at 18:44
    
You mean the app is generating data and storing in / - not much, risk is only with lvreduce. lvextend is fairly reliable command. –  Soham Chakraborty Dec 19 '12 at 19:10
    
hello soham, it worked like a charm on my test VM's with one issue, the order of the commands excuted. As you stated lvreduce is a picky command. –  Kwazii Dec 19 '12 at 22:30
    
Glad that you did work it out. Which order did you choose. ah i see it in your comment, good job. –  Soham Chakraborty Dec 20 '12 at 2:58
add comment

You'll need to boot to rescue mode, then you can shrink the /home filesystem, shrink the LV (logical volume), expand the root LV, then expand the root filesystem. Honestly though, a 50G / isn't undersized. If this were me, I'd shrink /home to have space available for database filesystems, but I wouldn't bother growing /.

share|improve this answer
    
I'm not sure your assertion is true anymore, From the resize2fs man page: "(As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 and ext4.)." –  mdpc Dec 19 '12 at 19:44
    
The last time I used resize2fs, it could grow filesystems online but it couldn't shrink them online. Even if it can now (which wouldn't completely surprise me), I'm enough of a paranoiac to suggest you shrink only when unmounted anyway. –  John Dec 19 '12 at 20:07
add comment

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.