On Mon 2019-07-15 (19:58), Nicholas D Steeves wrote: > > I need a list of all subvolumes DIRECTORIES, to be accessible with > > standard UNIX commands like cd and ls or btrfs subvolume show > > > > "a list of all subvolumes DIRECTORIES" doesn't make sense... It > sounds like you want to list all available subvolumes (presumably > snapshots, given that the path has BUP in it), to find a specific one > you want
Yes, but not limited to snapshots. I want a list of ALL subvolumes directories. > and then access an older copy of one of your files. Sometimes yes, sometimes not. Sometimes I want make a new snapshot. But then I have to know what directories are "snapshootable", aka btrfs subvolumes. "btrfs subvolume snapshot" needs as first parameter the directory name of the subvolume, so I have to know it! > Something like the following method might do the trick: > > First, mount /dev/sdX to /btrfs-admin without using a subvol option. > This will wonly work if you haven't changed the default subvol. Only root can do mounting. I need a solution for every user! > sudo btrfs sub list -at /btrfs-admin/ | sed 's:<FS_TREE>:btrfs-admin: Then I still do not know where it is in my standard UNIX filesystems. I am looking for a faster (native btrfs command) version of: root@trulla:~# find / -type d -inum 256 / /home /home/tux/blubb /opt /opt/.snapshot/2019-07-11_0000.daily /opt/.snapshot/2019-07-12_0000.daily /opt/.snapshot/2019-07-13_0000.daily /opt/.snapshot/2019-07-15_0000.daily /opt/.snapshot/2019-07-16_0000.daily /opt/.snapshot/2019-07-16_0100.hourly /opt/.snapshot/2019-07-16_0200.hourly /srv /tmp /tmp/test /usr/local /var/crash /var/log /var/opt /var/spool /var/tmp /var/lib/machines /sys/fs/cgroup/systemd/system.slice/wickedd-auto4.service /mnt/tmp /mnt/tmp/ss /.snapshots find: File system loop detected; '/.snapshots/128/snapshot' is part of the same file system loop as '/'. /.snapshots/1065/snapshot /.snapshots/1066/snapshot /.snapshots/1089/snapshot /.snapshots/1090/snapshot /.snapshots/1103/snapshot /.snapshots/1104/snapshot (...) This is VERY slow, because it scans through all of my files, even on nfs! My next idea was: root@fex:~# df --output=fstype,target | awk '/^btrfs/{print "find "$2" -type d -inum 256 -xdev"}' | sh -x + find /backup -type d -inum 256 -xdev /backup /backup/fex /backup/diaspora + find /local -type d -inum 256 -xdev /local /local/home /local/spool/fex But this does not descend subvolumes, because "find" thinks it is on a different filesystem (-xdev) For example, it does not find: root@fex:~# ll /local/home/.snapshot/ drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-13_0000.daily drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-14_0000.weekly drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-15_0000.daily drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-15_2300.hourly drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-16_0000.daily drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-16_0100.hourly drwxr-xr-x root root - 2017-08-31 08:28:11 /local/home/.snapshot/2019-07-16_0200.hourly root@fex:~# btrfs subvolume show /local/home/.snapshot/2019-07-13_0000.daily home/.snapshot/2019-07-13_0000.daily Name: 2019-07-13_0000.daily UUID: 084b1f18-b700-5845-a32d-f151db6a9f57 Parent UUID: ba4d388f-44bf-7b46-b2b8-00e2a9a87181 Received UUID: - Creation time: 2019-07-13 00:00:01 +0200 Subvolume ID: 17957 Generation: 1645903 Gen at creation: 1645903 Parent ID: 350 Top level ID: 350 Flags: readonly Snapshot(s): -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum TIK Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de Allmandring 30a Tel: ++49-711-68565868 70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/ REF:<20190715235821.rh7elbip3dgzk...@digitalmercury.dynalias.net>