LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   expand root partition to occupy whole disk (https://www.linuxquestions.org/questions/linux-software-2/expand-root-partition-to-occupy-whole-disk-517585/)

JohnGalt007 01-08-2007 11:43 PM

expand root partition to occupy whole disk
 
I have a pretty old Linux server running some version of redhat. It has a 6 GB disk of which 2 GB are devoted to / and rest of the 4 GB to /home as shown below by df -h command:

Filesystem Size Used Avail Use% Mounted on
/dev/hda1 1.9G 1.8G 25M 99% /
/dev/hda5 3.9G 3.1G 582M 85% /home
none 161M 0 161M 0% /dev/shm


As you can see my root file system is almost 100% full. I'd like to move /home to a new disk and let / occupy the whole 6GB.

I know how to move /home to another disk. But how do I reclaim the space created by /home such that root file system takes up all 6GB without a new installation of the operating system?

Any pointers or solutions would be appreciated.

Thanks.

JG

kilgoretrout 01-09-2007 12:11 AM

gparted can resize partitions and it comes on a bootable livecd:

http://gparted.sourceforge.net/

Note, you will need the live cd since you can't resize on a live, running system. Here's some specific instructions on using gparted to resize a partition:

http://gparted.sourceforge.net/larry...e/resizing.htm

If you have some external storage or space on another internal hard drive, I'd back up your root partition from that gparted livecd using tar:

# cd <mount point of root partition on livecd>
# tar -czvf <path to partition that will recieve backup/filename_of_backup.tar.gz> .

Note the trailing period as it will not run without that.

Resizing with data on a partition is the highest risk partitioning operation with any partitioning tool so it's always best to backup first.

JohnGalt007 01-09-2007 03:23 PM

kilgoretrout, thanks for the prompt reply and thank you for introudcing me to a wonderful tool. However, this did not help me. I was able to boot the machine with systemlinux live cd, which has gparted and a few other such goodies but I could not start X server. I got something like following error message on issuing startx command:

No usable screen found.
XIO error 104: X server could not be started

So, it seems I am stuck doing this at the CLI only unless someone can tell me how to start X server. This machine is pretty old with a PII 300 MHz and 128 MB RAM.

Can someone point me or provide instructions as to how to accomplish what I asked for in my first post here?

Thanks.

JG

Quote:

Originally Posted by kilgoretrout
gparted can resize partitions and it comes on a bootable livecd:

http://gparted.sourceforge.net/

Note, you will need the live cd since you can't resize on a live, running system. Here's some specific instructions on using gparted to resize a partition:

http://gparted.sourceforge.net/larry...e/resizing.htm

If you have some external storage or space on another internal hard drive, I'd back up your root partition from that gparted livecd using tar:

# cd <mount point of root partition on livecd>
# tar -czvf <path to partition that will recieve backup/filename_of_backup.tar.gz> .

Note the trailing period as it will not run without that.

Resizing with data on a partition is the highest risk partitioning operation with any partitioning tool so it's always best to backup first.


syg00 01-09-2007 04:55 PM

Simplest solution is probably to find a good candidate directory, and move it to the newly freed space.
Pick your largest/most likely to grow - something like /var/log, or /opt maybe.

Frees space in your current root to allow other things to grow (slowly hopefully), and the "problem child" gets the new area.
I've used this to avoid having to risk a system I'd rather not play around with.

Else I'd second trying the gparted liveCD.
For CLI instructions, see the GNU parted (which does all the work anyway) site.

timrs 01-09-2007 06:03 PM

A computer with this little harddrive space can't have that much ram, don't you think it'd be a good idea to have a swap partition too?


All times are GMT -5. The time now is 04:58 PM.