[Libguestfs] Root btrfs partition listed twice?

Mike Latimer mlatimer at suse.com
Mon Apr 28 15:07:50 UTC 2014


On Monday, April 28, 2014 10:02:54 AM Matthew Booth wrote:
> >> For the record, here's the full filesystem list:
> >>> <fs> list-filesystems
> >> 
> >> /dev/sda1: swap
> >> btrfsvol:/dev/sda2/@: btrfs
> >> btrfsvol:/dev/sda2/boot/grub2/i386-pc: btrfs
[...]
> >> btrfsvol:/dev/sda2/.snapshots: btrfs
> >> /dev/sda2: btrfs
> 
> It looks like /dev/sda2 is both the root of the btrfs filesystem and a
> subvolume called '@'. In Fedora, at least when I wrote this, subvolumes
> where created underneath the btrfs root, so the btrfs root itself would
> never be mistaken for the root filesystem.
> 
> Is '@' btrfs magic that means the root? If so, is it always listed? If
> /dev/sda2 and btrfsvol:/dev/sda2/@ will always mean the same filesystem,
> we should filter out the former if the latter exists. We need to nail
> down exactly what '@' means first, though.

Thanks for the comments. It looks like @ is just a naming convention that we 
have chosen for the root of the btrfs volume. I've seen the same thing in 
Ubuntu (http://askubuntu.com/questions/331233/creating-btrfs-subvolume-like-or-home), and I suppose it could be in other places as well. Here's the output 
of `btrfs subvolume list /`:

ID 257 gen 85 top level 5 path @
ID 258 gen 85 top level 257 path boot/grub2/i386-pc
ID 259 gen 85 top level 257 path boot/grub2/x86_64-efi
[...]
ID 272 gen 85 top level 257 path var/tmp
ID 278 gen 85 top level 257 path .snapshots

and `btrfs subvolume show /`:

   Name:                    @
   uuid:                      8add32ac-4abf-af49-bdeb-bfbf1ae5ecd8
   Creation time:        2014-04-23 13:23:50
   Object ID:               257
   Generation (Gen):  105
   Gen at creation:     7
   Parent:                   5
   Top Level:               5
   Flags:                     -
   Snapshot(s):          .snapshots/1/snapshot

As this is more than just a SUSE thing, it seems like filtering out the non-
btrfsvol device would be the right approach...

-Mike




More information about the Libguestfs mailing list