2010/09/18

This makes no sense

The great big huge 1.5 TB drive I bought for Corey is a WD15EARS. One thing all those letters mean is that it's an Advanced Format drive. Which is Western Digital Marketing Speak for "we use the new, modern 4k sector size." But of course the drive reports its block as 512 bytes, because otherwise it would fail under Windows. So hoops must be jumped through.

And some of them make no sense.

It seems to me that all that is needed is that the partition gets aligned on 4k boundary, that is multiples of 8 sectors of 512 blocks. This should be enough, because Linux internally uses 4k pages for everything. As I understand it.

Now look at the following

# fdisk -u -l /dev/sdb
Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
224 heads, 56 sectors/track, 233599 cylinders, total 2930277168 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          56      213247      106596   83  Linux
/dev/sdb2          213248  2930277167  1465031960    5  Extended
/dev/sdb5          213304   125213304    62500000+  83  Linux
/dev/sdb6       125213361   250213361    62500000+  83  Linux
/dev/sdb7       250213418   375213418    62500000+  83  Linux
/dev/sdb8       375213475   500213475    62500000+  83  Linux
/dev/sdb9       500213532   625213532    62500000+  83  Linux
/dev/sdb10      625213589   750213589    62500000+  83  Linux
/dev/sdb11      750213646   875213646    62500000+  83  Linux
/dev/sdb12      875213703  1000213703    62500000+  83  Linux
/dev/sdb13     1000213760  1125213760    62500000+  83  Linux

There are 9 logical partitions. sdb5 starts on an 8*512 boundary. sdb6 is 8*512 boundary+1, sdb7 + 2 and so on. sdb13 also starts on 1000213760/8 = 125026720 an 8 sector boundary. I should be fine, right? NO:

# time dd if=/dev/zero of=/dev/sdb13 bs=1024k count=10240
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 625.273 seconds, 17.2 MB/s

real    10m25.391s
user    0m0.150s
sys     2m6.061s

I ran the test 4 times on each partition. Speed is around 16-18 MB/s except when I browsed to Intel's site to look at specs to the X25-V. I tried fdisk -b 4096, which failed pathetically.

And yes, I know that dd isn't a real benchmark. But as a readily available tool to see if I've got it right before rsyncing 80 GB of data, it suits the task just fine.

What does work is something I got from Ted T'so and other tutorials about how to setup SSDs, which also need 4k sectors to keep them happy.

# fdisk -H 224 -S 56 /dev/sdb

Let's see:
# fdisk -u -l /dev/sdb
Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
224 heads, 56 sectors/track, 233599 cylinders, total 2930277168 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 56 1016063 508004 83 Linux
/dev/sdb2 1091328 126104831 62506752 83 Linux
/dev/sdb3 126129920 251143423 62506752 83 Linux

# time dd if=/dev/zero of=/dev/sdb2 bs=1024k count=10240
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 161.283 seconds, 66.6 MB/s

real 2m41.308s
user 0m0.070s
sys 1m19.818s

4x speed improvement! INSTANT WIN!

Living on the bleeding edge can be painful.

No comments: