parted – optimal Partition Alignment

Wenn bei dem Erstellen einer GPT-Partition mit parted, wie z.B. hier beschrieben, folgender Hinweis auftaucht
Warning: The resulting partition is not properly aligned for best performance.
dann sollte die Partitionierung erneut erfolgen – diesmal mit Parametern, die “properly aligned” sind.

Die einfache Variante für eine Partition, die die größtmögliche Festplattenkapazität nutzen läßt, ist folgende:

(parted) mkpart primary xfs 1 -1

Beispiel:
knecht ~ # parted /dev/sdb
Warning: Could not determine physical sector size for /dev/sdb.
Using the logical sector size (512).
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) print
Error: /dev/sdb: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary xfs 1 -1
(parted) unit s
(parted) print
Model: AMCC 9690SA-4I DISK (scsi)
Disk /dev/sdb: 35155869696s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 2048s 35155867647s 35155865600s primary

Dies läßt sich auch manuell ausrechnen:

(parted) unit s
(parted) print free
Model: AMCC 9690SA-4I DISK (scsi)
Disk /dev/sdb: 35155869696s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
34s 35155869662s 35155869629s Free Space

Maximal verfügbare Sektoren, MaxSectors: 35155869629

Begin bei Sektor 2048 (1MiB).

Ende berechnen:
MaxSectors – 2048 = AvaibleSectors
35155869629-2048 = 35155867581

Ein vielfaches von 2048 ist optimal:
AvaibleSectors / 2048 = MaxCountCyl
35155867581 / 2048 = 17165950,967285156

MaxCountCyl * 2048 = SizeInSectors
17165950 * 2048 = 35155865600

35155865600 + 2048 = 35155867648

Davon einen abziehen, da der erste Sektor schon mitzählt: 35155867648 -1 —> 35155867647

(parted) mkpart primary
File system type? [ext2]? xfs
Start? 2048
End? 35155867647
(parted) print
Model: AMCC 9690SA-4I DISK (scsi)
Disk /dev/sdb: 35155869696s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 2048s 35155867647s 35155865600s primary
(parted)

Die Kommentarfunktion ist geschlossen.