[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] Bind mounts

The test program below demonstrates how to use bind mounts to mount a
subdirectory over the root directory.  It is using the debug backdoor,
but I guess we could consider adding a bind-mount API instead.

[Note that guestfs_mount_options doesn't work because it expects the
third argument to be a device, not a directory name.]



guestfish -N fs -m /dev/sda1 <<EOF
  mkdir /root
  touch /root/test

  # Use -o rbind if there are submounts.
  debug sh "mount -o bind /sysroot/root /sysroot"

  ls /
  # The above command prints "test" as expected.

  # Check that umount-all still works.
  debug sh "grep /sysroot /proc/mounts ||:"

Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]