[PATCH] Copy on write (persistent disk) support for MOL


Subject: [PATCH] Copy on write (persistent disk) support for MOL
From: Michael Clark (michael@metaparadigm.com)
Date: Wed Feb 07 2001 - 18:02:01 MST


Hi All,

I'd been playing around with MOL session saving/resuming and thought, wow,
wouldn't it be nice if I could boot MOL/MacOS in one second flat every time. The
main constraint in making this possible is that disk modifications invalidate
the state of the saved mol_session - meaning you can only resume once from a
saved session.

You can get around this by making your disks read-only, but MacOS tends to like
to write to the System Folder. So basically I decided to add copy-on-write
support to the MOL block device driver so in this mode writes occur in an
overlay file and the underlying block device is unchanged.

So now its possible to resume MOL instantly every time. It works quite well if
you save all of data onto a network share (as any changes to your local HFS
disks will be lost). Its also great for MOL development as you have no worries
about trashing your disks.

So here's how you do it:

1. Apply patch and rebuild mol (should be okay to just install mol binary
manually so you don't trash your molrc).

# cd mol-0.9.53
# patch -p1 < ../mol-0.9.53-cow-0.1.patch
patching file Doc/molrc.sample
patching file drivers/scsi/osi_blk.c
patching file emulation/memory.c
patching file emulation/session.c
# make
...
# cp ./lib/bin/mol /usr/lib/mol/bin

2. Prepare a suspended image

We need to boot first with cow disabled to get a suspended image in sync with
our block devices. Add the following to your /etc/molrc :

session_readonly: no
cow_dir: /tmp

Start up mol and save your session with F12.

3. Make session readonly and add -cow flag to all read-write block devices; ie.
change the following in /etc/molrc :

session_readonly: yes
blkdev: /dev/hda9 -rw -cow

4. Now start MOL ad infinitum in no time flat ...

So have a play around and let me know how you go. I've attached patches for
mol-0.9.53 and mol-0.9.55 (I haven't tested much with 0.9.55 as this release
doesn't seem to like the input layer backport in my 2.2.18pre21 kernel).

I'm interested in feedback from other MOL developers and would be like to think
this feature is worthy of being added into the main source tree.

To do:
* Add a utility that commits changes from cow overlay file to underlying block
device.

tx, ~mc

Michael Clark, . . . . . . . . . . . . michael@metaparadigm.com
Metaparadigm Pte. Ltd. . . . . . . . . . . phone: +65 9645 9612
25F Paterson Road, Singapore 238515 . . . . . fax: +65 733 8825





This archive was generated by hypermail 2a24 : Wed Feb 07 2001 - 17:59:56 MST