Linux: Combine two partitions?

3

2

This workstation is running Fedora 11. It has 4 HDDs raided into 4 partitions:

/ (31 gig)
/boot (134 meg)
/data (140 gig)
/FC12 (31 gig)

The previous employee that used my current workstation set it up this way. He apparently created the FC12 partition to test a Fedora 12 installation. I don't need Fedora 12 so I wiped that partition and now I'm wondering if its possible for me to combine the /FC12 partition into the / partition, so that the / partition will now be 62 gigs.

Is this possible? If so, how? Can it be done w/o reinstalling the OS?

I've toyed with Fedora's LVM admin interface but it seems very basic and there doesn't seem to be anything about combining partitions. I've also messed with other HDD utilities that are in Fedora (Palimpsest Disk Utlity) but all it seems to be able to do is mount and umount partitions.

Jake Wilson

Posted 2010-04-27T19:34:06.073

Reputation: 3 044

btw doing an fdisk -l would give us a much better picture of actual partition order. and df -h for what they are used for and how much is used. – xenoterracide – 2010-04-27T19:55:39.923

1There are suggestions below on how to do this, but the easiest solution is just to mount the 31GB partition somewhere you need the space, perhaps as a subfolder of /data, or on /home – Dentrasi – 2010-04-27T20:51:20.587

Answers

5

You can't directly merge partitions, but what you can do is just delete the partition and resize the other partition into the new free space. This however requires that the deleted partitions comes directly after the one into which it should be merged. You can list partitions with fdisk -l and manipulate them with cfdisk, fdisk or gparted.

If LVM is used, then there is no such restriction, you can just lvremove the logical volume and the free storage will automatically returned into the pool of free space in the volume group, which can then be used to resize the existing partition (lvextend). To see if LVM is used look at the output of:

vgdisplay -C
lvdisplay -C

Once you have resized the partition you also have to grow the filesystem to fit the partition, this can be done with one of (depending on the file system you use):

resize2fs (ext2, ext3)
xfs_growfs (xfs)
resize_reiserfs (reiserfs)

Grumbel

Posted 2010-04-27T19:34:06.073

Reputation: 3 100

1But he can move the other two partitions into the freespace, allowing him to merge the freespace to the first partition. – Bobby – 2010-04-27T21:02:23.250

-1

No you can't combine partitions... That said. What you can do is whip out gparted (and I hope that the fs supports this operation) delete the FC12 partition this is after data right? and then resize the data partition to use the rest of the space.

xenoterracide

Posted 2010-04-27T19:34:06.073

Reputation: 628