Following install gave Warning: The resulting partition is not properly aligned for best performance

Hello! I’m new to NixOS, installing it right now for the first time.

I’m following the manual, in section 2.2.1 UEFI, and when running step 3 to make the linux-swap partition, the parted command says

> sudo parted /dev/sdb -- mkpart primary linux-swap -8GiB 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel

Any recommendations on what to do, or how to modify the commands to avoid the performance problems that it is mentioning?

1 Like

From reading around, it looks like the issue is that parted generally wants you to use percentage values, instead of -8GiB. I don’t use a swap partition myself, so I just put 0% 100% in and it’s fine, but it looks like the Arch wiki has some suggestions for handling this warning:

https://wiki.archlinux.org/index.php/Parted#Warnings

Once you or someone else figures it out, we should update the manual so it’s not giving bad advice!

seems to be a good resource, it would be nice if parted just told you the closest ceiling and floor sector value. Or an --auto-align would be even more useful.

2 Likes

@jonringer @bhipple Thanks guys, the solution to avoid that problem was easy: I calculated what percentage of my 256GB disk corresponded to 8GB, which was 3.125%, then I replaced any occurrence of -8GiB with -3.125%, and that worked, the warning did not appear.

For example:

parted /dev/sda -- mklabel gpt
parted /dev/sda -- mkpart primary 512MiB -3.125%
parted /dev/sda -- mkpart primary linux-swap -3.125% 100%
# ...

I know 8GiB isn’t 8GB, but that’s close enough. For this particular case, the above was a lot easier than the suggestion in the ArchLinux Wiki,

Enter “Ignore” to go ahead anyway, print the partition table in sectors to see where it starts, and remove/recreate the partition with the start sector rounded up to increasing powers of 2 until the warning stops.

1 Like

Issue opened at Docs needs an update regarding partition creation, so as not to give bad advice. · Issue #3311 · NixOS/nix · GitHub.