zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

Create LVM Snapshot

May 27, 2011 by Igor Drobot Leave a Comment

I want to show you how to create a LVM snapshot on the fly, before you install some nasty updates.

I have my KVM virtual machine (/dev/vg0/Webserver) and want to upgrade it, before I go on, I want to create a LVM snapshot. In worst case it can change back to this state.

1
lvcreate -L 5000 -s -n "7.9_wheezy" /dev/vg0/devel.drobot.de

lvcreate -L 5000 -s -n "7.9_wheezy" /dev/vg0/devel.drobot.de

– L 5000 is the size in MB
-s flag is to create a snapshot
-n 7.9_wheezy is the name of new logical volume

If something goes wrong, go back to previously created snapshot:

1
2
3
lvchange -a n /dev/vg0/devel.drobot.de
lvconvert --merge /dev/vg0/7.9_wheezy
lvchange -a y /dev/vg0/devel.drobot.de

lvchange -a n /dev/vg0/devel.drobot.de lvconvert --merge /dev/vg0/7.9_wheezy lvchange -a y /dev/vg0/devel.drobot.de

Attention!
If you delete your origin volume your snapshot will be automatically deleted!

Filed Under: Debian, Linux Tagged With: lvchange, lvconvert, lvcreate, LVM, restore lvm, Snapshot

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *