Why does partition alignment affect hdparm -t /dev/sda

0

I have a Samsung SSD 840 EVO 120GB in my debian box, which shows disappointing performance

beaureve:/home/martin# hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 242 MB in  3.01 seconds =  80.34 MB/sec

I tried with two different installations, one 32 bit and one 64 bit and the resluts are comparable.

In my attempts to solve the problem I came upon many postings, such as this one, which claim that partition alignment is something to keep an eye on and that improper alignemnt can make a hdparm -t difference of a factor of 4.

I could understand this, if I was probing a specific partition like /dev/sda1, but I am probing the entire disc (/dev/sda) and partitioning should not matter at all (and in either case the filesystem should not matter).

  • Is this an urban legend and the posters who claim that proper alignment fixed their problem actually did something else,
  • or am I missing something?
  • While we're at is: is linux really affected by the BIOS setting AHCI vs. IDE as it is often claimed?

Martin Drautzburg

Posted 2016-04-11T16:34:47.853

Reputation: 141

1You are doing a read benchmark. Partition alignment wouldn't matter even if you do it per-partition. – Tom Yan – 2016-04-11T17:44:33.167

I have no idea how bad could IDE compatibility mode affect the performance, but why not AHCI anyway? – Tom Yan – 2016-04-11T17:50:04.587

@TomYan, if you're bypassing all the caches, misalignment could result in requiring two physical reads for each logical read (ie. you're reading each physical sector twice). – Mark – 2016-04-11T23:47:00.737

@Mark There is not even way specified in ATA standard to bypass (or disable) read cache. – Tom Yan – 2016-04-12T03:59:51.760

@Mark Also, two physical reads for each logical reads? That would only happen if the logical block is larger than the physical block (i.e. physical block < 512 bytes). On the contrary, if the physical block is larger than logical block (e.g. AF 512e), one "physical read" will always "cover" multiple "logical read"; if the disk will really "discard" the "extra" data fetched in a "logical read" like you think, then multiple "unnecessary" physical read would occur anyway, no matter if it's aligned or not. – Tom Yan – 2016-04-12T04:09:21.527

No answers