Advanced Format

最後更新: 2016-05-25

 


WD HDD Q&A

 

Q. Does the WD Align utility have to be run again if a drive is reformatted?

No, users will only need to run WD Align one time after initially installing Windows XP.

Once Windows XP has been aligned, it will stay aligned even if the drive is reformatted or many files are added or removed.

Q. Do I need a special driver to install a WD Advanced Format Drive on an Intel chipset?

For AMD chipset, no driver update is required.

For Intel chipset, use the latest Intel driver version 9.6 or later.

 


Align partitions

 

Align partitions to the internal 4KB sector boundaries of the drive.

Make sure that data writes are aligned to 4KB sector boundaries.

parted optios:

-a alignment-type

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

 


Window

 

wmic DISKDRIVE get bytespersector, caption 

BytesPerSector  Caption
512             ST31000528AS ATA Device
512             WDC WD10EZEX-00BN5A0 ATA Device

wmic partition get name,size,type

Name                   Size           Type
Disk #1, Partition #0  1016320        Logical Disk Manager
Disk #1, Partition #1  528343891968   Logical Disk Manager
Disk #1, Partition #2  471858896896   Logical Disk Manager
Disk #0, Partition #0  1000203805184  Logical Disk Manager

fsutil fsinfo ntfsinfo drive_letter

Advanced Format Support

  • Windows 7 Service Pack 1 (SP1)
  • Windows Server R2 Service Pack 1 (SP1)

 


Software RAID

 

Error: All disks holding extents for a given volume must have the same sector size, and the sector size must be valid.

原因: The hard disks in the RAID volume are formatted with different sector sizes.

         For example, one hard disk is formatted by using Advanced Format, and another disk is formatted by using a legacy format.

 


BLOCK SIZE

 

I/O that is not properly aligned relative to the device's "I/O Limits" will result in reduced performance

Not all storage devices export this "I/O Limits" information

Certain 4K sector devices may use a 4K 'physical_block_size' internally but

expose a finer-grained 512 byte 'logical_block_size' to Linux. 

This discrepancy introduces potential for misaligned I/O.

Storage vendors can also supply "I/O hints"('optimal_io_size') about a device's preferred

minimum unit for random I/O ('minimum_io_size') and streaming I/O

* BLOCKS *

# LOGICAL BLOCK LENGTH IN BYTES:

cat /sys/block/sdc/queue/logical_block_size

512

# LOGICAL BLOCKS PER PHYSICAL BLOCK EXPONENT:

cat /sys/block/sdc/queue/physical_block_size

4096

"I/O hints" ( TRANSFER LENGTH )

# OPTIMAL TRANSFER LENGTH
# device’s preferred unit for streaming I/O

cat /sys/block/sdc/queue/optimal_io_size

0

# OPTIMAL TRANSFER LENGTH GRANULARITY
# device’s preferred minimum unit for random I/O

cat /sys/block/sdc/queue/minimum_io_size

4096

Generally

logical_block_size =< physical_block_size =< minimum_io_size.

lvm

LVM will shift the start of the data area, that a given DM
device will use, to account for a non-zero 'alignment_offset' associated

LVM will adjust for any 'alignment_offset' by default
(may be disabled through lvm.conf's 'data_alignment_offset_detection'.)

parted

The heuristic parted uses is:

1)  Always use the reported 'alignment_offset' as the offset for the
    start of the first primary partition.

2a) If 'optimal_io_size' is defined (not 0) align all partitions on an
    'optimal_io_size' boundary.

mkfs

mkfs.ext[234] and mkfs.xfs also use the "I/O hints" to layout ondisk data structure and
data areas relative to the underlying storage's 'minimum_io_size' and 'optimal_io_size'

 


512n(native) vs 512e(emulation)

 

http://www.wdc.com/en/products/internal/enterprise/

512n is the legacy version for obsolete OSes that can't handle 512e properly

*  read-modify-write (RMW)

hdparm -V

hdparm v9.39

hdparm -I /dev/sda | grep Sector

512n:

Logical/Physical Sector size:           512 bytes

512e:

Logical  Sector size:                   512 bytes
Physical Sector size:                  4096 bytes
  • /sys/block/sdc/queue/logical_block_size
  • /sys/block/sdc/queue/minimum_io_size
  • /sys/block/sdc/queue/optimal_io_size

parted /dev/sdc

print

Model: ATA WDC WD10EZEX-08R (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  99.6MB  98.6MB  primary   ext4            boot
 2      99.6MB  12.1GB  12.0GB  primary   ext4

# align-check align-type n
# Determine whether the starting sector of partition n
# meets the disk’s selected alignment criteria.

align-check minimal 1

1 aligned

align-check optimal 1

1 aligned

/dev/sdc8

4K native

no emulation layer in place, and the disk media directly exposes its 4 KB physical sector size to the system firmware and operating system.

On the default block size

btrfs: 4 Kbyte
ext4: 1Kbyte (/etc/mke2fs.conf)

/etc/mke2fs.conf

[defaults]
blocksize = 4096

tune2fs -l /dev/sdc1 | grep Block

OR

cd /boot;

stat -f .

 


在舊 OS 上用 Advanced Format

 

# 查看係咩 HDD

smartctl -i /dev/sda

Sector Sizes:     512 bytes logical, 4096 bytes physical

# 野 partition

fdisk -lu /dev/sda

-u     When listing partition tables, give sizes in sectors instead of cylinders.

Disk /dev/uba: 1000.2 GB, 1000204885504 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525167 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/uba1            2048  1953525160   976761556+  83  Linux

建立 partition 的 "Start" value divisible by 8 is good as well.

# Format

-b block-size

mkfs.ext3 -b 4096 /dev/uba1

 

 

 

 

Creative Commons license icon Creative Commons license icon