[Libguestfs] missing btrfs subvol support

Richard W.M. Jones rjones at redhat.com
Fri Oct 10 12:48:07 UTC 2014


On Fri, Oct 10, 2014 at 01:47:01PM +0200, Olaf Hering wrote:
> 
> Is btrfs subvol support failing just for me? Looks like nothing adds the
> required '@/' string. virt-ls uses the first variant of the command:
> 
> ><rescue> mount -vo subvol=var/spool,ro /dev/sda2 /sysroot/
> [  113.852047] BTRFS info (device sda2): disk space caching is enabled
> [  113.852869] BTRFS: has skinny extents
> mount: mount(2) failed: No such file or directory
> ><rescue> mount -vo subvol=@var/spool,ro /dev/sda2 /sysroot/
> [  116.082642] BTRFS info (device sda2): disk space caching is enabled
> [  116.083476] BTRFS: has skinny extents
> mount: mount(2) failed: No such file or directory
> ><rescue> mount -vo subvol=@/var/spool,ro /dev/sda2 /sysroot/
> [  123.995343] BTRFS info (device sda2): disk space caching is enabled
> [  123.996238] BTRFS: has skinny extents
> mount: /dev/sda2 mounted on /sysroot.
> ><rescue> exit
> 
> fstab is:
> UUID=d538a81f-9778-424d-96cc-e48dd2d4a323 swap                 swap defaults              0 0
> UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /                    btrfs defaults              0 0
> UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /var/spool           btrfs subvol=@/var/spool    0 0

I wonder if this is an Augeas thing?

We use Augeas to parse the /etc/fstab btrfs entries, see
src/inspect-fs-unix.c: check_fstab:

https://github.com/libguestfs/libguestfs/blob/master/src/inspect-fs-unix.c#L1089

And we then pass the subvol back to the mount command in
daemon/mount.c (which doesn't alter it).

https://github.com/libguestfs/libguestfs/blob/master/daemon/mount.c#L154

You could try:

cd /tmp
mkdir etc
cat > etc/fstab <<EOF
UUID=123 swap       swap defaults              0 0
UUID=456 /          btrfs defaults              0 0
UUID=789 /var/spool btrfs subvol=@/var/spool    0 0
EOF
augtool -r /tmp

In augtool:

augtool> ls /files/etc/fstab/3/vfstype
augtool> get /files/etc/fstab/3/vfstype
/files/etc/fstab/3/vfstype = btrfs
augtool> get /files/etc/fstab/3/spec
/files/etc/fstab/3/spec = UUID=789
augtool> get /files/etc/fstab/3/file
/files/etc/fstab/3/file = /var/spool
augtool> get /files/etc/fstab/3/dump
/files/etc/fstab/3/dump = 0
augtool> get /files/etc/fstab/3/opt/value
/files/etc/fstab/3/opt/value = @/var/spool

My guess is that the last one (opt/value) will be different for you.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list