There are various posts with mathematical ways to do this which don't always work, eg if optimal_io_size is zero.
With newer versions of parted, just use -a (alignment type)
parted -a optimal <device>
Then in parted use % to allocate eg
(parted) mkpart <name> 0% 50%
Bingo- it now does it for you. You can check what it's done by setting units to sectors eg
(parted)unit s
(parted)p
Model: ATA WDC WD4001FAEX-0 (scsi)
Disk /dev/sdb: 7814037168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 2048s 7814035455s 7814033408s P1
No comments:
Post a Comment