changes to io
This commit is contained in:
parent
f2646e891d
commit
7e466f8eaa
5 changed files with 34 additions and 33 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
|
||||
{
|
||||
boot.initrd.systemd.services.recreate-root = {
|
||||
description = "Rolling over and creating new filesystem root";
|
||||
|
|
@ -17,14 +17,14 @@
|
|||
};
|
||||
script = ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-uuid/ef1916a9-e15c-450e-8100-4b2af9f6e1a5 /btrfs_tmp
|
||||
|
||||
mount /dev/disk/by-uuid/1ce9c049-0736-4305b21e-34244004acf50 /btrfs_tmp
|
||||
|
||||
if [[ -e /btrfs_tmp/@root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/@root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
|
|
@ -32,13 +32,13 @@
|
|||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/@root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue