cipher :=
autotrim := on
reservation := 1G
+compression := zstd
wipe-sd:
sudo sgdisk --zap-all $(disk_sd)
wipe-ssd:
sudo sgdisk --zap-all $(disk_ssd)
- sudo zpool labelclear -f /dev/disk/by-partlabel/$(hostName)_ssd_rpool || true
+ sudo zpool labelclear -f /dev/disk/by-partlabel/$(hostName)_ssd_root || true
-part: wipe-sd wipe-ssd
+part: part-sd part-ssd
part-sd: wipe-sd
sudo sgdisk -a1 -n0:34:2047 -t0:EF02 -c0:"$(hostName)_sd_bios" $(disk_sd)
sudo sgdisk -n0:1M:+100M -t0:EF00 -c0:"$(hostName)_sd_efi" $(disk_sd)
sudo sgdisk -n0:0:0 -t0:8300 -c0:"$(hostName)_sd_root" $(disk_sd)
sudo sgdisk --randomize-guids $(disk_sd)
sudo sgdisk --backup=$(hostName)_sd.sgdisk $(disk_sd)
-part-ssd:
+part-ssd: wipe-ssd
sudo sgdisk -a1 -n0:34:2047 -t0:EF02 -c0:"$(hostName)_ssd_bios" $(disk_ssd)
sudo sgdisk -n0:1M:+100M -t0:EF00 -c0:"$(hostName)_ssd_efi" $(disk_ssd)
sudo sgdisk -n0:0:+256M -t0:8300 -c0:"$(hostName)_ssd_boot" $(disk_ssd)
- sudo sgdisk -n0:0:+8G -t0:8200 -c0:"$(hostName)_ssd_swap" $(disk_ssd)
- sudo sgdisk -n0:0:0 -t0:BF01 -c0:"$(hostName)_ssd_rpool" $(disk_ssd)
+ sudo sgdisk -n0:0:+2G -t0:8200 -c0:"$(hostName)_ssd_swap" $(disk_ssd)
+ sudo sgdisk -n0:0:0 -t0:BF01 -c0:"$(hostName)_ssd_root" $(disk_ssd)
sudo sgdisk --randomize-guids $(disk_ssd)
sudo sgdisk --backup=$(hostName)_ssd.sgdisk $(disk_ssd)
format-ssd-root:
sudo zpool list $(rpool) 2>/dev/null || \
sudo zpool create -o ashift=12 \
- -O utf8only=yes \
- -R /mnt/$(hostName) $(rpool) /dev/disk/by-partlabel/$(hostName)_ssd_zpool
+ -O utf8only=on \
+ -R /mnt/install/$(hostName) $(rpool) /dev/disk/by-partlabel/$(hostName)_ssd_root
sudo zpool set \
autotrim=$(autotrim) \
$(rpool)
# /*
for p in \
nix \
+ home \
var \
; do \
sudo zfs list $(rpool)/"$$p" 2>/dev/null || \
$(rpool)/"$$p" ; \
done
for p in \
- home/julm \
; do \
sudo zfs list $(rpool)/"$$p" 2>/dev/null || \
sudo zfs create \
$(rpool)/"$$p" ; \
done
#sudo zfs set sync=disabled $(rpool)/var/tmp
- #sudo zfs set copies=2 $(rpool)/home/documents
+ #sudo zfs set copies=2 $(rpool)/home/files
mount-sd: mount-sd-root mount-sd-efi
mount-sd-root:
mount-ssd: mount-ssd-root mount-ssd-efi
mount-ssd-root:
sudo mkdir -p /mnt/install/$(hostName)
+ sudo zpool list $(hostName) || \
+ sudo zpool import -R /mnt/install/$(hostName) $(hostName)
sudo mountpoint /mnt/install/$(hostName) || \
- sudo mount -v /dev/disk/by-partlabel/$(hostName)_ssd_root /mnt/install/$(hostName)
+ sudo mount -v -t zfs $(hostName)/root /mnt/install/$(hostName)
+ for p in nix home var; do \
+ sudo mkdir -p /mnt/install/$(hostName)/$$p; \
+ sudo mountpoint /mnt/install/$(hostName)/$$p || \
+ sudo mount -v -t zfs $(hostName)/$$p /mnt/install/$(hostName)/$$p; \
+ done
mount-ssd-efi: | mount-ssd-root
+ sudo mkdir -p /mnt/install/$(hostName)/boot
+ sudo mountpoint /mnt/install/$(hostName)/boot || \
+ sudo mount -v /dev/disk/by-partlabel/$(hostName)_ssd_boot /mnt/install/$(hostName)/boot
sudo mkdir -p /mnt/install/$(hostName)/boot/efi
sudo mountpoint /mnt/install/$(hostName)/boot/efi || \
sudo mount -v /dev/disk/by-partlabel/$(hostName)_ssd_efi /mnt/install/$(hostName)/boot/efi