Quote:
Originally Posted by loadedmind
Hey all. I used CentOS 6.3 32-bit to install my server. I took the defaults during the installation and chose Basic Server as the package set. It appears that /home got its own partition and it has a little over 400GB of free space. Meanwhile, /root has only 40GB. I've copied over a subversion branch and I'm short on disk space afterwards. I'm wondering if there's a way to take the free space on /home and give some of it (about 300GB) back to root since I won't need that much space. /home is using LVM. Here's the output from df:
Code:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centostest-lv_root
50G 7.0G 40G 15% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sda1 485M 56M 405M 12% /boot
/dev/mapper/vg_centostest-lv_home
405G 11G 374G 3% /home
I googled lvreduce and I believe I can probably get that done, but I'm not sure how to get the space re-allocated to root after I reduce /home.
So far, this is what I've come up with:
1) Reboot into the LiveCD of CentOS so that I can unmount the filesystem
2) umount /home
3) resize2fs -p /dev/mapper/vg_centostest-lv_home 300GB
4) lvreduce -L 300GB /dev/mapper/vg_centostest-lv_home
5) fsck /dev/mapper/vg_centostest-lv_home
Reboot
6) lvextend -L+300G /dev/mapper/vg_centostest-lv_root
7) resize2fs /dev/mapper/vg_centostest-lv_root
Does this look about right to you all or did I miss a step?
Thanks for any feedback/suggestions
loadedmind
|
There are multiple things to note here.
Is this a SVN server? If not, it shouldn't be located on / but rather in your home directory.
You are almost there!
1 & 2 is correct. However as /home is not the root fs you can login as root directly and umount /home without using a rescue cd.
NOw do the filesystemcheck.
3. This only shows how small you can make the filesystem. It actually doesn't do anything.
Also the last argument should be xG and not xGB.
resize2fs /device/path 299G
4) I opt for using lvresize... The size you actually specify is the new size(so you will get 100GB extra free physical extents). I'm not sure if lvreduce does -300GB (I doubt it)
lvresize -L 300G /device/path
5) resize2fs /device/path (I make the fs 1 GB smaller then the LV at first, just to be sure, after that I make it the full size of the LV)
You can mount /home again.
With vgs command you can clearly see how much free space you have for your root lv.
lvresize -L newsizeGB /device/path
resize2fs /device/path
df -h to check if the new size is present.
Hope this helps.