Using fdisk to repartition a drive

Q I have an 80GB hard drive, which is configured as follows:

hda1 12.9GB Vfat (Win98 SE) 0-27045
hda2 776MB Linux Swap 53789-55366
hda3 16.7GB Linux 55367-90269
hda4 32.9GB Linux 90270-158800

Using YaST I managed to reduce the size of hda1, thus leaving a space at 27046-53788. Unfortunately fdisk does not see the spare space and I must first delete a partition. Is there any way I can use fdisk to delete hda1 and reconfigure it as two partitions without destroying the data on hda1? If I reconfigure hda1 as 0-27045 and the new partition as hda5 would hda1 be reformatted and the data destroyed?

A As you already have hda1-4, you can't create any other partitions without deleting one and creating an extended partition. The swap filesystem is an ideal candidate for this, since you can dump it without losing any important data. You can create hda2 as 27046-55366, then create hda5 and hda6 as logical partitions within hda2. Being forced to have to have four primary partitions is a 20-year-old legacy issue, which unfortunately is still sticking around. Usually it's a good idea to avoid creating more than one primary partition, and just use extended partitions for everything else, so that if additional partitions have to be created it's easy enough to do so without deleting anything. Each disk can have a single extended partition, which can contain as many logical partitions as you like.

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar