-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
btrfs-progs: add --subvol option to mkfs.btrfs #868
Conversation
46f8278
to
70b9d17
Compare
Whoops, fixed test |
I tested this systemd/systemd#33498 and it works perfectly |
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 usr --subvol home --subvol 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. Signed-off-by: Mark Harmstone <[email protected]>
70b9d17
to
1ef6bbf
Compare
New version including adding --subvol to mkfs.btrfs man page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Just a little curious about this future feature. Do you plan to add a new option "--default-subvolume" or something like that, so that you can specify a subvolume inside the rootdir as the default one, after filling the rootdir along with the subvolumes? If so, that new "--default-subvolume" option should still rely on the current rootdir + subvolume mechanism, just a new offline way to set default subvolue. And if that's the case, everything looks fine to me, including the future feature. |
Yes, that's right |
FYI @schaefi, we probably want to use this in kiwi too! |
Add a new option --subvol, which tells mkfs.btrfs to create the specified directories as subvolumes when used with --rootdir. Given a populated directory dir, the command $ mkfs.btrfs --rootdir dir --subvol usr --subvol home --subvol home/username img will create subvolumes 'usr' and 'home' within the toplevel subvolume, and subvolume 'username' within the 'home' subvolume. It will fail if any of the directories do not yet exist. Pull-request: #868 Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Signed-off-by: David Sterba <[email protected]>
Add a new option --subvol, which tells mkfs.btrfs to create the specified directories as subvolumes when used with --rootdir. Given a populated directory dir, the command $ mkfs.btrfs --rootdir dir --subvol usr --subvol home --subvol home/username img will create subvolumes 'usr' and 'home' within the toplevel subvolume, and subvolume 'username' within the 'home' subvolume. It will fail if any of the directories do not yet exist. Pull-request: #868 Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Signed-off-by: David Sterba <[email protected]>
Add a new option --subvol, which tells mkfs.btrfs to create the specified directories as subvolumes when used with --rootdir. Given a populated directory dir, the command $ mkfs.btrfs --rootdir dir --subvol usr --subvol home --subvol home/username img will create subvolumes 'usr' and 'home' within the toplevel subvolume, and subvolume 'username' within the 'home' subvolume. It will fail if any of the directories do not yet exist. Pull-request: #868 Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Signed-off-by: David Sterba <[email protected]>
Add a new option --subvol, which tells mkfs.btrfs to create the specified directories as subvolumes when used with --rootdir. Given a populated directory dir, the command $ mkfs.btrfs --rootdir dir --subvol usr --subvol home --subvol home/username img will create subvolumes 'usr' and 'home' within the toplevel subvolume, and subvolume 'username' within the 'home' subvolume. It will fail if any of the directories do not yet exist. Pull-request: #868 Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Signed-off-by: David Sterba <[email protected]>
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 usr --subvol home --subvol 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.
This is version 6 of the patch; I figured it'd be easier doing things here rather on the mailing list, if we're using both.
I've incorporated Qu's suggestion that we can free the subvol list as we go along, and thus speed up iteration slightly. I've also changed it so that the --subvol value is again relative to the --rootdir rather than the working directory, which was this way because of a potential future patch allowing out-of-tree subvolumes.
I've discussed this with @DaanDeMeyer, who wants this for mkosi, and agreed that the best way to do "out-of-tree" subvolumes would be for a future --default-subvol option instead.