[ale] Copy-on-write file?

Michael H. Warfield mhw at WittsEnd.com
Sun Jan 17 13:26:58 EST 2010


On Sun, 2010-01-17 at 07:11 -0700, JK wrote: 
> Hi everyone,

> ddrescue kicks a*s -- it imaged all but about 20MB of my 80GB failed
> HFS partition successfully.  I then made a copy of the image so as to
> have a backup in case I hosed the original (via fsck or simple
> dumbness on my part).  Making the backup took about 5 hours, which
> kinda sucked; and if I *do* need to revert to the backup image,
> copying for another 5 hours is not an appealing prospect.  What I'd
> really like is a way to tell the Linux kernel: "Please treat this
> file as copy-on-write -- if I write something to it, allocate a new
> on-disk block to hold the written data, splice that block into the
> file, and leave the original alone."  That way, going back to the
> clean image would merely be a matter of throwing away the COW blocks,
> instead of waiting another 5 hours to copy my backup image.

> Surely such magic is already available somehow? I know there are some
> distros that implement "writable" CDROM filesystems in a similar
> way, by using specialized COW filesystems, but that isn't exactly
> what I want.  I want to either
> (a) set up COW for a single file on an EXT3 FS, or else
> (b) mount the disk image as an HFS+ volume, in such a way that writes
> will not alter the image itself.

Hmmm...  If you want to do that on the block level, about my only choice
would be to set up an LVM partition with lots of free space in the PV
and put your image in the file system in the LV.  Then take a snapshot
of the LV and then go to work on your image.  If you screw something up,
revert to the snapshot, discard the changes, redo, and repeat.

If you want to do something on the logical file level, UnionFS /
funionfs would probably be your best bet.  More than likely, you won't
have the unionfs patch in your kernel so you'll need to use fuse and
funionfs which is available in the RH/Fedora repos and should be
available for Ubuntu as well.  Mount the file system you want to protect
as the RO bottom directory and then specify a directory somewhere else
as the RW top directory.  Any files that get changed, get written to the
top directory.

> (BTW I found the ext3cow FS, which would work, but something less
> intrusive would be awfully nice.)

Not familiar with that but I doubt my suggestions are any "less
intrusive" and LVM is a pain to set up, if you haven't done it before (I
have and it's still a pain to set up).

> TIA,

> -- JK

Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20100117/3748663d/attachment.bin 


More information about the Ale mailing list