Some LVM tutorials seem to claim that one take a snapshot of a logical volume (LV), then backup the snapshot using another tool, then remove the snapshot. When the unspeakable happens, the user can restore their LV to the state it was during the backup.

But how can this be? LVM snapshots are "copy on write"; they record changes to the state, not the state itself. If the snapshot is removed and changes are then made to the LV's state, these changes are not recorded; thus, the backup contains an incomplete record of changes to the LV during the attempted merge. So how can one expect their LV to be restored to the state it was during the backup?


I think you missed section '13.4.3. Do the backup'. LVM can be used to take a copy of the data at a point in time so you have a consistent** image of that data. As such, you can then use another tool (eg tar, fbackup etc) to do the actual backup. If you want to use LVM as a backup mechanism in itself, yes you do need to actually keep the LVM snapshot.

** In the example the LVM snapshots appear (from the label) to be databases. Any application or database that is running on LVM should be stopped before taking the snapshot to ensure consistency (unless the database/application has support for LVM backups).

  • The point of the snapshot is that you do not need to stop the database or whatever else is writing to the disk at the time. Backing up the files without snapshots requires this so that you don't have the file changing after you already backed up part of it. With the snapshot, you get a consistent image that when you restore, is no different to the database than if you had suddenly lost power at the moment of the snapshot ( and they already cope with that ). – psusi May 14 '15 at 22:41
  • @psusi - yes it should be ok, would you ever want a backup mechanism that involved effectively crashing your application or database. dba.stackexchange.com/questions/72946/… – DarkHeart May 14 '15 at 22:48
  • According to the link below, LVM does not copy any data until changes are made to the original LV and only the changed data is copied. This implies that a changelog is needed to ensure that we can revert to the original LV's original state. But if we make a backup and then make further changes, we will have an incomplete changelog when we try to revert. Thus, we should expect the revert to fail. wiki.archlinux.org/index.php/LVM#Deactivate_volume_group – romascom May 14 '15 at 23:33
  • I understood that LVM could create backups by itself. I meant to ask whether changing the system's state following the backup and removal of the snapshot logical volume would prevent the backup from being used to restore the system to its state when the snapshot was created. Your answer seems to confirm that this is not the case, so I will accept it. – romascom May 15 '15 at 4:46
  • @romascom, what? Yes, lvm has to keep track of what blocks have been relocated and what have not. This has nothing to do with the backup though. – psusi May 16 '15 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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