From b0c5f1e67e5c352d2dbe43eaf136d49a086cd33f Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sun, 17 Sep 2023 00:23:47 +0200 Subject: [PATCH] add vms backup --- mini/hardware-configuration.nix | 12 ++++++++++++ mini/install.txt | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/mini/hardware-configuration.nix b/mini/hardware-configuration.nix index ff2b0f9..2949b75 100644 --- a/mini/hardware-configuration.nix +++ b/mini/hardware-configuration.nix @@ -24,8 +24,12 @@ fsType = "vfat"; }; + # system boot.initrd.luks.devices."crypt-system".device = "/dev/disk/by-uuid/22c208e6-579b-4d34-8f83-83aa4a7ab1c3"; + # vms + boot.initrd.luks.devices."crypt-vms".device = "/dev/disk/by-id/ata-CT2000MX500SSD1_2138E5D5061F"; + fileSystems."/nix" = { device = "/dev/mapper/crypt-system"; fsType = "btrfs"; @@ -56,6 +60,14 @@ options = [ "bind" ]; }; + fileSystems."/home/cullmann/vms" = + { + depends = [ "/home" ]; + device = "/dev/mapper/crypt-vms"; + fsType = "btrfs"; + options = [ "noatime" "nodiratime" ]; + }; + swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/mini/install.txt b/mini/install.txt index b97ee60..adcac60 100644 --- a/mini/install.txt +++ b/mini/install.txt @@ -100,3 +100,33 @@ nixos-install --no-root-passwd --root /mnt umount -Rl /mnt cryptsetup luksClose crypt-system + +# +# after install tasks for extra file systems +# + +# create vms disk + +DD=/dev/disk/by-id/ata-CT2000MX500SSD1_2138E5D5061F +sgdisk --zap-all $DD +blkdiscard -v $DD +wipefs -a $DD + +sleep 5 + +# create the crypto containers +cryptsetup luksFormat --batch-mode --verify-passphrase $DD + +sleep 5 + +# open them, set right options persistently +cryptsetup luksOpen --allow-discards --perf-no_read_workqueue --perf-no_write_workqueue --persistent $DD crypt-vms + +sleep 5 +lsblk --fs + +# create btrfs with fast & strong checksumming and fast mounting +mkfs.btrfs -f --csum xxhash --features block-group-tree /dev/mapper/crypt-vms + +sleep 5 +btrfs filesystem show