Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The current partition setup on my laptop install looks something like this -

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xed1f86f7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5592    44913928+   7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2           18637       19457     6592320   12  Compaq diagnostics
Partition 2 does not end on cylinder boundary.
/dev/sda3            5593       18636   104775930    5  Extended
/dev/sda5            5593       10571    39993786   83  Linux
/dev/sda6           10572       10820     2000061   82  Linux swap / Solaris
/dev/sda7           10821       18636    62781988+  83  Linux

Partition table entries are not in disk order

As can be seen below, / resides on /dev/sda5 and /home is mounted on /dev/sda7 with a 2GB swap partition between the two. Space considerations have already started cropping up and I would like to change the partitions so that / and /home are combined into one large partition and swap is at the end of the table. Can this be done without losing any data in my current root file-system or for that matter in the /home directory?

The sda5 and sda7 partitions are ext4.

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5              38G  5.6G   31G  16% /
udev                  922M  320K  921M   1% /dev
none                  922M  208K  921M   1% /dev/shm
none                  922M  216K  921M   1% /var/run
none                  922M     0  922M   0% /var/lock
none                  922M     0  922M   0% /lib/init/rw
/dev/sda7              59G   23G   34G  41% /home
share|improve this question

1 Answer 1

up vote 3 down vote accepted

You first want to move /home onto the / partition. Unmount /home, remount it in /mnt, and move the directories in /mnt across to the now empty /home directory. Then edit fstab so that /home isn't mounted at boot any more.

Then you want to remove the old /home partition and increase the size of the / partition. Gnuparted or qtparted will both let you do this and have easy GUIs.

If your /home partition has more data than will fit in your unresized / partition then you have a problem.

share|improve this answer
    
/home used 23G, / has 31G available. So, no size problem it seems. ;-) Other than that, this should work nicely. –  Jürgen A. Erhard Jan 13 '10 at 6:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.