4

So, I have one of these newfangled external Samsung T3 USB SSD drives here, sized at 250 GB.

Let's see what fdisk has to say about that:

Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x7df0da81

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1  *       64 488392128 488392065 232.9G  7 HPFS/NTFS/exFAT

Sectors are still 512 byte large (I suspect underneath the software layer, things are a bit different), the minimum I/O size is 1 sector, the optimal I/O size is 3553920 byte = 65535 sectors ≈ 31.995 MiB

We see that the factory-performed formatting consists in a single partition from block 64 to block 488392128, which is ~232.88 GiB or ~244.19 GB.

So I just want to repartition using fdisk. fdisk insists that the first partition start at sector 65535. Maxing it out, it ends at sector 488397167, a bit further than the factory-issued partition:

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1       65535 488397167 488331633 232.9G 83 Linux

I know about the 1 MiB alignment boundary which manifests itself by fdisk putting the first partition at sector 2048. The reason for that seems to be a historical accident due to a wart present in the Logical Disk Manager of Microsoft Vista.

But what about this new 65535 sector "alignment"?

  • Keep in mind that the very first byte is at sector 0 according to fdisk. – a CVn Aug 14 '16 at 20:27
  • @MichaelKjörling I did. Thus the alignment is at "65535 sectors" (sectors 0.. 65534 are before the first partition). That number is not a power of two, nor a multiple of the old "63 sectors per track", but it seems to just be "1 element of optimal I/O size", I reckon fdisk just wants to optimize a bit too hard. – David Tonhofer Aug 15 '16 at 7:38
7

If that 65535 refers to 512-byte sectors, it would not be aligned at all. Unfortunately fdisk with dos partitions can get funny ideas about drive geometry.

Ignore whatever fdisk is trying to do, just use 1MiB alignment anyway. If you don't need dos partitions for any particular reasons, switch to gpt. If fdisk doesn't work, switch to parted, gdisk, or whatever works.

parted /dev/sdb
) unit mib    # parted uses stupid unit by default
) mklabel gpt # beats msdos by a long shot
) mkpart boot 1 512
) mkpart swap 512 2048
) mkpart root 2048 20480
) mkpart home 20480 -1
) print free  # use this whenever you want to see what's available

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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