Skip to contentSkip to conversation

restoring snapshots

linux-lvm Stephane Chazelas 3 participants 3 messages Sep 20, 2010

lore
Share & tools
lore
#0 lore raw

Hiya,

I was wondering about how to restore/apply a LVM snapshot to the original partition. Looking at the archive, I can see it's advised to dump the snapshot content into a file and then dump that onto the original device after having removed the snapshot.

What's wrong with:

lvcreate -n lv -L1G vg
...
mount /dev/vg/lv /x
...
lvcreate -s -n lv_snap /dev/vg/lv
...
mount /dev/vg/lv_snap /y

Them to apply the snapshot:

umount /x /y
dd bs=4M < /dev/mapper/vg-lv_snap > /dev/mapper/vg-lv-real lvremote /dev/vg/lv_snap

It's still not optimal as it writes the whole volume, but at least, I don't have to find a storage area big enough to hold an extra copy of the whole volume and it's faster.

It seems to be working on a test on /dev/loop. Is there any circumstance (as long as there's only one snapshot of the volume) where it wouldn't work, or what would be the potential pitfalls (other than if there's a crash in the middle, you're screwed)?

Is there any plan to add the feature to efficiently restore/apply/commit a snapshot (that is only dump the cow data onto the original volume without writing the whole volume) or does that feature exist already and I missed it?

Thanks,
Stephane

#1 lore raw
Quoted 33 lines

Hiya,

I was wondering about how to restore/apply a LVM snapshot to the original partition. Looking at the archive, I can see it's advised to dump the snapshot content into a file and then dump that onto the original device after having removed the snapshot.

What's wrong with:

lvcreate -n lv -L1G vg
...
mount /dev/vg/lv /x
...
lvcreate -s -n lv_snap /dev/vg/lv
...
mount /dev/vg/lv_snap /y

Them to apply the snapshot:

umount /x /y
dd bs=4M < /dev/mapper/vg-lv_snap > /dev/mapper/vg-lv-real lvremote /dev/vg/lv_snap

It's still not optimal as it writes the whole volume, but at least, I don't have to find a storage area big enough to hold an extra copy of the whole volume and it's faster.

It seems to be working on a test on /dev/loop. Is there any circumstance (as long as there's only one snapshot of the volume) where it wouldn't work, or what would be the potential pitfalls (other than if there's a crash in the middle, you're screwed)?

Quoted 4 lines

Is there any plan to add the feature to efficiently restore/apply/commit a snapshot (that is only dump the cow data onto the original volume without writing the whole volume) or does that feature exist already and I missed it?

The newer versions do have the lvmerge feature, and it seems to work in RHEL6 beta from what I could see.

Quoted 10 lines

Thanks,
Stephane

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

This email communication and any files transmitted with it may contain confidential and or proprietary information and is provided for the use of the intended recipient only. Any review, retransmission or dissemination of this information by anyone other than the intended recipient is prohibited. If you receive this email in error, please contact the sender and delete this communication and any copies immediately. Thank you.
http://www.encana.com

#2 lore raw
Quoted 7 lines · David
Quoted 4 lines

Is there any plan to add the feature to efficiently restore/apply/commit a snapshot (that is only dump the cow data onto the original volume without writing the whole volume) or does that feature exist already and I missed it?

The newer versions do have the lvmerge feature, and it seems to work in RHEL6 beta from what I could see.

Yes, and the changes are also upstream, see:
https://www.redhat.com/archives/linux-lvm/2010-February/msg00029.html
https://www.redhat.com/archives/linux-lvm/2010-May/msg00017.html

Mike