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.

Is it possible to decrease the vg_home and increase vg_root? I am running RHEL. I need to know the steps.

[root@web /]# uname -a
Linux web 2.6.32-131.4.1.el6.x86_64 #1 SMP Fri Jun 10 10:54:26 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@web /]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.2 (Santiago)

[root@web /]# df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_web-lv_root
                       50G  7.8G   40G  17% /
tmpfs                 7.8G  384K  7.8G   1% /dev/shm
/dev/sda2             485M   79M  381M  18% /boot
/dev/sda1             200M  256K  200M   1% /boot/efi
/dev/mapper/vg_web-lv_home
                      755G  6.2G  711G   1% /home

[root@web /]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Sun Jul 10 14:37:44 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_web-lv_root /                       ext4    defaults        1 1
UUID=bc2a5e3c-d55a-4980-887a-695cb0e0dbe7 /boot                   ext4    defaults        1 2
UUID=C024-19D6          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
/dev/mapper/vg_web-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_web-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
share|improve this question

1 Answer 1

up vote 2 down vote accepted

You mean lv_home and lv_root, presumably, given that vg_home doesn't exist... This is why I loathe the RHEL installer; it does such idiotic things with both naming and space allocation.

What you'll need to do is:

  1. Ensure nothing has any files open in /home, and that nothing will try and access any files in /home during the resizing operation. This is best achieved by dropping into single user mode (telinit 1, unless RHEL's gone and switched to upstart or something in recent versions), but if you at least turn off the HTTP and SMTP services you're on a good start.
  2. Unmount /home (umount /home)
  3. Fsck the filesystem (fsck /dev/vg_web/lv_home)
  4. Reduce the size of the filesystem on lv_home to something sensible (resize2fs /dev/vg_web/lv_home 45G)
  5. Reduce the size of the LV to something sensible, but a bit larger than the filesystem (because it's easier to make the filesystem a bit bigger later, but chopping off the end of the filesystem by making the LV a bit too small is catastrophic: lvresize -L50G vg_web/lv_home)
  6. Fsck again (fsck /dev/vg_web/lv_home)
  7. Mount the filesystem again (mount /home)
  8. Expand the filesystem back out to the size of the LV (resize2fs /dev/vg_web/lv_home)

And next time, don't trust what anaconda wants to do, and create the LVs yourself to the sizes that are appropriate for your system.

share|improve this answer
    
Yes I did the abbreviation I need to increase vg_web-lv_root and reduce vg_web-lv_home –  madunix Mar 18 '12 at 10:14
    
Expand the filesystem back out to the size of the LV (resize2fs /dev/vg_web/lv_home) you mean (/dev/mapper/vg_web-lv_root) –  madunix Mar 18 '12 at 10:51
    
No, I did not. Extending the root LV is a separate exercise involving the use of lvextend and resize2fs, which I've left as an exercise. –  womble Mar 18 '12 at 11:20

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.