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> exitfstab 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 Olaf
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 0I 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
On Fri, Oct 10, Richard W.M. Jones wrote:> My guess is that the last one (opt/value) will be different for you.Thanks for the pointers. I will poke around. At least augtool on the host seems to behave correctly: olaf@bax:~ $ cd /dev/shm/$$ bash: cd: /dev/shm/3570: Datei oder Verzeichnis nicht gefunden olaf@bax:~ $ mkdir $_ olaf@bax:~ $ cd $_ olaf@bax:/dev/shm/3570 $ mkdir etc olaf@bax:/dev/shm/3570 $ cat > etc/fstab 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 olaf@bax:/dev/shm/3570 $ augtool -r $PWD 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/opt/value /files/etc/fstab/3/opt/value = @/var/spool augtool> I will poke around to see what I find. Olaf
On Fri, Oct 10, Richard W.M. Jones wrote:> 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#L154Something between add_fstab_entry and the actual mount call removes the '@/'. My debug() shows: add_fstab_entry(1048): fstab: mountable=btrfsvol:/dev/sda2/@/var/spool mountpoint=/var/spool libguestfs: check_for_filesystem_on: btrfsvol:/dev/sda2/var/spool (btrfs) So 'fs->fstab[].mountable' gets tweaked somewhere. Olaf
On Fri, Oct 10, Olaf Hering wrote:> Is btrfs subvol support failing just for me?This is an old thread, and it seems the underlying bug is not fixed because guestfs takes the wrong approach, IMO.>From how I understand btrfs, it has the concept of subvolumes. Each oneis an entry point for a separate filesystem. In addition to that it has a default subvol which is used if no specific subvolume is specified. This turns the whole btrfs partition (or assembled blockdevice) into a container of individual filesystems. But guestfs, as far as I understand it, just mounts the btrfs filesystem with the default subvolume and ends up somewhere. Then it tries to make sense of the other subvolumes based on info from a /etc/fstab, which may or may not exist. This looks like the wrong approach. Shouldnt it instead handle the whole thing as a container, just as it does for an individual disk? First do something like mount subvolid=0, poke around there and collect the items (sub list -a). Then use all this info to see which one might be one of the many root filesystems? Olaf
On Wed, Sep 09, 2015 at 07:14:05PM +0200, Olaf Hering wrote:> On Fri, Oct 10, Olaf Hering wrote: > > > Is btrfs subvol support failing just for me? > > > This is an old thread, and it seems the underlying bug is not fixed > because guestfs takes the wrong approach, IMO. > > >From how I understand btrfs, it has the concept of subvolumes. Each one > is an entry point for a separate filesystem. In addition to that it has > a default subvol which is used if no specific subvolume is specified. > This turns the whole btrfs partition (or assembled blockdevice) into a > container of individual filesystems. > > But guestfs, as far as I understand it, just mounts the btrfs filesystem > with the default subvolume and ends up somewhere. Then it tries to make > sense of the other subvolumes based on info from a /etc/fstab, which may > or may not exist. This looks like the wrong approach. > > Shouldnt it instead handle the whole thing as a container, just as it > does for an individual disk? First do something like mount subvolid=0, > poke around there and collect the items (sub list -a). Then use all this > info to see which one might be one of the many root filesystems?Matt? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html