0

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

1
  • 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, 2012 at 22:31

2 Answers 2

0

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.

4
  • 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, 2012 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. Dec 19, 2012 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, 2012 at 22:30
  • Glad that you did work it out. Which order did you choose. ah i see it in your comment, good job. Dec 20, 2012 at 2:58
0

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 /.

2
  • 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, 2012 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, 2012 at 20:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .