Re: snapshot reset

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

 



Bastian Blank wrote:
With LVM2, between those commands, you can just zero out the
start of the cow device (say first 64k).  And then it'll treat
it as if it were a new snapshot (based on current state of filesystem.)


Something like this?
| name=${vg}-${lv}
| dmsetup suspend $name
| dd if=/dev/zero of=/dev/mapper/${name}-cow bs=64k count=1
| dmsetup resume $name

I tried something very much like this a couple of weeks ago (with Linux 2.6.10) and found that it's not reliable. Digging further, I learned that the snapshot device doesn't actually read the cow device when it resumes. (BTW, you only need to blank the first 4 bytes, which contain the magic number.) However, if you use "vgchange -a n; vgchange -a y" after this script, it should work.


My goal was to use snapshot devices to implement filesystem-level transactions. I wanted to write a set of changes to the filesystem only if all of the changes could be committed. I decided that vgchange was too invasive for my purposes, so I wrote a patch for device-mapper that lets you reliably and quickly clear a snapshot device using this command:

  dmsetup message ${vg}-${lv} 0 resync

Then I wrote a script that commits the changes from a snapshot device back to the original volume, then clears the snapshot device so it can be reused for more transactions. I was happy with how it turned out; you don't even have to unmount the filesystem to commit a transaction. (Aborting a transaction does require a remount.)

Once I finished, I changed my mind and decided I wanted to gain transactional integrity in a different way. However, if anyone's interested in my work, email me and I'll send you everything.

Shane

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux