[PATCH] Specify btrfs volumes by UUID in fstab

Gene Czarcinski gene at czarc.net
Wed Nov 13 16:38:58 UTC 2013


On 11/13/2013 11:10 AM, David Lehman wrote:
> On Tue, 2013-11-12 at 12:36 -0500, Gene Czarcinski wrote:
>> This is David Lehman's patch corrected so it works.
>>
>> The purpose of this patch is to have the entris of existing
>> btrfs subvolumes specified with with their parent's (the
>> BTRFS volume) UUID rather than the path.
>>
>> This patch should be considered part of the errata for
>> bz 892747.  Without this patch, there is an entry in fstab
>> but it is the pathname rather than the UUID of the BTRFS
>> volume.
> I have made a couple of minor changes to my version of the patch, most
> notably setting the fstab spec to "UUID=<volUUID>" instead of just
> "<volUUID>". Comments below apply to your patch and are fixed in mine.
>
> I'll push it to master today, but I doubt this will be in f20 since it's
> not at all critical.
No, it is not critical.  For my own use, I have an updates img which 
works fine and which I use because I want the "reclaim" functionality 
that I submitted as a separate patch.

However, it is one of those little "gotchas" that some of us who would 
like to see btrfs related problems taken a bit more seriously than it 
currently appears.  As one of my fellow "fedora-btrfs-users" expressed, 
"if this problem happened to another filesystem, it would be a 
showstopper." (or words to that effect)

Gene
>
>> This patch was create on blivet 0.23.4-1 and tested by
>> creating an updated noarch.rpm which was then applied
>> via an updates img to Fedora-20-Beta.
>> ---
>>   blivet/devices.py    | 7 +++++++
>>   blivet/devicetree.py | 2 ++
>>   2 files changed, 9 insertions(+)
>>
>> diff --git a/blivet/devices.py b/blivet/devices.py
>> index d620eaf..54b2ff7 100644
>> --- a/blivet/devices.py
>> +++ b/blivet/devices.py
>> @@ -4314,6 +4314,13 @@ class BTRFSDevice(StorageDevice):
>>       def path(self):
>>           return self.parents[0].path
>>   
>> +    @property
>> +    def fstabSpec(self):
>> +        if self.format and self.format.volUUID:
> self.format will never evaluate to False, so there's no point in that.
>
>> +            spec = "UUID=%s" % self.format.volUUID
>> +        else:
>> +            spec = super(BTRFSDevice, self).fstabSpec
>> +        return spec
>>   
>>   class BTRFSVolumeDevice(BTRFSDevice):
>>       _type = "btrfs volume"
>> diff --git a/blivet/devicetree.py b/blivet/devicetree.py
>> index 0b8dc36..7bd1963 100644
>> --- a/blivet/devicetree.py
>> +++ b/blivet/devicetree.py
>> @@ -1593,6 +1593,8 @@ class DeviceTree(object):
>>                   if vol_path in [sv.name for sv in btrfs_dev.subvolumes]:
>>                       continue
>>                   fmt = getFormat("btrfs", device=btrfs_dev.path, exists=True,
>> +                                uuid=btrfs_dev.format.uuid,
>> +                                volUUID=btrfs_dev.format.volUUID,
> We don't want to pass format.uuid -- only volUUID. The uuid should be
> unique and those are really the UUIDs for the individual member block
> devices, so it makes no sense to set them in the subvolumes.
Yes, the volUUID is the only thing that does get used.

I was just fixing up the patch you had originally posted. because I was 
really hoping to fet this into F20.
>
>>                                   mountopts="subvol=%s" % vol_path)
>>                   subvol = BTRFSSubVolumeDevice(vol_path,
>>                                                 vol_id=vol_id,
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches



More information about the anaconda-patches mailing list