Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Western Digital Green drive from 512 byte sectors (jumpered) to 4k byte sectors (removal of jumper)

I have just purchased two Western Digital WD20EARS disks and discovered that they incorrectly report their physical sector size to the OS as 512 bytes, even though the specs suggest they have 4k sectors.

If I proceed to correctly align my partitions on this disk, do I need to perform any additional configuration to tell the filesystem that all write operations must be multiples of 4k, and only on 4k boundaries? Or can I just make sure my filesystem block size is a multiple of 4k, and all will be well? (As in, I won't encounter any read-modify-write operations done by the drive firmware.)

I am running Linux and plan to use software RAID0 + ext4, but information for other OSes and filesystems would be interesting too.

share|improve this question

marked as duplicate by Mokubai, Sathya Jun 12 '11 at 4:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The question I linked seems to be almost exactly the same problem as you are having and it looks like you can specify the alignment of the partitions in fdisk, just ensure that you use a multiple of 8 sectors (4096 bytes) from the start of the drive as your partition start and it should be correctly aligned. This reporting of 512byte sectors is odd, confusing and apparently by design and for compatibility with older OSes that will never support 4k sectors. seems relevant too. – Mokubai Jun 11 '11 at 10:49
The question you linked to is asking how to enable 4k sectors. My question is that since you can't enable 4k sectors on these drives, what filesystem settings should you use to work around the issue. Sadly aligning the partitions is not enough on its own, as this doesn't prevent a filesystem from using blocks <4k and causing read-modify-write. – Malvineous Jun 11 '11 at 12:45
I don't think there is really much you can do about it, the question I linked mentions the same type of drive and seems to suggest that there is no way to enable the true 4k sector behavior, hence my flag as a duplicate, from what I can find the only information you will get is going to be a copy of that question. As long as your partition is aligned to a 4kb sector boundary and uses 4kb clusters (which is quite standard) then you should not incur the read-modify-write penalty, as the OS will only write in 4kb blocks. – Mokubai Jun 11 '11 at 12:56
up vote 2 down vote accepted

As I stated in my comments, as long as the actual filesystem on the partition has been set to use 4kb clusters and these clusters are aligned with with the drives 4kb sectors by ensuring that the sector start value of the partition is a multiple of 8 then the operating system itself will always write its data in 4kb clusters and thus always write to the drive in a 4kb sector block. This means you will never see the read-modify-write performance penalty.

Western Digital tells you how to ensure that your partitions are 4kb aligned at

The Linux partition editor: parted, has an alignment option to ensure that Advanced Format drives are correctly configured from version 2.1:

-a alignment-type, --align alignment-type

valid alignment types are:

     none              Aligns to 512 byte sector boundaries. 

     cylinder         Align partitions to cylinders. 

     minimal          Use minimum alignment: 4KB on AF drives 

     optimal          Use optimum alignment: 1MB boundaries  

The default from parted 2.2 is to align to 1MB boundaries - optimal. Use minimal or optimal for Advanced Format drives. For example if your drive is sda:

parted -a optimal /dev/sda

will ensure that parted creates partitions on 1 MB boundaries.

share|improve this answer
This does seem to be the case. For the record, mkfs.ext4 uses the -b option to set block size. 1024, 2048 and 4096 are all valid, so for small partitions you should make sure the block size is set to 4096, for large partitions this seems to be the default. (Also I think you mean the filesystem, not the partition, being set to use 4k clusters.) – Malvineous Jun 12 '11 at 0:59
Yes, as you say I do actually mean that the filesystem on the partition should be set to use 4kb clusters, I'll adjust my answer. – Mokubai Jun 12 '11 at 8:51

Just make sure that all partitions start at sector number multiples of 8 with the command

fdisk -l -u /dev/sdX

Mordern Windows versions and Linux Distributions should create them this way by default.

share|improve this answer
This is what I meant by "if I proceed to correctly align my partitions". I am mostly concerned about the filesystem trying to write in 512 byte blocks instead of 4k blocks, since the drive tells the OS this is best, by reporting the wrong physical sector size. – Malvineous Jun 12 '11 at 1:03

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