Condividi tramite


Disk Alignment on Windows 7 for normal disks and SSDs

 

For RAID Systems:

The alignment topic is only relevant when using stripe-sets of disk for example within a software or hardware raid. What needs to be aligned is the starting location of the partition and the stripe unit boundary in the disk partition that is created on the RAID. If these are not aligned, a volume cluster may be created over a stripe unit boundary instead of next to the stripe unit boundary. This is because Windows uses a factor of 512 bytes to create volume clusters. This behavior causes a misaligned partition. When accessing the volume cluster which is spanning two different stripe units, the IO controller needs to use two I/O – requests instead of one which could lead to a performance impact of 20-40 % on large disk arrays with heavy load (SQL Cluster…)

Not all hardware or software array controllers allow the administrator to choose a stripe unit size; some might provide only a limited set of options. For example, the Windows built-in volume manager for dynamic disks (Dmio.sys) has a fixed stripe unit size of 64 KB. Thus as Windows reserves only the first 63 sectors for the MBR and not the first 64, every 8th cluster is going the span two stripes: (alignment.jpg)

clip_image001

To work around this issue specify a starting offset of 2,048 sectors (1 megabyte). A starting offset of 2,048 sectors covers most stripe unit size scenarios. This is the default for windows Vista and windows 7 and also adds support for GPT (guid partition tables)

Sources:

You cannot install Windows XP successfully after you use Windows Vista or Windows PE 2.0 to create partitions on a hard disk: https://support.microsoft.com/kb/931760

Disk Subsystem Performance Analysis for Windows: https://www.microsoft.com/whdc/archive/subsys_perf.mspx

 

Talking of SSDs:

Generally speaking SSDs do have a limited number of possible write cycles. Thus, any application on any operating system may cause issues, if it causes intense write load. Most of the current crop of SSD’s have decent wear leveling algorithms. As long as you disable the auto (partial) defrag and memory prefetch, then you should be fine for the OS use. 

Windows 7 will add additional benefit to the use of SSDs, as it configures the partition with an disk alignment, that is optimized for best performance. An additionally supports the new “trim” command:

The purpose of Trim Attribute:
File deleting happens in a file system all time, but the information related to the deleted file only kept in OS, not to device. As a result, a device treats both valid data and invalid data(deleted file) in its storage media the same way, all necessary operations keeping data alive are applied. For example, background defect management and error recovery process are used for HDD. Merge, wear leveling and erase are applied to SSD. OS’s process, such as format, Defragger, Recycle bin, temp file deleting and Paging can produce a considerable amount of deleted file. By telling device the deleted file information as invalid data, the device can reduce its internal operation on all invalid data as self-optimization.

Source: https://t13.org/Documents/UploadedDocuments/docs2008/e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc

That means in Windows XP you should

 

- Disable the defrag

- Disable prefetch https://msdn.microsoft.com/en-us/library/ms940847(WinEmbedded.5).aspx

- Set partition alignment:
NAND flash storage devices are functionally different from traditional hard disk drives in three ways: physical structure, logical structure, and bit erase operation. The logical structure of SSDs differs from tradition hard disk drives because they are built upon pages, which are a given number of bytes (typically 2 KB or 4 KB), and blocks, which are a given number of pages. When the user wants to erase (re-program or write-erase) a given set of bits in any block, the entire block must be erased. This particular anomaly is directly associated with the physics of how NAND works at the die level. If an operating system or data partition is not properly page aligned, there are undesirable consequences. Specifically, if the offset value where the partition begins does not line up with a given page boundary, the SSD flash management system is burdened with extra overhead each time there is a request to perform an erase data operation.

If you wish to use the align parameter in the DiskPart tool, the correct value should be 1 MB for SSDs with page sizes up to 4 KB, and 2 MB for SSDs with a page sizes from 4 KB to 16 KB.

Guidelines for Designing Small Notebook PCs for Windows XP—Version 2.0 - 18

The following is an example of the use of the DiskPart (6.0.6002) tool on a 16-GB SSD with a 4-KB page size, where the align parameter is specified: X:\windows\system32\DiskPart.exe DISKPART> Select Disk 0 DISKPART> Create Partition Primary Align=1024 DISKPART> Exit

Comments

  • Anonymous
    January 27, 2011
    The comment has been removed

  • Anonymous
    March 02, 2011
    To be honest, I don't know. 2K8 R2 might use a default offset of 1024 which should work with the most configuration. Additionally, 2K8 R2 will automatically detect SSDs and set the alignment appropriate. If Dell installs a RAID, you would need to ask Dell on what cluster and stripe sizes they are using.

  • Anonymous
    June 19, 2014
    What a great graphic and explanation! Kudos on a great blog post!