Benutzer-Werkzeuge

Webseiten-Werkzeuge


windows:disk_aligment

Disk Aligment unter Windows prüfen

Der Partition Offset, die File Allocation Unit Size und die Stripe Unit Size müssen zusammen passen, damit bei einem Lese/Schreibzugriff auf die Platten möglichst wenig physikalische Zugriffe notwendig werden.

Beispiel:

  • Eine Lun ist mit 4K Blöcken physikalisch auf dem Storage angelegt worden (Stripe Unit Size)
  • Partition wird angelegt und beginnt an der Byte Position 32256 (Partition Offset)
  • Die Blöcke in der Partition sind mit einer Größe 4096 Byte definiert (File Allocation Unit Size)
  • Die Adresse eines Blocks ist damit: Partition Offset+(Blocknr. * File Allocation Unit Size)
  • Das Storage liest physikalisch immer x Byte Blöcke (Stripe Unit Size) von der Physik der Platten
  • Soll nun der Block 10 vom Filesystem des Betriebssystems gelesen werden:
    • Block 10 fängt im Filesystem an Byte Position 32256 + (10 * 4096) an = 73216 Byte von Beginn der Platte
    • Block 10 endet an der Position 77312 auf der Platte
    • Das Storage kann aber nicht frei lesen sondern wiederum nur mit der internen 4K Logik
    • Intern fängt das Filesystem in der Mitte des Storage Blocks 7 an (Partition Offset/Stripe Unit Size) = 32256/4096 = 7.875
    • Daher muss nun das Storage intern für den Filesystem Block 10 den internen Block 17 und 18 lesen, da durch den verschobenen Anfang die 4K Blöcke des Storage und die 4K Blöcken des Filesystem nicht übereinander liegen
    • =⇒ Es sind jedes Mal min. zwei Lese/Schreibzugriffe notwendig

Überblick:

Überblick Disk Aligment

Prüfen:

Stripe Unit Size
Vom Storage Administrator erfragen

Partition Offset
Offset der Partitionen bestimmen:

#powerschell!
Get-WmiObject Win32_DiskPartition | select Name,BlockSize,NumberOfBlocks,Size,StartingOffset | format-Table

File Allocation Unit Size

 fsutil fsinfo ntfsinfo d:

Bytes Per Cluster value ⇒ file allocation unit size

oder

#powerschell!
 Get-WmiObject Win32_Volume | select DriveLetter,Label,Blocksize

Ermittelte Werte prüfen:

  • Partition_Offset / Stripe_Unit_Size ⇒ muss ein Integer Wert ergeben
  • Stripe_Unit_Size / File_Allocation_Unit_Size ⇒ muss ein Integer Wert ergeben

Powershell Script um die Abfragen zu automatisieren

write-host ("-"*80)
write-host "Info -- Check Disk Aligment"
write-host ("-"*80)
# prompt for the Stripe Unit Size
 
$lun_alloc_size=Read-Host "Please enter the stripe unit size of the storage in byte [4096]:"
if ($lun_alloc_size -lt 1 ) {
	$lun_alloc_size=4096
}
 
write-host "Info -- Use the stripe unit size of $lun_alloc_size byte"
 
 
foreach ( $disk in (Get-WmiObject Win32_DiskPartition | Sort-Object $_.Name ) ) {
	write-host  -ForegroundColor "yellow" ("="*80)
	#"class            :: " +$disk.__CLASS
	"Disk Name         :: " +$disk.Name 
	"Description       :: " +$disk.Description
	"Blocksize         :: " +$disk.BlockSize 
	"Number of Blocks  :: " +$disk.NumberOfBlocks 
	"Size              :: " +$disk.Size
	"Partition_Offset  :: " +$disk.StartingOffset
	#"DeviceID         :: " +$vol.DeviceID
 
	# check the Starting offset to the Stripe Unit Size of the storage
	$aligment_test=($disk.StartingOffset / $lun_alloc_size)
	$fgcolor="green"
	if ( $aligment_test % 1 -gt 0) {
		$fgcolor="red"
	}
	write-host  -ForegroundColor $fgcolor  "Aligment Test Result Partition_Offset / Stripe_Unit_Size :: " + $aligment_test
 
	# get the Win32_LogicalDisk
	foreach ( $vol in ( Get-WmiObject -query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($disk.DeviceID)'} WHERE AssocClass = Win32_LogicalDiskToPartition" ) ){
		write-host ("-"*20)
		"--          Check the Aligment over the file system File Allocation Unit Size" 
		#"--      Class      :: "+$vol.__CLASS
		#"--      DeviceID   :: "+$vol.DeviceID
		#"--      Driveletter:: "+$vol.DriveLetter 
		#"--      Label      :: "+$vol.Label
		#"--      Blocksize  :: "+$vol.Blocksize
		foreach ( $vol2 in (Get-WmiObject Win32_Volume  | where-object {$_.DriveLetter -eq $vol.DeviceID } )) {
			#"--         Class		                :: "+$vol2.__CLASS
			"--          DeviceID                   :: "+$vol2.DeviceID
			"--          Driveletter                :: "+$vol2.DriveLetter 
			"--          Label                      :: "+$vol2.Label
			"--          File_Allocation_Unit_Size  :: "+$vol2.Blocksize
			$aligment_test=($disk.StartingOffset / $vol2.Blocksize)
			$fgcolor="green"
			if ( $aligment_test % 1 -gt 0) {
				$fgcolor="red"
			}
			write-host  -ForegroundColor $fgcolor  "--          Aligment Partition_Offset / File_Allocation_Unit_Size:: " + $aligment_test
			$aligment_test=($lun_alloc_size / $vol2.Blocksize)
			$fgcolor="green"
			if ( $aligment_test % 1 -gt 0) {
				$fgcolor="red"
			}
			write-host  -ForegroundColor $fgcolor  "--          Aligment Stripe_Unit_Size / File_Allocation_Unit_Size:: " + $aligment_test
		}
	}
}

Quellen:

Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
windows/disk_aligment.txt · Zuletzt geändert: 2013/01/22 10:41 von gpipperr