Hardware Reference
In-Depth Information
must read a full 4K sector into controller RAM, update 1/8 of the RAM-based data (512
bytes worth), and then write the full 4K sector back to the disk. This results in a read-
modify-writeoperationthattakesmuchlongerthanjustwritingthedatatoa512-bytesec-
tor drive.
Fortunately,singlesectorwritesrarelyhappenintherealworld,becausemostfilesystems
(including Windows NT File System, or NTFS) write to disks in 4K clusters, or multiples
of4K.Butevenifthefilesystemclustersizematchesthedrivesectorsize(orisamultiple
thereof), there can still be problems with the file system or partition alignment (as dis-
cussed in the next section).
Partition Alignment
In 1993, sector addressing was done by cylinder head sector (CHS), and drive manufac-
turers standardized on an emulated track size of 63 sectors per track. Internally, drives ac-
tually usedazonedrecording, wherethenumberofsectors pertrack varied byzone.DOS
and Windows disk partitioning software placed the master boot record (MBR) in the first
sectorofthefirsttrack,whichwasatCylinder0,Head0,sector1.Thevolumebootsector
(VBR) for the first partition was then placed in the first sector of the second track, which
was Cylinder 0 Head 1, sector 1. With the sectors per track standardized at 63, this meant
that the first partition started in the 64 th sector on the disk, which in logical block address
(LBA) terminology would be LBA 63. Note that LBA sector numbering starts with 0.
Because of this, Windows XP and earlier versions will start the first partition on a disk in
sector LBA 63. This means that the first sector of the partition (LBA 63) will also be the
first sector in NTFS cluster 0, and because cluster 0 is 4K (eight 512-byte sectors) long,
it will occupy sectors LBA 63 through 70. The problem with this is that on a 4K-sector
drive, this means that NTFS cluster 0 will be part of physical sectors 6 and 7. Likewise,
NTFS cluster 1 straddles physical sectors 7 and 8. This means that every time Windows
writes to one cluster, the hard drive has to perform two read-modify-write operations,
which significantly reduces performance. Figure 9.5 shows how the 4K NTFS clusters,
512-byte logical (emulated) sectors, and 4K physical sectors line up if the drive is parti-
tioned under Windows XP and earlier.
Figure 9.5 Default 4K sector drive partition alignment on Windows XP and earlier versions.
Windows 7/Vista were created with an awareness of 4K sector drives, solid-state drives
(SSDs), and RAID arrays, all of which deal with data in blocks of 4K or larger. To ac-
 
Search WWH ::




Custom Search