diff --git a/hosts/common/configs/persist/impermanence.sh b/hosts/common/configs/persist/impermanence.sh index abaf8da..5c0f8b0 100644 --- a/hosts/common/configs/persist/impermanence.sh +++ b/hosts/common/configs/persist/impermanence.sh @@ -9,17 +9,17 @@ delete_subvolume_recursively() { mkdir -p /mnt/btrfs mount /dev/mapper/luks /mnt/btrfs -if [[ -e /mnt/btrfs/root ]]; then - mkdir -p /mnt/btrfs/root.bak - timestamp=$(date --date="@$(stat -c %Y /mnt/btrfs/root)" "+%Y-%m-%-d_%H:%M:%S") - mv /mnt/btrfs/root "/mnt/btrfs/root.bak/$timestamp" +if [[ -e /mnt/btrfs/@ ]]; then + mkdir -p /mnt/btrfs/@.bak + timestamp=$(date --date="@$(stat -c %Y /mnt/btrfs/@)" "+%Y-%m-%-d_%H:%M:%S") + mv /mnt/btrfs/@ "/mnt/btrfs/@.bak/$timestamp" fi -find /mnt/btrfs/root.bak/ -maxdepth 1 -mtime +14 | while IFS= read -r i; do +find /mnt/btrfs/@.bak/ -maxdepth 1 -mtime +14 | while IFS= read -r i; do delete_subvolume_recursively "$i" done -btrfs subvolume create /mnt/btrfs/root +btrfs subvolume create /mnt/btrfs/@ umount /mnt/btrfs rmdir /mnt/btrfs diff --git a/hosts/common/scripts/cleanup/cleanup.sh b/hosts/common/scripts/cleanup/cleanup.sh index 8f76d83..0856f3b 100644 --- a/hosts/common/scripts/cleanup/cleanup.sh +++ b/hosts/common/scripts/cleanup/cleanup.sh @@ -19,13 +19,13 @@ fi mkdir -p /mnt/btrfs mount /dev/mapper/luks /mnt/btrfs -if [[ -e /mnt/btrfs/root.bak ]]; then - if [ "$(ls -A /mnt/btrfs/root.bak)" ]; then - for i in /mnt/btrfs/root.bak/*; do +if [[ -e /mnt/btrfs/@.bak ]]; then + if [ "$(ls -A /mnt/btrfs/@.bak)" ]; then + for i in /mnt/btrfs/@.bak/*; do delete_subvolume_recursively "$i" done else - echo "/mnt/btrfs/root.bak is empty. Nothing to delete." + echo "/mnt/btrfs/@.bak is empty. Nothing to delete." fi fi diff --git a/hosts/eirene/format.nix b/hosts/eirene/format.nix index 78bdc81..97f7c8f 100644 --- a/hosts/eirene/format.nix +++ b/hosts/eirene/format.nix @@ -44,20 +44,20 @@ type = "btrfs"; extraArgs = [ "-f" ]; subvolumes = { - "/root" = { + "@" = { mountpoint = "/"; }; - "/persist" = { + "@persist" = { mountpoint = "/persist"; - mountOptions = [ "subvol=persist" "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" ]; }; - "/nix" = { + "@nix" = { mountpoint = "/nix"; - mountOptions = [ "subvol=nix" "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" ]; }; - "/cache" = { + "@cache" = { mountpoint = "/cache"; - mountOptions = [ "subvol=cache" "compress=zstd" "noatime" ]; + mountOptions = [ "compress=zstd" "noatime" ]; }; }; };