* subvolume list as user?
@ 2017-09-16 9:45 Ulli Horlacher
2017-09-16 12:39 ` Hans van Kranenburg
0 siblings, 1 reply; 6+ messages in thread
From: Ulli Horlacher @ 2017-09-16 9:45 UTC (permalink / raw)
To: linux-btrfs
Every user can create subvolumes (and root cannot prevent it!).
But how can a user list these subvolumes?
tux@xerus:/test/tux: btrfs subvolume create test
Create subvolume './test'
tux@xerus:/test/tux: btrfs subvolume list .
ERROR: can't perform the search - Operation not permitted
--
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:<20170916094504.GL32347@rus.uni-stuttgart.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subvolume list as user?
2017-09-16 9:45 subvolume list as user? Ulli Horlacher
@ 2017-09-16 12:39 ` Hans van Kranenburg
2017-09-16 13:40 ` Hans van Kranenburg
2017-09-16 14:37 ` Ulli Horlacher
0 siblings, 2 replies; 6+ messages in thread
From: Hans van Kranenburg @ 2017-09-16 12:39 UTC (permalink / raw)
To: linux-btrfs
On 09/16/2017 11:45 AM, Ulli Horlacher wrote:
> Every user can create subvolumes (and root cannot prevent it!).
> But how can a user list these subvolumes?
>
> tux@xerus:/test/tux: btrfs subvolume create test
> Create subvolume './test'
>From your other posts I don't quickly get if you actually do want to
have this possible, or accept that it's currently like that and try to
do damage control by having users also remove their things again.
Actually, if you don't want this I think it's quite easily to patch your
kernel with one or two lines of code to disallow it.
> tux@xerus:/test/tux: btrfs subvolume list .
> ERROR: can't perform the search - Operation not permitted
Yes, because the SEARCH ioctl only allows root to directly query any of
the filesystem metadata from kernel memory. subvolume list uses this
SEARCH ioctl to find it's info.
--
Hans van Kranenburg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subvolume list as user?
2017-09-16 12:39 ` Hans van Kranenburg
@ 2017-09-16 13:40 ` Hans van Kranenburg
2017-09-16 14:37 ` Ulli Horlacher
1 sibling, 0 replies; 6+ messages in thread
From: Hans van Kranenburg @ 2017-09-16 13:40 UTC (permalink / raw)
To: linux-btrfs
On 09/16/2017 02:39 PM, Hans van Kranenburg wrote:
> On 09/16/2017 11:45 AM, Ulli Horlacher wrote:
>> Every user can create subvolumes (and root cannot prevent it!).
>> But how can a user list these subvolumes?
>>
>> tux@xerus:/test/tux: btrfs subvolume create test
>> Create subvolume './test'
>
> From your other posts I don't quickly get if you actually do want to
> have this possible, or accept that it's currently like that and try to
> do damage control by having users also remove their things again.
>
> Actually, if you don't want this I think it's quite easily to patch your
> kernel with one or two lines of code to disallow it.
>
>> tux@xerus:/test/tux: btrfs subvolume list .
>> ERROR: can't perform the search - Operation not permitted
>
> Yes, because the SEARCH ioctl only allows root to directly query any of
> the filesystem metadata from kernel memory. subvolume list uses this
> SEARCH ioctl to find it's info.
its! Argh! D:
--
Hans van Kranenburg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subvolume list as user?
2017-09-16 12:39 ` Hans van Kranenburg
2017-09-16 13:40 ` Hans van Kranenburg
@ 2017-09-16 14:37 ` Ulli Horlacher
2017-09-16 20:56 ` Goffredo Baroncelli
1 sibling, 1 reply; 6+ messages in thread
From: Ulli Horlacher @ 2017-09-16 14:37 UTC (permalink / raw)
To: Hans van Kranenburg; +Cc: linux-btrfs
On Sat 2017-09-16 (14:39), Hans van Kranenburg wrote:
> On 09/16/2017 11:45 AM, Ulli Horlacher wrote:
>
> > Every user can create subvolumes (and root cannot prevent it!).
> > But how can a user list these subvolumes?
> >
> > tux@xerus:/test/tux: btrfs subvolume create test
> > Create subvolume './test'
>
> From your other posts I don't quickly get if you actually do want to
> have this possible, or accept that it's currently like that and try to
> do damage control by having users also remove their things again.
I want both, country AND western :-)
Without joking:
I just want to learn more about btrfs and I have various use cases to
handle.
Different use cases need different actions.
> Actually, if you don't want this I think it's quite easily to patch your
> kernel with one or two lines of code to disallow it.
Kernel patching is a no-go for me. My boss does not allow it. No
discussion possible on this topic.
> > tux@xerus:/test/tux: btrfs subvolume list .
> > ERROR: can't perform the search - Operation not permitted
>
> Yes, because the SEARCH ioctl only allows root to directly query any of
> the filesystem metadata from kernel memory. subvolume list uses this
> SEARCH ioctl to find it's info.
This is the explantion why it does not work, but it does not help me. I
still have the problem: how can a user get a list of his subvolumes? He
may created them some time ago and forget it. He now wants to have a list
of them.
--
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:<684fb723-4270-9589-b80b-e60ccc6dadfe@mendix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subvolume list as user?
2017-09-16 14:37 ` Ulli Horlacher
@ 2017-09-16 20:56 ` Goffredo Baroncelli
2017-09-17 8:48 ` Ulli Horlacher
0 siblings, 1 reply; 6+ messages in thread
From: Goffredo Baroncelli @ 2017-09-16 20:56 UTC (permalink / raw)
To: Hans van Kranenburg, linux-btrfs
On 09/16/2017 04:37 PM, Ulli Horlacher wrote:
> On Sat 2017-09-16 (14:39), Hans van Kranenburg wrote:
>> On 09/16/2017 11:45 AM, Ulli Horlacher wrote:
>>
>>> Every user can create subvolumes (and root cannot prevent it!).
>>> But how can a user list these subvolumes?
>>>
>>> tux@xerus:/test/tux: btrfs subvolume create test
>>> Create subvolume './test'
>>
>> From your other posts I don't quickly get if you actually do want to
>> have this possible, or accept that it's currently like that and try to
>> do damage control by having users also remove their things again.
>
> I want both, country AND western :-)
>
> Without joking:
> I just want to learn more about btrfs and I have various use cases to
> handle.
>
> Different use cases need different actions.
>
>
>> Actually, if you don't want this I think it's quite easily to patch your
>> kernel with one or two lines of code to disallow it.
>
> Kernel patching is a no-go for me. My boss does not allow it. No
> discussion possible on this topic.
>
>
>>> tux@xerus:/test/tux: btrfs subvolume list .
>>> ERROR: can't perform the search - Operation not permitted
>>
>> Yes, because the SEARCH ioctl only allows root to directly query any of
>> the filesystem metadata from kernel memory. subvolume list uses this
>> SEARCH ioctl to find it's info.
>
> This is the explantion why it does not work, but it does not help me. I
> still have the problem: how can a user get a list of his subvolumes? He
> may created them some time ago and forget it. He now wants to have a list
> of them.
Far to be perfect, but this could help
find / -inum 256 2>/dev/null
each subvolume has inode number 256
BR
G.Baroncelli
--
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subvolume list as user?
2017-09-16 20:56 ` Goffredo Baroncelli
@ 2017-09-17 8:48 ` Ulli Horlacher
0 siblings, 0 replies; 6+ messages in thread
From: Ulli Horlacher @ 2017-09-17 8:48 UTC (permalink / raw)
To: linux-btrfs
On Sat 2017-09-16 (22:56), Goffredo Baroncelli wrote:
>> how can a user get a list of his subvolumes? He may created them some
>> time ago and forget it. He now wants to have a list of them.
>
> Far to be perfect, but this could help
>
> find / -inum 256 2>/dev/null
>
> each subvolume has inode number 256
But non-btrfs filesystems can also have an inode 256!
And it is terrible slow and inefficent.
Ok, I will add a sudo wrapper for my btrfs_subvolume_list :
#!/usr/bin/perl -w
$mounts = '/proc/mounts';
open $mounts,$mounts or die "$0: cannot open $mounts - $!\n";
while (<$mounts>) {
if (m:^(/\S+) (/\S*) btrfs:) {
push @bfs,$2;
}
}
close $mounts;
if (@bfs) {
@bfs = sort @bfs;
} else {
die "$0: no mounted btrfs filesystems\n";
}
@sv = ();
foreach my $fs (@bfs) {
push @sv,"$fs\n";
open $fs,"btrfs subvolume list '$fs'|" or next;;
while (<$fs>) {
chomp;
s:.* \d+ path :$fs/:;
push @sv,"$_\n" if -d;
}
close $fs;
}
print sort @sv;
--
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:<54b8bb4b-3807-15da-1db5-fab7b0ced253@libero.it>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-17 8:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-16 9:45 subvolume list as user? Ulli Horlacher
2017-09-16 12:39 ` Hans van Kranenburg
2017-09-16 13:40 ` Hans van Kranenburg
2017-09-16 14:37 ` Ulli Horlacher
2017-09-16 20:56 ` Goffredo Baroncelli
2017-09-17 8:48 ` Ulli Horlacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).