Linux WD EARS Advanced Hard Drive Format

Introduction

Nowadays hard drive manufactures are switching to a new hard drive technology which uses 4KB sectors size instead of conventional 512B. This new technology requires little tweaks to get a better performance in comparison to out-of-the-box settings. This article will describe some simple to follow instructions on how to partition the WD EARS hard-drive to get better overall performance. Getting the partitioning part done by aligning each partition can rapidly increase a hard drive’s performance.

512B sector size standard is here for over 30 years and therefore lots of the code written for a Linux OS has 512 number hard coded in its source.
The main idea in regards to the 4 096 B size sectors is to increase the bit density on each track by reducing the number of gaps which hold Sync/DAM and ECC ( Error Correction Code ) information between each data sectors. Therefore, for 8 x 512 B sectors the track also holds 8 sector gaps.

By having one single sector of size 4 096 B ( 8 x 512 B ) the track holds only 1 sector gap for each data sector thus reducing an overhead for a need to support multiple Sync/DAM and ECC blocks and at the same time increasing bit density.

Linux partitioning tools by default start each partition on sector 63 which leads to a bad performance of WD EARS hard-drives since they are not aligned to 4K sector from the beginning of the track.

For this article I’m using WDC WD10EARS-00Y5B1. This is a 1TB SATA hard-drive with 64MB cache memory.

WDC WD10EARS-00Y5B1 EARS WD advanced format

Performance statistics

I bought this Hard Drive for personal use to expand my /home directory by mounting the entire single partition drive to /home . When following the statement on the hard drive’s label : “All other OS software configurationsdrive is ready to use as is.” I rapidly decreased the efficiency of my system. That statement is only true if the following statement is also true: Give a Windows users software and do not bother with Linux guys as they will fix it them self’s. It also said that the drive is environmentally friendly ! Well, if transfering some data to WD EARS drive takes at minimum 3x longer then it normally would this hard drive is hardly environmental and therefore we should get partition alignment right.

Here are some performance statistics using dd command to transfer some arbitrary data to WD EARS hard-drive. Tests are performed using back | track live CD using following script. To increase an accuracy the script runs the dd command 10 x in the loop for each test.

Partition table for WD EARS hard drive starting with sector 63

# fdisk -lu /dev/sda

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
Disk identifier: 0x10bd10bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    20971583    10485760+  83  Linux
  • ext2: 114 MB/s
  • ext3: 47 MB/s
  • ext4: 92 MB/s
  • reiserfs: 87 MB/s
  • vfat: 58 MB/s

Partition table for WD EARS hard drive starting with sector 64:

# fdisk -lu /dev/sda

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
Disk identifier: 0x10bd10bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              64    16777280     8388608+  83  Linux
  • ext2: 126 MB/s
  • ext3: 87 MB/s
  • ext4: 106 MB/s
  • raiserfs: 101 MB/s
  • vfat: 58 MB/s

It appears that ext3 file system is most crippled when disk’s partition is not aligned and starts on sector 63. This test may not be the most effective benchmark as there are many more variables to be filled into the formula, however it give us some picture of what is going on. I could see the difference even on greater scale when installing back | track Linux on WD EARS drive formatted with ext3 partition starting on sector 63 ( 34 minutes ) and 64 ( 8 minutes ).
NOTE:

Another test which can be performed is to use hdparm -Tt /dev/sda . However, this test disregards all partitioning and file systems as it will access a raw block device and the results are same whether you have partition starting with sector 63 or 64 or even with no partitions at all.

Partitioning WD EARS hard-drive

Single Partition

Partitioning an EARS hard drive with a single partition is quite easy job. fdisk partition utility allows user to begin a partition with any sector number > 63. Suppose our EARS hard drive block device is /dev/sda we need to start first partition on sector number 64.

# fdisk -u /dev/sda

The number of cylinders for this disk is set to 121601.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

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
Disk identifier: 0x10bd10bc

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-1953525167, default 63): 64
Last sector, +sectors or +size{K,M,G} (64-1953525167, default 1953525167):
Using default value 1953525167

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

In fact you can start partition by any number x where x >= 64 and is ^2. Thus 64, 128, 256, … 2048 etc. For completeness I have also tested Advanced Format Hard Drive Utility for WindowsXP developed by Western Digital and this piece of software aligns a first partition to a 2048 sector. I will follow this suggestion for the rest of this guide.

Multiple Partitions

If you decide to have multiple partitions on the WD EARS drive, the partitioning scheme is little bit more tricky. Here is an example of partitioning table produced by fdisk with all partitions aligned:

# fdisk -lu /dev/sda

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
Disk identifier: 0x10bd10bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    20973568    10485760+  83  Linux
/dev/sda2        20973576    41945096    10485760+  83  Linux
/dev/sda3        41945104  1953525167   955790032    5  Extended
/dev/sda5        41945168    62916688    10485760+  83  Linux
/dev/sda6        62916752    83888272    10485760+  83  Linux

Here we have created 2 primary partitions ( sda1, sda2 ) with 10GB of data, 1 extended partition ( sda3 ) as a container to hold rest of the free space and 2 logical partitions ( sda5, sda6 ) each with 10GB.

When sda1 end sector is 20973568 then the start of sda2 is ( 20973568 + 8 ). Following the same rule when sda2 end is 41945096 then start of sda3 is ( 41945096 + 8 ).

For logical partitions you need to use number >= 64 . When start of extended partition is 41945104 then start of first logical partition sda5 is ( 41945104 + 64 ).

Now we repeat the steps as with primary partitions but using number 64 instead of 8. When end of sda5 is 62916688 then start of sda6 is ( 62916688 + 64 ) and so on. It is important to make this numbers right otherwise a WD EARS hard drive will decrease in performance. To do this task use:

# fdisk -u /dev/sda

Another inportant rule to follow is to make your starting sectors for each partition even. In case of primary and extended partitions the starting sector number which you add to previous partition end sector must be even number >= 8 and for logical partitions the number must be even number >= 64.

To test your partitions use ext3 filesystem as the writing speed difference between partitions which are not aligned is big enough to clearly see that something is not going right.

Furthermore, the disk performance deteriorates with increasing number of sectors. For example a partition starting at sector 2048 with ext3 yields 85.5 MB/s wheres partition starting at sector 1887438864 which is around 900GB further away from the center of the disk the transfer speed for ext3 filesystem is 60 MB/s and for not aligned partition the transfer speed is around 40 MB/s.

Changing Number of head and sectors

If you are not good in math you can use another approach to partitions your hard-rive. This will involve changing the default value of head and sectors per track. First is to use fdisk with following options:

fdisk -H 224 -S 56

Then create your partitions as per usual, however the drawback is that your first partition will not be aligned. Similar to Microsoft adopted scheme of:

fdisk -H 240 -S 63

Multiple partitioning with Windows XP dual boot

Procedure for partitioning of WD EARS drive for Dual Boot with Windows XP is exactly the same as in previous section. I suggest using starting sector 2048 since this is the sector number generated by Advanced Format Hard Drive Utility for Windows XP.

When you begin Windows XP installation the windows will complain that it can not install on the first partition. However, it will give you an option to remove this partition and install on the free space. What Windows XP installed will do is that it will create a first partition starting on sector 63 so you do not even have to fasten your seat belts during the installation as the installation it self will be painfully slow. Once the installation is over use Advanced Format Hard Drive Utility to put things exactly where they were ( sector 2048 ) when you created your partitions with fdisk.

Conclusion

Despite of first frustrations of not knowing what is going on with the performance of my system, the hard drive is great. It is very quited and do not produce much heat. The hard-drive has better performance then my other WD740ADFD00NLR4 Western Digital 74GB 10000RPM SATA drive so I might end up using WD EARS drive for my multi Linux boot system 🙂

Before you consider to buy / use one of the Western Digital GreenPower drives you should be aware of their high Load_Cycle_Count value as a factory settings. What it meas that WD GREEN drive parks its head every 8 seconds which rapidly decreases its usability. WD support provides tool called RE2GP Idle Mode Update Utility short for “wdidle” to fix this problem. RE2GP Idle Mode Update

wdidle utility can be downloaded here:

http://support.wdc.com/product/download.asp?groupid=609&sid=113

READ MORE ABOUT THIS ISSUE HERE:

http://www.gossamer-threads.com/lists/linux/kernel/903485

I’m sure that there are more tweaks or alternatives on how to increase a performance of WD EARS drive so please let me know and I will update this document. Thank you