support for existing BTRFS subvolumes

Gene Czarcinski gene at czarc.net
Sun Oct 13 15:47:40 UTC 2013


On 10/12/2013 11:09 AM, Gene Czarcinski wrote:
> I have complete creation and testing of a patch which adds kickstart 
> support for existing BTRFS subvolumes to be added to the /etc/fstab 
> when it is created.  This patch includes having each existing 
> subvolume specified using the UUID of it parent BTRFS volume.  The 
> patches are available as part of bugzilla report:
> https://bugzilla.redhat.com/show_bug.cgi?id=892747
>
> Each patch can be applied to anaconda in a git repository and used to 
> create an updates disk for testing.  Therefore I have created two 
> versions of the patch: Fedora 19 with anaconda-19.30.13-1 and Fedora 
> 20-beta-TC2 with anaconda-20.22-1.  The updates disk for Fedora 20 was 
> build on a Fedora 20 TC1+ hardware system and then tested installing 
> on kvm virtuals with F20-beta-TC2+all-repos.
>
> That is all I can say is ... it works.
>
> I sure would like to see this in Fedora 20!!
>
> As I have currently implemented things, the patch changed things so 
> that either --noformat or --useexisting can be specified for an 
> existing BTRFS volume with the same results.  For an existing 
> subvolume if --noformat is specified, then the patch adds code so that 
> that subvolume will be added to the anaconda created /etc/fstab with 
> the UUID of the subvolume's BTRFS volume.  For an existing subvolume 
> if --useexisting is specified, then you get exactly the same thing 
> that you get right now ... nothing!
>
> Proposal:  As I examined the code, it became obvious to me that it 
> would be easy to add the equivalent of "reformat" for a BTRFS 
> subvolume by simply deleting the current subvolume of the specified 
> name and then recreating it.  Not only that but if "--useexisting" is 
> used to specify that functionality, this would be consistent with what 
> is done for logical volumes where --noformat is used to mean "leave it 
> alone: and --useexisting to mean reformat.
>
> I do not like cross-posts so I will be posting a duplicate of this 
> message to the anaconda mailing list.
>
Grumble, grumble ... turns out that doing what I want to do is a little 
bit more difficult that I anticipated.  The reason is that the 
pykickstart package sets both --noformat and --useexisting if either 
--noformat or --useexisting is specified.  Therefore, you cannot 
differentiate between these two parameters until the pykickstart package 
is changed ... and, this will need some regression testing because a 
bunch of packages depend on pykickstart.

So, I have currently reworked my patch for supporting btrfs subvolumes 
being added to /etc/fstab so that it uses --noformat.

For testing purposes, I have added some code just before a new btrfs 
subvolume create request is done that, if (and only if) this is a subvol 
operation AND the mountpoint == "/", then check if the subvolume already 
exists and, if it does, request destruction ... works just fine.

Occurs to me that an interesting option for the GUI interface might be 
to add some type of checkbox for a subvolume which says to just delete 
and recreate (although I think you can pretty much do that anyway).

If there is interest, I can post the code.

Gene




More information about the Kickstart-list mailing list