Re: [PATCH v5] btrfs-progs: add --subvol option to mkfs.btrfs

Goffredo Baroncelli
2024-08-10T09:55:46Z

On 09/08/2024 21.31, David Sterba wrote:
> On Thu, Aug 08, 2024 at 06:17:16PM +0100, Mark Harmstone wrote:
>> This patch adds a --subvol option, which tells mkfs.btrfs to create the
>> specified directories as subvolumes.
>>
>> Given a populated directory img, the command
>>
>> $ mkfs.btrfs --rootdir img --subvol img/usr --subvol img/home --subvol img/home/username /dev/loop0
>>
>> will create subvolumes usr and home within the FS root, and subvolume
>> username within the home subvolume. It will fail if any of the
>> directories do not yet exist.
>
> Can this be fixed so the intermediate directories are created if they
> don't exist? So for example
>
> mkfs.btrfs --rootdir dir --subvolume /var/lib/images
>
> where dir contains only /var. I don't think it's that common but we
> should not make users type something can be done programmaticaly.

Can we go a bit further ? I mean get rid of --rootdir completely, so
a filesystem with "a default" subvolume can be created without
passing --rootdir.

However, this would lead to the queston: which user and permission has to be set to those subvolumes ?
So I think that we need a further parameter like "--subvol-perm" and "--subvol-owner"...

BR

--
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5