I got excited with what I heard about NixOS, so I want to try it. However, I have run into an issue with partitioning. When I am following the manual, for UEFI partitioning, using
parted, I end up with the following warning:
Warning: You requested a partition from 1000kB to 512MB (…)
The closest location we can manage is 1000kB to 412MB (…)
Is this still acceptable to you?
If I enter “Yes” here I am warned with:
Warning: The resulting partition is not properly aligned for best performance: 1953s % 2048s != 0s.
Any suggestion on what I should do in this situation?
it would probably work fine, honestly, but the “correct” fix is to align the partition start the way it says
kB in parted is decimal kilobytes, so you asked it to start at 1,000,000 bytes. sectors are 512 bytes, so doing the arithmetic I verify that you asked it to start at 1953 sectors and a little bit, which is what it’s telling you.
2048 sectors is 1024 kibibytes (binary “kilobytes”). the way I normally specify quantities like that is by writing 1024KiB (instead of 1000kB as you wrote), which is notation that parted understands, so in your place I’d do that.
it does waste a bit of space. it’s not significant by today’s standards, but still… anyway, while I haven’t run benchmarks or anything and it would depend on your hardware, I would guess that you’re more likely to notice the time cost of not aligning it properly than the space cost of aligning it. so I’d align it.
it might be helpful also to know what size your disk is and what other partitions you’re putting on it, if you feel like sharing. it’s a bit weird that it’s a hundred megs smaller than you seem to expect.
Thank you for getting back to me, @Irene.
I tried partitioning using the commands I found in the manual.
# parted /dev/nvme0n1 -- mklabel gpt
# parted /dev/nvme0n1 -- mkpart root ext4 512MB -8GB
# parted /dev/nvme0n1 -- mkpart swap linux-swap -8GB 100%
# parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
And, it was the last command that threw this warning:
Warning: You requested a partition from 1000kB to 512MB (sectors 1953..1000000).
The closest location we can manage is from 1000kB to 412MB (sectors 1953..804863).
Is this still acceptable to you?
My SSD is 512 GB, and has 476.9 GB available:
# lsblk /dev/nvme0n1
nvme0n1 ... 476.9G ...
# cat /sys/block/sdb/queue/optimal_io_size
# cat /sys/block/sdb/queue/minimum_io_size
# cat /sys/block/sdb/alignment_offset
# cat /sys/block/sdb/queue/physical_block_size
When I opened my drive in
cfdisk I could easily see start and end block for the remaining boot partition. So, I used those values for the final partition command. Then it ran without any warnings.
parted /dev/nvme0n1 -- mkpart ESP fat32 2048s 804863s
cfdisk this has left me with the following partitions:
p1: 469.1G Linux filesystem
p2: 7.5G Linux Swap
p3: 392M Microsoft basic data
After I had installed the OS, and rebooted, no boot partition was found. So, I had to start from scratch again. This time the numbers of the boot partition made a lot more sense. I do not know what I did wrong the first time.
Below is how I ended up partitioning my drive. I used
cfdisk to find start and end sector for the boot partition. Maybe, this time, it would have worked using the command
parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB. I forgot testing that.
parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart root ext4 512MB -8GB
parted /dev/nvme0n1 -- mkpart swap linux-swap -8GB 100%
parted /dev/nvme0n1 -- mkpart ESP fat32 2048s 999423s
parted /dev/nvme0n1 -- set 3 esp on
So, all is good, and I have managed to install NixOS. Next up is to figure out how to get a graphical user interface going…
parted just had a
--auto-align like toggle… I’m not really concerned about losing a sector worth of information. However, having a command fail on me because of slight alignment issues is infuriating.
Am I the only one who prefers fdisk/sfdisk?
This is from my install script:
sfdisk --wipe always --wipe-partitions always "$blkdev" <<EOF
type="EFI System", size=1G
I never had issues with alignment with fdisk.
A little more involved, but disko is a really neat way to go about partitioning.
there’s definitely lots of valid ways to partition things. I like parted because I talked with the maintainer a long time ago and I appreciated the things he said about reliability in low-level tools like this (since anything operating at this level has potential to corrupt things). the other tools are all also fine though, it’s very rare to hear of a problem with any of them in practice. it’s just slightly different styles, an entirely personal decision at the end of the day.