Last time I shrank a partition, it was just as easy as deleting it and recreating it from the same start sector. But this time, fdisk won't allow to recreate the partition from sector 63, it forces 2048 as a minimum.
Note that I'm working on a headless server and gparted is not an option because it's a GUI.
- Why this behavior from fdisk?
- Would using 2048 cause data loss?
- Any workaround or solution to shrink the partition?
root@ubuntulive:~# fdisk -u=sectors /dev/sda
Command (m for help): p
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0ab2afe6
Device Boot Start End Blocks Id System
/dev/sda1 * 63 104872319 52436128+ 83 Linux
/dev/sda2 104872320 113274314 4200997+ 83 Linux
/dev/sda3 113274315 312576704 99651195 83 Linux
Command (m for help): d
Partition number (1-4): 1
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-312581807, default 2048): 63
Value out of range.
First sector (2048-312581807, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104872319, default 104872319): 52436159
Command (m for help): p
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0ab2afe6
Device Boot Start End Blocks Id System
/dev/sda1 2048 52436159 26217056 83 Linux
/dev/sda2 104872320 113274314 4200997+ 83 Linux
/dev/sda3 113274315 312576704 99651195 83 Linux