-
Notifications
You must be signed in to change notification settings - Fork 63
Description
In some cases, formatting a drive with mintstick will create an unaligned partition.
When this occurs the partition will start on sector 1953 (999,936 bytes) rather than sector 2048 (1,048,576 bytes).
I assume this is because 1953 sectors is the closest possible sector to one megabyte (1,000,000 bytes).
I can consistently reproduce this issue using a Micron 2200 256GB SSD connected via an external M.2 enclosure.
I believe the issue is in line 37 in lib/raw_format.py
execute(["parted", device_path, "mkpart", "primary", partition_type, "1", "100%"])
The number "1" is interpreted by GNU parted as one megabyte.
This is conformable by running the below command on any drive.
parted -a none <device_path> mkpart primary <partion_type> 1 100%
Since the -a none option prevents GNU parted from automatically correcting alignment the resulting partition will always start on sector 1953, regardless of the drive model.
I am not sure why GNU parted fails to automatically correct the alignment on certain drives. But this can be fixed by replacing "1" with "1MiB" in the python script. That way mintstick will try to align partitions on a mebibyte and GNU parted won't need to correct anything.
I will try to open a pull request if necessary.