Monday 15 April 2019

ext4 - Filesystem config for 4k sector drive that reports 512 byte sectors




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.



Answer



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 http://wdc.custhelp.com/app/answers/detail/a_id/5655



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.



No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...