2

I used fdisk -l and saw this.

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x580a1fd4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   417083391   208438272    7  HPFS/NTFS/exFAT
/dev/sda3       417095656  1953523711   768214028    f  W95 Ext'd (LBA)
/dev/sda5       417095658  1871315459   727109901    7  HPFS/NTFS/exFAT
Partition 5 does not start on physical sector boundary.
/dev/sda6      1871316992  1900611583    14647296   83  Linux
/dev/sda7      1900613632  1908424703     3905536   82  Linux swap / Solaris
/dev/sda8      1908426752  1953523711    22548480   83  Linux

This show that my logical partition sda5 ends at 1871315459 and sda6 begins at 1871316992. Then where did my 1533 sectors ie 766 kb go?

1 Answer 1

4

It's an alignment thing

For performance reasons you really want your storage to be aligned on all levels. While this is probably just a simple hard drive with a partition table and a file system on it directly, it's still important to not misalign it.

What about alignment?

Suppose your hard drive works with 4 kB sectors (yours appear to work with 512 bytes) and you've aligned the partition to start with just a single byte offset, then updating a single 4 kB file system page will amplify to a two-sector write on your disk. With just 4 kB becoming 8 kB, this is not a great deal, but on larger systems or RAID setups this will become a real problem once the stripe size (block size) becomes hundreds of kilobytes or even megabytes. Once misaligned on this stripe size, this could amplify an unlucky 4 kB filesystem block to a 2x block size (e.g. 2 MB) write to disks, also impacting parity calculations (if any).

SSD and other flash memory based drives are affected even worse. Usually, these drives are using huge page sizes. I've seen 512 kB "sector" sized USB flash drives out there and this is a common size for SSD drives IIRC. A misalignment when using multiple layers on top of it (e.g. dm-crypt, LVM, file system) could result in a huge write amplification (on top of what they already have) you really want to avoid unnecessary wear of the drive.

Why this gap on my drive then?

Most recent utilities just use 1 MB alignment on the disk as a safe default. It is a lowest common denominator for common set ups, avoiding most misalignments while not losing too much space.

Gaining 766 kB on 1 TB is not worth the performance impact it would impose.

Can I fix this?

Yes, you can, you'll have to look into the specification of your drive, the block size of your file system and figure out the proper alignment yourself and then fixing the partition table yourself. It's kinda dangerous to do this, though.

In your case sda5 is probably misaligned (beginning) and I would move the sda5 to proper alignment on an occasion that would suit me (backing up data first!).

8
  • I have a similar issue with partition 1 does not end at a cylinder boundary errors in many partitions. Can you elaborate on how to fix please?
    – To Do
    Jan 16, 2013 at 17:51
  • @ToDo Not all utilities are able to scan down the whole stack of storage layers. Also, utilities like fdisk can't handle most 4 kB sector disks properly. If an partition starts at a misaligned sector, it's hard to get it fixed. However, running into cylinder misalignments is not a big deal nowadays I think. Hard drives aren't really using by Cylinder/Heads/Sectors the same as they did in the past. Just use an updated parted-like utility and you're all set.
    – gertvdijk
    Jan 16, 2013 at 17:55
  • Isn't gparted good? To partition my disk, I first reduced the Windows partition from within Windows. Then used Gparted using a live CD to create an extended partition containing three partitions (root, swap, ntfs for data). How is it that gparted created such a partition table? Since I installed Ubuntu, I noticed that Windows seems to be running slower. I don't know if this is related.
    – To Do
    Jan 16, 2013 at 17:58
  • Gparted is fine. And as I said, the cylinder (opposed to sector) warning is probably not a big deal. What tool presents you this warning message?
    – gertvdijk
    Jan 16, 2013 at 18:00
  • sudo sfdisk -lV /dev/sda gives me these errors, on all partitions, even those I never even touched.
    – To Do
    Jan 16, 2013 at 18:02

You must log in to answer this question.

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