mirror of
https://github.com/ItsDrike/nixdots
synced 2024-11-10 02:19:41 +00:00
Explain why we use recursive deletion
This commit is contained in:
parent
3b75c09b95
commit
294789d9bb
|
@ -34,6 +34,18 @@ in
|
||||||
umount /mnt
|
umount /mnt
|
||||||
'';
|
'';
|
||||||
in ''
|
in ''
|
||||||
|
# Simply deleting a subvolume with btrfs subvolume delete will not work,
|
||||||
|
# if that subvolume contains other btrfs subvolumes. Because of that, we
|
||||||
|
# instead use this function to delete subvolumes, whihc will first perform
|
||||||
|
# a recursive deletion of any nested subvolumes.
|
||||||
|
#
|
||||||
|
# This is necessary, because the root subvolume will actually usually contain
|
||||||
|
# other subvolumes, even if the user haven't created those explicitly. It seems
|
||||||
|
# that NixOS creates these automatically. Namely, I observed these in root subvol:
|
||||||
|
# - root/srv
|
||||||
|
# - root/var/lib/portables
|
||||||
|
# - root/var/lib/machines
|
||||||
|
# - root/var/tmp
|
||||||
delete_subvolume_recursively() {
|
delete_subvolume_recursively() {
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||||
|
|
Loading…
Reference in a new issue