How do I check whether partitions on my SSD are properly aligned?
Solution 1:
Parted has an align-check build in.
parted /dev/sda
align-check opt n
n
is the partition you want to check.
Solution 2:
Ensuring SSD alignment with parted tool looks like a pretty good guide for aligning your filesystem on the SSD:
- Get the block size of your SSD in bytes (there are heaps of tips, and I don't know which ones will work for which hardware).
-
Start the partition editor:
sudo parted
-
Show the partition table:
p
- Verify that the numbers in the
Start
andSize
columns are divisible by the block size.
Solution 3:
To be sure you have to use both built-in parted
align-check option:
HDD:
DEVICE=/dev/sda && for i in `sudo parted $DEVICE print | grep -oE "^[[:blank:]]*[0-9]+"`; do sudo parted $DEVICE align-check opt "$i"; done
SSD:
DEVICE=/dev/nvme0n1 && for i in `sudo parted $DEVICE print | grep -oE "^[[:blank:]]*[0-9]+"`; do sudo parted $DEVICE align-check opt "$i"; done
and manual check (calculate divisibility by 4096B)
I've written a bash script to perform both checks:
https://github.com/crysman/check-partitions-alignment
(works on any GNU/Linux OS)
Or you can check manually using this table:
https://docs.google.com/spreadsheets/d/1dnDlhglxxgApvtUv0-nxn1iFYTqkjRELqCOWJtp3hbs/edit#gid=0
And yes, SSD HDD's partitions need to be aligned properly for maximum performance.