[PLUG] UML image merging?

Erik Walthinsen omega at pdxcolo.net
Fri Feb 6 14:47:01 UTC 2004


On Fri, 2004-02-06 at 14:29, Russell Senior wrote:
> I have a question about COW and backing files.  When I initially setup
> the UML hosts I used in the December AT talk, the four hosts I had
> were running off the same backing file.  The question I asked last
> night was about mounting the COW file in order to loopback mount it in
> the host system (e.g. to copy in modules for a new kernel).  When I
> wanted to do this, I had to merge the COW with its backing file to
> create a new backing file for each virtual host.  After that, I wasn't
> sharing the backing file anymore.  The PDXcolo people seemed to imply
> that it was possible to re-merge the separate backing files into a
> single backing file and, presumably, per-host COW files.

You have to boot the UML kernel with the original backing+CoW file,
along with the either original or new flat or backing+CoW, and do an
rsync between them.  The easiest way to perform this is by booting via
hostfs, as per the HOWTO:

http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-9.html#ss9.3

The trick to safely doing that is to pass init=/bin/bash to the UML
kernel, so you don't have the UML kernel trying to start up services
that are already running on the host, using the exact same files (since
UML root then == host root).  From there you can mount the two ubd's
(ubd1 and ubd2, not ubd0 as that "is" hostfs) and rsync between them as
needed.

Also keep in mind that you have to do this in order to flatten a recent
CoW file, because the stock Debian (and others I presume) uml-utilities
do not have uml_moo support for version 3 CoW files.  I haven't checked
the latest release myself.  And since the uml-utilities do not have a
way of going *back* to a CoW file (since rsyncing is a filesystem-level
thing, not block-level), you'll probably just want to write up a script
that will work both ways and use it in all cases anyway.

Also, remember the phrase "Once a backing file, Always a backing file". 
Specifically, because the CoW file is a *block*-level difference and not
filesystem-level, any changes of any kind to the backing file will
totally invalidate the CoW file, and UML will refuse to use it.  When
moving backing files around disk or net, make sure you preserve the
mtime, or UML will freak out.  However, that is the *only* check it
performs, so you can play with disaster scenarios e.g. scribbled disk
that way.

Omega
aka Erik Walthinsen
omega at pdxcolo.net





More information about the PLUG mailing list