this formats disk
-# shellcheck disable=SC2043
-for dev in /dev/vda; do
- /nix/store/nxykihliwdnlmp6apf2ivi0vnfv9ddak-disk-deactivate/disk-deactivate "$dev"
-done
this check for some reason failed and totally skipped execution of creation of partitions (does it check whether there are any partitions on a disk?)
if ! blkid "/dev/vda" >/dev/null; then
I modified my disko.nix to include 2 (this equals to amount of already claimed partitions in lsblk
) additional empty paritions (fedora_boot
and fedora_root
), so disko would use proper indexes for partitions
diff --git a/modules/nixos/disko.nix b/modules/nixos/disko.nix
index 04d7ded..e9d4342 100644
--- a/modules/nixos/disko.nix
+++ b/modules/nixos/disko.nix
@@ -6,6 +6,8 @@
content = {
type = "gpt";
partitions = {
+ fedora_boot = {};
+ fedora_root = {};
boot = {
name = "boot";
size = "1M";
And because disko placed ESP
and nixos' boot
partitions before my fedora, I manualy deleted fedora partitions from the script and changed indexes of ESP
and boot
partitions.
(hand made diff)
if sgdisk \
- --info=1 \
+ --info=3 \
/dev/vda > /dev/null 2>&1
then
sgdisk \
--align-end \
- --new=1:0:+1M \
- --change-name=1:disk-main-boot \
- --typecode=1:EF02 \
+ --new=3:0:+1M \
+ --change-name=3:disk-main-boot \
+ --typecode=3:EF02 \
/dev/vda
# ensure /dev/disk/by-path/..-partN exists before continuing
partprobe /dev/vda
udevadm trigger --subsystem-match=block
udevadm settle
fi
if sgdisk \
- --info=2 \
+ --info=4 \
/dev/vda > /dev/null 2>&1
then
sgdisk \
--align-end \
- --new=2:0:+500M \
- --change-name=2:disk-main-ESP \
- --typecode=2:EF00 \
+ --new=4:0:+500M \
+ --change-name=4:disk-main-ESP \
+ --typecode=4:EF00 \
/dev/vda
# ensure /dev/disk/by-path/..-partN exists before continuing
partprobe /dev/vda
udevadm trigger --subsystem-match=block
udevadm settle
fi
- if sgdisk \
- --info=3 \
- /dev/vda > /dev/null 2>&1
- then
- sgdisk \
- --align-end \
- --new=3:0:+0 \
- --change-name=3:disk-main-fedora_boot \
- --typecode=3:8300 \
- /dev/vda
- # ensure /dev/disk/by-path/..-partN exists before continuing
- partprobe /dev/vda
- udevadm trigger --subsystem-match=block
- udevadm settle
- fi
- if sgdisk \
- --info=4 \
- /dev/vda > /dev/null 2>&1
- then
- sgdisk \
- --align-end \
- --new=4:0:+0 \
- --change-name=4:disk-main-fedora_root \
- --typecode=4:8300 \
- /dev/vda
- # ensure /dev/disk/by-path/..-partN exists before continuing
- partprobe /dev/vda
- udevadm trigger --subsystem-match=block
- udevadm settle
- fi
if you (for whatever reason) want to reproduce disko file, I used:
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./modules/nixos/disko.nix --arg device '"/dev/vda"' --dry-run
- https://github.com/PerchunPak/nixos-dotfiles/commit/df2c4cd8f1ccd3ce108266b0048170be45688f7e
- https://github.com/nix-community/disko/commit/611c9ea53250f7bb22286b3d26872280a0e608f9
nixos-minimal-23.11.4248.01885a071465-x86_64-linux.iso
in VM