aboutsummaryrefslogblamecommitdiffstats
path: root/fs-diff.sh
blob: 3c10becf2bc0e751f9d324cce1896c0681e4795a (plain) (tree)



























                                                                            
#!/usr/bin/env bash
sudo mkdir /mnt
sudo mount -o subvol=/ /dev/mapper/enc /mnt
#sudo mount -o subvol=/ /dev/sdb3 /mnt

set -euo pipefail

OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999)
OLD_TRANSID=${OLD_TRANSID#transid marker was }

sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" |
sed '$d' |
cut -f17- -d' ' |
sort |
uniq |
while read path; do
  path="/$path"
  if [ -L "$path" ]; then
    : # The path is a symbolic link, so is probably handled by NixOS already
  elif [ -d "$path" ]; then
    : # The path is a directory, ignore
  else
    echo "$path"
  fi
done

sudo umount /mnt
sudo rmdir /mnt