From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: [RFC] a standard user-friendly way to find a snapshot in nested subvolumes [was: find subvolume directories]
Date: Tue, 16 Jul 2019 02:41:40 +0200 [thread overview]
Message-ID: <20190716004140.GA32687@tik.uni-stuttgart.de> (raw)
In-Reply-To: <20190715235821.rh7elbip3dgzkq7y@DigitalMercury.dynalias.net>
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: horlacher@tik.uni-stuttgart.de
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
REF:<20190715235821.rh7elbip3dgzkq7y@DigitalMercury.dynalias.net>
next prev parent reply other threads:[~2019-07-16 0:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 23:17 find subvolume directories Ulli Horlacher
2019-07-13 3:59 ` Andrei Borzenkov
2019-07-13 8:27 ` Ulli Horlacher
2019-07-13 11:10 ` Andrei Borzenkov
2019-07-13 11:28 ` Ulli Horlacher
2019-07-13 15:08 ` Andrei Borzenkov
2019-07-15 13:22 ` Piotr Szymaniak
2019-07-15 22:40 ` Ulli Horlacher
2019-07-15 23:58 ` [RFC] a standard user-friendly way to find a snapshot in nested subvolumes [was: find subvolume directories] Nicholas D Steeves
2019-07-16 0:41 ` Ulli Horlacher [this message]
2019-07-15 11:39 ` find subvolume directories Ulli Horlacher
2019-07-15 11:33 ` Ulli Horlacher
2019-07-16 11:04 ` Ulli Horlacher
2019-07-18 12:00 ` Axel Burri
2019-07-18 17:48 ` Andrei Borzenkov
2019-07-22 12:36 ` Axel Burri
2019-07-20 9:27 ` Ulli Horlacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190716004140.GA32687@tik.uni-stuttgart.de \
--to=framstag@rus.uni-stuttgart.de \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox