Increase the /home without losing the data

peyman03

Verified User
Joined
Mar 7, 2013
Messages
11
hi
Increase the /home without losing the data
my output df -h is :
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_localhost-lv_root
50G 3.2G 44G 7% /
tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/sda1 477M 41M 411M 10% /boot
/dev/mapper/vg_localhost-lv_home
24G 22G 17M 100% /home
-----------------------------------------------------
Centos 6.7

rgs,
Peyman
 
I'm not sure, but there might be 3rd party software that can resize a partition.. possibly stealing some space from /. You'd have to google to see what's available.
However, if you were to add a 2nd disk, you could always set up the new disk as /home2 and then tell DA to use it:
http://help.directadmin.com/item.php?id=451

The other option is to add a 2nd disk... mount it as /home2 at first, copy all of /home/* to /home2/*.
Then unmount /home... and remount as say, /home.old.
And mount the new disk as /home, and then you don't need to change any settings (this would be preferred).

John
 
First, you need to be able to extend the filesystem. Does the command:
pvdisplay
show any "Free PE"? That is how much of the Physical volume is unused. If so then you can extend the logical volume, you need to do this before you an extend the filesystem. If there aren't any Free PEs available there, use the command:
vgdisplay
this will show your volume groups, if there are Free PEs there then you can still grow the logical volume, since there is still space left in the volume group.

If you have Free PEs available then you use the command:
lvextend -L+XXXXXG /dev/mapper/vg_localhost-lv_home

where XXXXX is the number of Gigabytes to extend it, or you can use -l+YYYYY instead of -L+XXXXXG where YYYYY is the number of extents to add to the existing volume.

Assuming that worked, now you need to extend the filesystem and that really depends on the type of filesystem you used. For ext4 filesystems, use something like:
resize2fs /dev/mapper/vg_localhost-lv_home
for xfs filesystems use something like:
xfs_growfs /dev/mapper/vg_localhost-lv_home

that will extend to filesystem to size of the volume.

If you have access to a Linux VM, I suggest you test these commands before you try this on your live system(s). I have used these before and they work for me, but you should test them for yourself and get comfortable how to use them.
 
Back
Top