I want to setup disko with impermanence. I’ve instaled nixos fresh on a new machine and written a disko config file (below).
As far as I can tell, the disko setup is fine. If I run disko, it doesn’t complain about the syntax or setup (which it did initially, I think I’ve now ironed all of this out) and it runs sgdisk like it should. The first partition is setup fine and I get a message “The operation has completed successfuly” (actually I get two – one for the initial partition table and then another for the first file system, called “1:disk-main-ESP”. Then the next sgdisk invocation happens, to create the swap parition, and I get a serious of error messages and then a similar invocation which also fails:
+ sgdisk --align-end --new=2:1G:9G --change-name=2:disk-main-swap --typecode=2:8200 /dev/nvme0n1
Could not create parition 2 from 2097152 to 18874368
Unable to set partition 2's name to 'disk-main-swap'!
Could not change partition 2's type code to 8200!
Error encountered; not saving changes.
+ sgdisk --change-name=2:disk-main-swap --typecode=2:8200 /dev/nvme0n1
Unable to set partition 2's name to 'disk-main-swap'!
Could not change partition 2's type code to 8200!
Error encountered; not saving changes.
+rm -rf /tmp/tmp.3s8Gz0C4ry
Question: what’s causing these errors? What can I do about it?
Here’s my disko config file:
# This must reflect the setup necessary for impermanence (with BTRFS
# See
# https://github.com/nix-community/disko/blob/3979285062d6781525cded0f6c4ff92e71376b55/docs/quickstart.md
# for installation instructions
# Lots of this is cribbed from
# https://github.com/chewblacka/nixos/blob/488ffc8c42b8553067687a19e96aeab33528a7fb/disko-config.nix
# (and then slightly simplified!)
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
start = "1MiB";
end = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
swap = {
priority = 2;
start = "1G";
end = "9G";
content = {
type = "swap";
randomEncryption = true; # ???
};
};
# Most of the Real Stuff goes in here
root = {
priority = 3;
start = "9G";
# Doing this because the new partition program (sgdisk, which replaced parted) doesn't support
# percentages. Hmfsk.
end = "230G"; # "100%";
content = {
type = "btrfs";
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/persistent" = {
mountpoint = "/persistent";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
};
};
};
};
};
};
}