LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-26-2010, 03:47 PM   #1
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
Periodic LVM snapshots


I want to start making snapshots of my system LV once every two weeks, so that I can roll back quickly if I mess up my system configuration somehow. I can make a snapshot by following the instructions in the manual pages, but I am unclear on one point: do I have to create a new snapshot each time (i.e., after deleting the old one) or is there some command to make a existing snapshot "forget" its original state and start tracking changes again from a fresh point?
 
Old 11-27-2010, 11:57 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Well with the way that a snapshot works I would suggest that it's not like that in the first place. You have a fixed amount of space assigned to the snapshots, say 20% of the partiton. So once the live state has been changed to the extent of having to use the spare 20% of the disk space, there is no longer any space to keep the old snapshot in one piece, and as such it is invalid. If you make 2 snapshots, one after half that 20% has been used up, then the first 10% is only relevant to the first snapshot, then 2nd 10% that makes up the first snapshots 20% is also common to the 2nd snapshot. There is no cost to making as many snapshots as you wish, and it's not like you could create a snapshot, create a large file, delete that file and then have LVM magically know that the two filesystems (live and snapshot) are actually identical, it doesn't (afaik) track anything intelligently like that at all, no undo's etc, so the changes are completely linear - thus 10 snapshots still use up the "same amount of resources" as the very oldest one in that list.

Or at least, that's the way *I* understand it. If you understand me...

And so for your question, it doesn't matter about the old one either way. Delete it proactively if you wish, but it won't have any implications for any other snapshots.
 
Old 11-27-2010, 03:57 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,127

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
I haven't had my first cup of coffee yet, so you lost me there Chris...

I recently tested btrfs snapshot on Fedora - taking auto snapshots on yum updates (think "emerge world"). Nice idea similar to what the OP is thinking of. Snapshots are a "point in time" copy. End of discussion.
They are "lightweight" (supposedly) because they are a cow (copy-on-write) implementation. Problem I found was that because I took them just before each update, the snap effectively became the size of the update. I hadn't bothered to implement a deletion regime (because they are "lightweight" remember - d'oh) and quickly burned 20 Gig of my root partition. That resulted in a full filesystem till I figured out what had happened.

Short answer - delete the old(est) snaps, and enjoy the convenience - same concepts apply to both LVM and btrfs for this AFAIK.
 
Old 11-27-2010, 04:11 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
so comparing that with lvm, the about is in reserved space in the partition, which is fixed, so you can never gave them cause you to run out of space, they just become invalid if the size if the changed data is larger then the reserved snapshot space.
 
Old 11-27-2010, 04:14 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
I'd also say that a word as benign as 'copy' can be very misleading. The data isn't actually copied per se, so wouldn't take up double the space etc.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM Snapshots, can they be disabled? Stiken Linux - Newbie 2 01-29-2010 02:57 PM
LVM snapshots: How to use? gargamel Linux - Server 12 02-24-2008 02:57 PM
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 11:16 AM
LXer: Consistent backup with Linux Logical Volume Manager (LVM) snapshots LXer Syndicated Linux News 0 06-02-2006 04:21 PM
LVM snapshots that run out of space, results? haertig Linux - Software 2 03-02-2006 02:26 PM


All times are GMT -5. The time now is 10:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration