LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-05-2012, 03:03 PM   #1
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 302
Blog Entries: 4

Rep: Reputation: Disabled
Relinquish free space on home for root


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
 
Old 09-07-2012, 05:00 AM   #2
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
Quote:
Originally Posted by loadedmind View Post
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.
 
1 members found this post helpful.
Old 09-07-2012, 08:42 AM   #3
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 302

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
Thanks for the second set of eyes deadeyes. Sure appreciate it. Guess I didn't know about the lvresize command. Good stuff.

About SVN. I'm eventually going to be replacing the existing subversion server with CentOS 6.3. It's currently running FC 14 as a virtual machine. This was done by my predecessor. My eventual configuration will be to create a second HDD for the VM, mounted as /opt, so that subversion is on its own vmdk. I setup this physical machine just as a proof of concept until I'm able to migrate SVN to its new home on the new VM. Unfortunately, I still have a lot of work to do, trying to reverse-engineer how my predecessor setup the current subversion server. There's another question here on this topic, but, in short, he joined SVN and TRAC at the hip (regarding authentication) and I'll have to ensure it's identical on the new box. Sigh... More fun to come. I wish a selective dd command existed that could take a clone of just configurations and copy them to another server.
 
Old 09-07-2012, 03:56 PM   #4
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
Quote:
Originally Posted by loadedmind View Post
Thanks for the second set of eyes deadeyes. Sure appreciate it. Guess I didn't know about the lvresize command. Good stuff.

About SVN. I'm eventually going to be replacing the existing subversion server with CentOS 6.3. It's currently running FC 14 as a virtual machine. This was done by my predecessor. My eventual configuration will be to create a second HDD for the VM, mounted as /opt, so that subversion is on its own vmdk. I setup this physical machine just as a proof of concept until I'm able to migrate SVN to its new home on the new VM. Unfortunately, I still have a lot of work to do, trying to reverse-engineer how my predecessor setup the current subversion server. There's another question here on this topic, but, in short, he joined SVN and TRAC at the hip (regarding authentication) and I'll have to ensure it's identical on the new box. Sigh... More fun to come. I wish a selective dd command existed that could take a clone of just configurations and copy them to another server.
Always difficult taking things over from predecessors mostly they don't document their setup :S

I wish you good luck for that!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ambiguity in free disk space in /home partition vharishankar Linux - General 15 02-22-2013 02:58 PM
Migration of space from /home to root lakshmi4linux Linux - Newbie 1 03-31-2009 03:28 AM
Moving free space to /home partition lonecrow Linux - Newbie 17 09-09-2007 05:48 PM
Not enough space for root directory on a drive with 50g free space??? auoq Linux - Newbie 1 10-13-2004 12:44 PM
Creat free space from /home partition, how? hraposo Mandriva 1 09-22-2004 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration