From: Richard W.M. Jones Date: Mon, 17 Sep 2018 18:36:43 +0000 (+0100) Subject: 2019-fosdem: Update paper. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=48c99a866cbdec93329d345a4c7ac29e5ae52d3f;p=libguestfs-talks.git 2019-fosdem: Update paper. --- diff --git a/2019-fosdem/paper/fosdem-rjones-better-loopback-paper.tex b/2019-fosdem/paper/fosdem-rjones-better-loopback-paper.tex index 6a0e47f..cfb2144 100644 --- a/2019-fosdem/paper/fosdem-rjones-better-loopback-paper.tex +++ b/2019-fosdem/paper/fosdem-rjones-better-loopback-paper.tex @@ -183,15 +183,75 @@ gone, making this very useful for testing filesystems. \section{Concatenating files into a partitioned disk} -\textit{In the talk this section will talk about creating a virtual - disk with a virtual partition table using the nbdkit - ``partitioning'' plugin.} +Whereas loopback mounts are limited to a single file, there are +several nbdkit plugins for combining files. One of them is called the +``partitioning'' plugin, and it turns partitions into disk images: + +\begin{verbatim} +$ nbdkit partitioning \ + boot.img \ + swap.img \ + root.img +\end{verbatim} + +This time I'll use \texttt{guestfish} to examine this virtual disk: + +\begin{verbatim} +$ guestfish --format=raw -a nbd://localhost -i + +Welcome to guestfish, the guest filesystem shell for +editing virtual machine filesystems and disk images. + +Type: ‘help’ for help on commands + ‘man’ to read the manual + ‘quit’ to quit the shell + +Operating system: Fedora 26 (Twenty Six) +/dev/sda3 mounted on / +/dev/sda1 mounted on /boot + +> list-filesystems +/dev/sda1: ext4 +/dev/sda2: swap +/dev/sda3: xfs +\end{verbatim} + +You can see that the NBD disk contains three +partitions\footnote{\texttt{/dev/sdX} inside libguestfs is equivalent + to \texttt{/dev/nbd0} on the host}. \section{Mounting a VMware VMDK file} -\textit{In the talk this section will talk about modifying VMware VMDK - files using the nbdkit ``vddk'' plugin.} +VMware VMDK disk images are difficult to open on Linux machines. +VMware provides a proprietary library to handle them, and nbdkit has a +plugin to handle this library (the plugin is free software, but the +VMware library that it talks to is definitely not). We can use this +to loopback mount VMDK files: + +\begin{verbatim} +# nbdkit vddk file=TestLinux-disk1.vmdk +# nbd-client -b 512 localhost 10809 /dev/nbd0 +\end{verbatim} + +This disk image contains two partitions and several logical volumes. +The Linux kernel finds them all automatically: + +\begin{verbatim} +# file -bsL /dev/nbd0p1 +Linux rev 1.0 ext4 filesystem data, UUID=9d1d5cb7-b453-48ac-b83b-76831398232f (needs journal recovery) (extents) (huge files) +# file -bsL /dev/nbd0p2 +LVM2 PV (Linux Logical Volume Manager), UUID: bIY2oM-CgAN-npqG-gItS-WY6e-wO7d-L6G3Bv, size: 8377444864 +# ls /dev/vg_testlinux/ +lv_root lv_swap +\end{verbatim} + +You can read and write to VMDK files this way: + +\begin{verbatim} +# mount /dev/vg_testlinux/lv_root /mnt +# touch /mnt/hello +\end{verbatim} \section{Testing a RAID array}