My internal boot ssd has been misaligned during system installation.
KDE Partition Manager says in the log:
2023-10-26 11:39:46: Using backend plugin: pmsfdiskbackendplugin (1)
2023-10-26 11:39:46: Scanning devices...
2023-10-26 11:39:46: Device found: WDS100T1X0E-00AFY0
2023-10-26 11:44:16: Partition ‘/dev/nvme0n1p2’ is not properly aligned (last sector: 1.881.685.611, modulo: 1.644).
2023-10-26 11:44:16: Partition ‘/dev/nvme0n1p3’ is not properly aligned (first sector: 1.881.685.612, modulo: 1.644).
2023-10-26 11:44:16: Partition ‘/dev/nvme0n1p3’ is not properly aligned (last sector: 1.953.520.064, modulo: 449)
and the device scan takes very long to complete.
This happens with
KDE Partition Manager Version 23.08.1
Operating System: Manjaro Linux KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11
Kernel Version: 6.1.55-1-MANJARO (64-bit)
The installation used the default disk structure of the installer of the manjaro-kde-23.0.1-230911-linux65 ISO.
Apart from the long device scans, I have not noticed a performance hit. Still I wonder whether it is possible to realign without setting up the system anew, and how to prevent misalignment with a default installation in the future.
In order to align partition with parted you can use --align option. Valid alignment types are:
none - Use the minimum alignment allowed by the disk type.
cylinder - Align partitions to cylinders.
minimal - Use minimum alignment as given by the disk topology information. This and the opt value will use layout information provided by the disk to align the logical partition table addresses to actual physical blocks on the disks. The min value is the minimum alignment needed to align the partition properly to physical blocks, which avoids performance degradation.
optimal Use optimum alignment as given by the disk topology information. This aligns to a multiple of the physical block size in a way that guarantees optimal performance.
Based on that, I’d suggest:
sudo parted --align optimal /dev/nvme0n1
But note: this isn’t something I’ve ever done, so it’s all theoretical knowledge.
NAND flash storage — which is used in all modern SSDs — is divided in pages, each page comprising a number of cells.
Writing to (NAND) flash means writing to a page, but given that individual cells cannot be rewritten without erasing the entire page and writing the changes to another page, the alignment of the partition tables is important.
If you have a backup disk, then I would backup the partitions and repartition the disk, properly. Then you can copy back the content of the backuped partitions. Unalignment will lead to performance loss and unnessecary wear.
The most important thing is the first sector being aligned, the last sector not being exactly 4096 bytes isn’t a big deal. I’m guessing that that /dev/nvme0n1p3 is swap? If so then just nuke it and create a new aligned swap partition.
You might be able to use gparted to resize the partitions; only by a few MB (or whatever you wish). This process should extend those partitions to better boundary positions, and thus correct any mis-alignment.
This has the added bonus of not destroying your data – that said, I’d still recommend saving any important files to a USB, or similar.
Note, this would best be performed from bootable media, such as a live cd/usb installer.
Any comments (for or against this suggestion) are welcome.
I remember that gparted can move, even copy-paste partitions (at least on the 'buntu or Mint version I once ran). The KDE Partition Manager has “resize/move” in the toolbar, but I never tried it.
So the plan is:
Clone the disk tonight with Clonezilla as additional backup and full restore option, then boot external and make my move with gparted or KDE PM (have to see what bootable I have lying around).
It is. Your suggestion is a good interim solution.
Btw, I don’t have a swap partition but the last sector of my /dev/nvme0n1p2 reports similar. As I said, not a big deal by itself, but that’s probably what is causing misalignment of any following swap partition. Maybe a Calamares issue?
"Partition ‘/dev/nvme0n1p2’ is not properly aligned (last sector: 1,953,520,064, modulo: 449)."