LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to safely re-partition (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-safely-re-partition-356176/)

squinn 08-23-2005 12:00 PM

How to safely re-partition
 
I need to resize my partitions. How can I safely make my /root partition small and allocate the saved space to /home?

I am using RedHat EL 3. I thought of using cfdisk, but RH 3 does not have it (only sfdisk and fdisk).

Any recommendations/advice appreciated.

-squinn

corfe 08-23-2005 12:38 PM

The normal way to resize a partition is to delete it (losing EVERYTHING on the partition), and make a new one of the new size you want.

That being said, a lot of programs will get around this for you, and although some consider the process to be hackish, I've never had a problem doing it. Partition magic is a commercial program that will resize partitions for you, and GNU's "parted" will also do it. I'd try booting into a live CD and running parted as root.

Just run "parted /dev/hda", where /dev/hda is your hard drive you want to repartition. Then type "print" at the command line to see the size of each partition on the drive. You can change the units it uses by typing "unit m", "unit G", "unit K", "unit %", etc.

Then type "resize x start end" where x is the number of the partition you want to resize (as given in print), start is a number in the given unit saying where you want the partition to start, and end is a number in the given unit where you want the partition to end.

You might want to check parted's documentation to find out what operations your filesystem supports (e.g. I don't think you can resize reiserfs, and changing ext3's start position of the partition doesn't work either), and make sure you understand everything before you go through with it.

AS ALWAYS, YOU SHOULD BACK UP ANYTHING IMPORTANT BEFORE YOU GO THROUGH WITH THIS. I've never had problems doing it, but I've only done it a few times, and your mileage may DEFINITELY vary. User error, software error, or hardware error : if just one happens in the right way, say bye-bye to your data.

--------------

That being said, after you've resized the root partition, you can create a new partition in the unpartitioned space, move the contents of /home over to it, and setup /etc/fstab to mount your newly created partition to the /home directory.

Good luck!

WhatsHisName 08-23-2005 02:31 PM

squinn: Are / and /home set up in simple partitions or are they set up as an LVM?

If you are not sure, from the terminal run:

fdisk -l

and see if any partition types are “linux lvm”.

bosewicht 08-23-2005 02:38 PM

parted works really well resizing partitions. also here are the instructions for resizing partitions in RHEL3.

Red Hat Enterprise Linux 3: System Administration Guide
Chapter 5. Managing Disk Storage

http://webserver.smast.umassd.edu/Sy...size-part.html


All times are GMT -5. The time now is 09:27 PM.