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

Re: device mapper help



I'm not on the list.  Please always keep me in the CC.

On Fri, Nov 07, 2008 at 02:46:24PM -0600, Boyd Stephen Smith Jr. wrote:
> On Friday 07 November 2008, William Thompson <wt@electro-mechanical.com> 
> wrote about 'Re: device mapper help':
> >On Fri, Nov 07, 2008 at 11:44:00PM +0800, hhding.gnu wrote:
> >> William Thompson wrote:
> >> >
> >> > Is there a tool somewhere that will allow me to merge a snapshot into
> >> > the parent device?
> >>
> >> As far as I know, LVM does not provide this function. ZFS can promote
> >> it's snapshoot.
> >
> >I'm not using LVM for this functionality.  I want this on the block
> > level, not the fs level.
> 
> What are you using to take snapshots, then?  Also, LVM doesn't know 
> anything about filesystems -- it does everything "on the block level".

dmsetup manually.

> Also, you certainly don't want to update a block device's data while 
> there's a mounted filesystem on top of it, so the filesystem (and any 
> other layers between in device and the fs) are definitely of concern.

I knew this.  But this isn't what I was referring to.  Let me try to explain
it in a different way (more to what I'm really doing, the config I gave
before was an example of what I wanted)

I'm doing something like this:
# dmsetup create disk-0
0 16777216 zero
# lvcreate -l 1024 -n disk-1-cow vg0
# dmsetup create disk-1
0 16777216 snapshot /dev/mapper/disk-0 /dev/vg0/disk-1-cow P 8
# dmsetup create disk
0 16777216 linear /dev/mapper/disk-1 0
# 
 <do something with /dev/mapper/disk, like a VM>
 <stop using /dev/mapper/disk>
# lvreduce -l <smallest size possible> vg0/disk-1-cow
# dmsetup table disk-1 | dmsetup -r reload disk-1
# dmsetup resume disk-1
# lvcreate -l 1024 -n disk-2-cow vg0
# dmsetup create disk-2
0 16777216 snapshot /dev/mapper/disk-1 /dev/vg0/disk2-cow P 8
# dmsetup reload disk
0 16777216 linear /dev/mapper/disk-2 0
# dmsetup resume disk
# <do some more stuff>

At this point, maybe I don't want the disk-1 snapshot anymore but want to
merge in the changes from disk-2 so that disk-1 is now disk-1 + disk-2 and
remove or invalidate disk-2.  I'm looking for a took that can take
/dev/vg0/disk-2-cow and update the modified sectors in /dev/mapper/disk-1. 

I have already figured out that I've had some problems with the above if I
don't do it right (In this case it was under kvm-qemu when I didn't want to
keep the last snapshot).


Reply to: