4KB Alignment: How does it affect the efficiency of a hard disk

来源:互联网 发布:淘宝常用文案 编辑:程序博客网 时间:2024/06/06 00:39

 

The cache size and the rotation rate have long been considered as the bottleneck of the transmission rate of the traditional hard disk. Hence, whenever computer users want to improve the I/O performance of their desktops, these are indicators that firstly emerge in their minds most of the time. However, the important role of the mechanism of hard disk storage remains obscure for general users. The problem of 4KB alignment indeed, is accounted for a significant proportion in influencing the transmission rate of hard disk.

 

In the 1K/4K Sector Size Summit 2005, IT giants like Microsoft, Intel, Seagate and Western have realized the necessity of larger sector size in order to meet the demand of mass storage in the future. Since the era of DOS, 512 bytes have always been both the standard sector size and the cluster size of the file system. It is generally admitted that lower sector definition is more capable for small-sized discrete data management. Hence, 512 bytes can fully fulfill the needs during the past decades.

 

Volume

Amount of Sectors

Sector Definition

10MB

20,000

0.005%

10GB

20,000,000

0.000005%

1.1 Relationship between volume of storage and sector definition

 

If we are familiar with the common file system, we may get to know that the FAT (file allocation table) is a chain structure. Before writing a file onto the hard disk, the OS will firstly try to search the entire FAT until it find an unused sector (maybe either empty or marked with 00H in the MFT (Master File Table, new feature in NTFS) with the offset value of 16H) and insert the first 512 bytes data with the address of the next sector at the end. The entire process, which are searching and writing,keeps repeating until the last set of data have been written. No matter the size, it will occupy a whole cluster with file ending label 0x0FFFFFFF7. The chain structure indicates that files are stored discontinuously on a hard disk.


 

Here comes to the problem. The ISO image of a double layers DVD nowadays can simply reach to a size of 4.7GB which equals to 9.4*10^6 times of 512 bytes. That means the single file need to be divided into 9.4*10^6 blocks and being stored separately everywhere in a hard disk. Every single time of searching and writing cost address time, which add up can be an enormous amount. Thus, it is apparent that the larger the sector size, the smaller is the number of file blocks and the number of operation.

 

On the other hand, 4KB sector, known as the Advanced Format, is preferred for its higher volume conversion rate. In each 512 bytes traditional sector, the extra 50 bytes are reserved for ECC (Error Correcting Code) and 15 bytes more are used for Gap, Sync and Address Mark sections. In all, only 512/ (512+65) = 88% space is available after formation.

 

 

 2.1 512 bytes traditional sector structure


However, in Advanced Format, eight 512 bytes sectors combine to form a 4KB sector. Though the ECC have been risen by 50 bytes accordingly, the total volume conversion rate have reached 4096/(4096+115) = 97%, which is a 10% improvement as compared to the previous example.

 

 


2.2 4KB sector in Advanced Format

 

Although the above paragraphs have portrait a bright future of 4KB sector, it takes time to be popularised. Hence, the current resolution for compatibility consideration is to map each physical sectors to eight analog sectors. However, it causes the problem of 4KB alignment mentioned in the title. For a brand new hard disk, its first partition always starts from the 63rd sector (analog sector).Supposing we are going to write a 4KB file onto the hard disk, the data is then divided into eight 512 bytes data blocks and written into analog sectors form 63 to 70 separately. It is worthwhile to notice that the 63rd analog sector locates in the 7th physical sector while the others are in the 8th. The next 512 bytes data will also occupy both the 8th and the 9th physical sectors. The problem comes: the basic operating unit of hard disk is the sector. Every time, the disk will read, modify and rewrite the entire physical sector. Crossing sectors thus mean double times of operation since every following data block will encounter the same problem. For SSD (Solid State Disk) it becomes worse because the lifetime of SDD is decided by the number of writing.




3.1 Mappingof the analog sector

 

To check the state of 4KB alignment can simply open the Start menu and type ‘msinfo32.exe’ in the searching box. Choose Component > Storage > Hard disk in the opened application window. Use the value of the term Partition Starting Offset to divide by 4096. If the quotient is an integer, it indicates the current partition has been aligned already. If not, just use software like PowerQuest or PartitionMagic to modify the reference number of starting sector (must be the power of 2, starting from 64, i.e. 64,128, 256…). Incidentally, the default partition setting of Windows 7 have taken 4KB alignment into consideration, which should be a good news for all Windows 7 users.



4.1 Checking the Partition Starting Offset in System Information

 

 

Bibliography

[1] http://baike.baidu.com/view/381.htm

[2]http://cpcwcq.blog.sohu.com/246399977.html

[3]http://wenku.baidu.com/view/4ad4eb69a45177232e60a205.html

[4]http://forum.51nb.com/thread-1228912-1-1.html

[5]http://storage.chinabyte.com/282/11423282.shtml

[6]wenku.baidu.com/view/04b1bf116c175f0e7cd13739.html

原创粉丝点击