Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have made an LVM snapshop by

lvcreate --name snap --size 10G -s /dev/vg00/vm

What command should I write if I want to drop the snapshot, and not keep the changes that have happened since the snapshot?

And what command should I write to roll the changes from the snapshot into /dev/vg00/vm ?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

to drop snapshot use:

lvremove group/snap-name

to merge snapshot use:

lvconvert --merge group/snap-name

Though merging will be deferred until the orgin and snapshot volumes are unmounted. You may need to update kernel (>=2.6.33) and lvm tools to have support for merging.

share|improve this answer

Looks like this has been asked before:

http://serverfault.com/questions/128878/linux-lvm-snapshot-commit-or-revert

As well as:

http://www.jonnor.com/2010/02/lvm-snapshot-merging-avaliable/

share|improve this answer
    
Ok, so lvremove accepts the changes in the snapshot. So far so good =) –  Sandra Sep 27 '10 at 23:18

OK, first of all: the grand old LVM1 supported only read-only snapshots. In that case the modifications were copied to original image after unmounting the snapshot. LVM2 provides support for read-write snapshots, allowing you to do funkier stuff with virtual machine images and stuff like that.

Novell has a very niece piece of documentation about the concept of using LVM for rolling back a failed OS update. Take a look at that article, it provides all the bits and pieces you need for your case.

share|improve this answer
    
So there isn't a command to drop the snapshot without accepting the changes? –  Sandra Sep 27 '10 at 23:20

you can use lvremove command to remove the old snapshot files:

lvremove /dev/vg_brcvhost1/snap this will ask you to remove a sanpshot persent in the your LV.

other commands are also there for managing a LVM based VM setup.

you can find the details commands in the link below: http://linux.math.tifr.res.in/HOWTO/LVM-HOWTO/snapshots_backup.html

and the below link may also be usefull: http://dentarg.it64.com/content/lvm-based-backup-virtual-machines

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.