4KB Sectors ~ Mon, 03 May 2010 18:55:37 +0000
I just want to give a quick note here about 4KB sectors in newer hard drives. If you follow technology at all, you are probably aware that new hard drives from Western Digital are using their "advanced format technology." All this really means is that each physical sector of the drive is 4096 bytes (4KB) is size instead of 512 bytes. That causes problems for operating systems that assume each sector is 512 bytes (e.g. Windows XP).
A couple weeks ago I ran out of space on the 1TB drive in my DVR. So I ordered a new 2TB drive to resolve the problem. This 2TB drive is one of Western Digital's advanced format drives. To install the new drive I booted with SystemRescueCd and used GParted to create the partition table (GPT instead of MBR) and file system (JFS). After rebooting my DVR I started copying about 14GB of data from my Windows computer over to the new drive in my DVR. Both machines are connected to each other through a 1Gb ethernet switch. Typically, this transfer happens at about 40MB/second, but this time it was doing around 9MB/second. Clearly something was wrong.
To investigate, I installed gdisk (GPT fdisk) and took a look at my new drive. Issuing the verify command in gdisk showed the following message:
Caution: Partition 1 doesn't begin on a 8-sector boundary. This may result in degraded performance on some modern (2009 and later) hard disks.
Well, that sucks. I specifically created a GPT because I thought it would take care of the sector alignment issue. Investigating further I found this:
Command (? for help): p1 Number Start (sector) End (sector) Size Code Name 1 34 3907029134 1.8 TiB 0700 Linux/Windows data
There's the problem: 34 / 8 = 4.25.
So I deleted the partition and re-created it with gdisk. Doing so, I was able to specify that I wanted the partition to start on sector 64. I then re-mounted the partition and started my data copy again. This time I was getting my full 40MB/second. That's a 78% improvement over what it was doing.
So, if you get one of these new disks, make sure you use the right tools to partition it. The problem is that the drive could, and does in my case, report that it uses 512 byte logical sectors when in reality it uses 4096 byte sectors. So you have to know to do the alignment manually.
For more in-depth information about these new drives see the following articles:
Finally, be aware that SSDs also use sectors that do not align with 512 bytes.