I have the following one hdd

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Disk identifier: 0xfa6bd800
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      821247      409600    7  HPFS/NTFS/exFAT
/dev/sda2          821248   210991103   105084928    7  HPFS/NTFS/exFAT
/dev/sda3       210991104   317941759    53475328   83  Linux
/dev/sda4       420343806   625141759   102398977    5  Extended
/dev/sda5       435689472   507955096    36132812+  83  Linux
/dev/sda6       507955200   566546431    29295616   83  Linux
/dev/sda7       566548480   625141759    29296640   83  Linux
/dev/sda8       420345856   435687423     7670784   82  Linux swap / Solaris

I have recently recovered one partition from Windows. I want to extend my 'extended partition' /dev/sda4 to the left to use the unallocated space. you could see that /dev/sda4 can be extended from 420343806 to 317941760 (end of /dev/sda3). I tried to this from gparted and it failed.

GParted 0.12.1 --enable-libparted-dmraid

Libparted 2.3
Move /dev/sda4 to the left and grow it from 97.66 GiB to 126.95 GiB  00:00:00    ( ERROR )

calibrate /dev/sda4  00:00:00    ( SUCCESS )

path: /dev/sda4
start: 420,343,806
end: 625,141,759
size: 204,797,954 (97.66 GiB)
move partition to the left and grow it from 97.66 GiB to 126.95 GiB  00:00:00    ( ERROR )

old start: 420,343,806
old end: 625,141,759
old size: 204,797,954 (97.66 GiB)
requested start: 358,901,760
requested end: 625,139,711
requested size: 266,237,952 (126.95 GiB)
libparted messages    ( INFO )

Unable to satisfy all constraints on the partition.
Can't have overlapping partitions.

So I am trying to do the partition extension with fdisk.

I think these are the following steps. 1. delete /dev/sda4 2. create new extended partition from 317941760 to 625141759. 3. resize2fs on /dev/sda4

But if I do this way, will I lose my logical partitions or data? Or should I be taking another route.

  • try with clonezilla its work for me in some case, first, make a backup from your disk to an image to another new disk, then delete the extended partition, recreate it, with same arangement but larger size, the restore the image chose advance, do not create partition table, then it should works fine
    – JACK
    Apr 14, 2018 at 7:52

1 Answer 1


I don't know if gparted can do this. Most partition programs would delete sda5-x when you delete/recreate the extended partition.

You could try sfdisk.

# sfdisk -d /dev/sda > sda.original

That creates a dump of the partition layout like so:

# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=     2048, size=  4194304, Id= c
/dev/sda2 : start=  4198400, size=  2097152, Id=83, bootable
/dev/sda3 : start=  6297600, size= 20971520, Id=83
/dev/sda4 : start= 27271168, size=  3844096, Id= f
/dev/sda5 : start= 27273216, size=  1918976, Id=83
/dev/sda6 : start= 29194240, size=  1918976, Id=83

Create a copy of that dump and modify it to your liking.

# cp sda.original sda.modified
# nano sda.modified

So in your case you want to extend /dev/sda4 from 420343806 to 317941760, you simply replace that start= number for the /dev/sda4 entry in the sda.modified file.

When you have done that modification, you can load it:

# sfdisk /dev/sda < sda.modified

And if there is any problem, you can either adapt your edit, or revert to the original state:

# sfdisk /dev/sda < sda.original

That's how you would do it with sfdisk.

In case of parted, if resize does not work, you have to write down the partition offsets and sizes very carefully, for example using:

# parted /dev/sda unit b print free > sda.parted

That would create a file like so:

Model: Generic STORAGE DEVICE (scsi)
Disk /dev/sda: 15931539456B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start         End           Size          Type      File system  Flags
        32256B        1048575B      1016320B                Free Space
 1      1048576B      2148532223B   2147483648B   primary   fat32        lba
        2148532224B   2149580799B   1048576B                Free Space
 2      2149580800B   3223322623B   1073741824B   primary   ext2         boot
        3223322624B   3224371199B   1048576B                Free Space
 3      3224371200B   13961789439B  10737418240B  primary   ext2
        13961789440B  13962838015B  1048576B                Free Space
 4      13962838016B  15931015167B  1968177152B   extended               lba
 5      13963886592B  14946402303B  982515712B    logical   ext2
 6      14947450880B  15929966591B  982515712B    logical   ext2
        15929966592B  15931015167B  1048576B                Free Space
        15931015168B  15931539455B  524288B                 Free Space

You may choose a different unit such as sectors; in such a case I like bytes as it leaves zero room for interpretation - depending on the media, partitioning softwares sometimes have differing opinions regarding sector sizes and such.

With the exact partition offsets and sizes and types known to you, in parted you can simply do a mklabel (reset the partition table) and recreate a new one from scratch, recreating the partitions you want to keep, changing the partitions you want to change.

Please note that neither of those options will do anything to modify or resize the filesystems on your partitions. So this solution is only good if you can handle that on your own, or want to create a new empty partition in the free space.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .