#413 Issue closed: LVM Snapshots supported?

Labels: discuss / RFC, support / question, needs sponsorship

X4 opened issue at 2014-05-15 12:29:

Hi,

this project really looks very exciting! I'm having an LVM setup. Are LVM snapshots supported?

jhoekx commented at 2014-05-15 14:04:

They are currently not supported.

How would you envision support? I don't really know what I would do with them in a DR case. How would you expect a file level backup to restore your snapshot? Can you provide a scenario?

X4 commented at 2014-05-20 01:54:

Scenario:
LVM-Snapshots were made by a rear cronjob and synced with a storage.
System is messed up.
I can now choose the time that I want to go backwards to, thanks to the snapshots (if there was a good backup-scheme provided by a rear-cronjob or systemd-service)

schlomo commented at 2014-05-20 06:37:

So you want to use LVM snapshots to create a consistent (in time) backup?
How much space do you have on your backup NAS share? How should the backups
be made?

On 20 May 2014 03:54, Ferhat notifications@github.com wrote:

Scenario:
LVM-Snapshots were made by a rear cronjob and synced with a storage.
System is messed up.
I can now choose the time that I want to go backwards to, thanks to the
snapshots.


Reply to this email directly or view it on GitHubhttps://github.com/rear/rear/issues/413#issuecomment-43578881
.

X4 commented at 2014-05-21 00:51:

About 500GB on the NAS. LVM-Snapshots don't consume a lot of space, because they're updating node-pointers for the hard-links [1]. I think deduplication and probably also incrementing using deltas is not available for LVM snapshots. But if we use a simple incremental backup-scheme that branches out if a threshold is reached, then there won't space much wasted and you can retrieve files that are much older, than what you'd have with Tower of Hanoi or FIFO.

I think most users would only care for their /home directory, so do I. But rear makes it really easy to also recover the system. My /home is 182GB with 6,7GB available and / is only 42GB with 14GB available.

There are projects like http://opendedup.org/ (which I've not used yet) for those who suffer from a lot of duplicates (enterprises mainly).

gdha commented at 2014-12-24 13:30:

@X4 I really do not see how we could make this work in rear? Rear is a bare-metal DR solution and you are mainly talking about restoring using LVM snapshots.

bbeaver commented at 2014-12-29 19:00:

There is another open source product named mylvmbackup, that basically will quiesce mysql databases and then snap the LVM filesystem mysql resides on. I'm looking into incorporating mylvmbackup with ReaR. But not for the purpose of being able to choose from multiple snapshots during a restore, for the purpose of quiescing my LVM filesystems before ReaR comes along and backs them up.

gdha commented at 2014-12-29 19:27:

@bbeaver interesting http://www.lenzg.net/mylvmbackup/ link indeed. Looking forward to the pull request...

bbeaver commented at 2014-12-30 13:11:

Sure thing, happy to contribute if I can get this done. The goal would be to integrate LVM snapshots into ReaR such that ReaR picks up a time consistent, quiesced LVM filesystem as part of it's backup. Here are my initial thoughts - first scenario is, ReaR is setup to do tar backups to a central NFS server. ReaR gets kicked off, and before the tar system backup is initiated, mylvmbackup or some form of mylvmbackup is called. mylvmbackup will quiesce the LVM volume and it wants a path for writing it's tarfile. This path would be the NFS target used by ReaR. mylvmbackup does the LVM snap, temporarily mounts the snapped filesystem, writes out it's tarfile, removes the LVM snapshot, and turns over control back to ReaR. ReaR is configured to exclude the LVM filesystem already picked up by mylvmbackup. The restore procedures would need to be modified as well. During a ReaR restore, ReaR would need to know how to extract the mylvmbackup tar file to an alternate directory, (making use of tar options such as -C /target/directory --strip-components=1). A bonus would be for mylvmbackup to also make use of the (tar --newer) option as ReaR does such that it can take advantage of the incremental option. Welcome thoughts on this - thanks, Brian

gdha commented at 2015-08-07 09:16:

@bbeaver Stumbled over this issue - what shall we do with it?

X4 commented at 2015-08-21 00:55:

I think the most usable solution for @gdha and @bbeaver would be in adding Pre/Post and Event based conditions to ReaR. ReaR could then run custom programs and run/pause/skip based on the return code provided.

Example: Shutdown computer on complete. Or send email on failure/success && shutdown computer.

schlomo commented at 2015-08-21 08:47:

ReaR already allows dropping Bash scripts into /usr/share/rear/*to extend the different stages as needed. I would hope that this is enough, or do you need something different?

You could easily create a rear-mylvmbackup package that adds some files to the ReaR script collection so that those added scripts will be called as part of the regular ReaR execution. Thereby providing the glue between ReaR and mylvmbackup.

This holds true for almost any other extension as well. Of course we are also happy to accept mylvmbackup support as a pull request, if somebody wants to contribute it to ReaR.

X4 commented at 2015-08-22 20:30:

Thank you @shlomo 👍 I'm already perfectly fine with what ReaR provides, I was just curious back then if LVM was supported.

DEvil0000 commented at 2020-12-21 14:01:

Just come accress this ticket since I am looking for the same feature.
using LVM snapshot feature (optinally per LVM volume) while doing the backup is a great thing to create consistent or kind of in sync backups.
Looks like this is still open - correct?

gdha commented at 2021-01-25 13:27:

@DEvil0000 Yes - the feauture is still open. I've added the label "needs sponsorship" - if you are capable of providing such feature you are most welcome ;-)


[Export of Github issue for rear/rear.]