On Sat 2019-07-13 (01:17), Ulli Horlacher wrote:
> I need to find (all) subvolume directories.
> I know, btrfs subvolumes root directories have inode #256, but a
> "find / -inum 256" is horrible slow!

At least, I want to exclude non-btrfs filesystems to speed up the find
run, but find cannot detect snapshots (as part of btrfs):

root@trulla:~# find /opt -inum 256 -printf "%p %F\n"
/opt btrfs
/opt/.snapshot/2019-07-10_0000.daily unknown
/opt/.snapshot/2019-07-11_0000.daily unknown
/opt/.snapshot/2019-07-12_0000.daily unknown
/opt/.snapshot/2019-07-13_0000.daily unknown
/opt/.snapshot/2019-07-15_0000.daily unknown
/opt/.snapshot/2019-07-15_1200.hourly unknown
/opt/.snapshot/2019-07-15_1300.hourly unknown

root@trulla:~# find /opt -inum 256 \( -fstype btrfs -o -fstype unknown \) 
-printf "%p %F\n"
/opt btrfs
root@trulla:~# 

root@trulla:~# btrfs subvolume list -o /opt
ID 14930 gen 2276304 top level 259 path @/opt/.snapshot/2019-07-10_0000.daily
ID 14957 gen 2277856 top level 259 path @/opt/.snapshot/2019-07-11_0000.daily
ID 14981 gen 2279354 top level 259 path @/opt/.snapshot/2019-07-12_0000.daily
ID 15005 gen 2280891 top level 259 path @/opt/.snapshot/2019-07-13_0000.daily
ID 15052 gen 2283953 top level 259 path @/opt/.snapshot/2019-07-15_0000.daily
ID 15064 gen 2284721 top level 259 path @/opt/.snapshot/2019-07-15_1200.hourly
ID 15065 gen 2284788 top level 259 path @/opt/.snapshot/2019-07-15_1300.hourly

root@trulla:~# stat -f -c %T /opt/.snapshot/2019-07-10_0000.daily
btrfs


-- 
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:<20190712231705.ga16...@tik.uni-stuttgart.de>

Reply via email to