LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Once Off Point in time snapshot (https://www.linuxquestions.org/questions/linux-software-2/once-off-point-in-time-snapshot-4175632516/)

SedAwk 06-23-2018 07:13 AM

Once Off Point in time snapshot
 
Hi,

https://www.centos.org/docs/5/html/C...t_command.html

Only shows how to create a lvm snapshot that continues to grow. How can I create a once-off kind of point-in-time snapshot that I can save as a backup?

Thanks in advance

syg00 06-24-2018 03:36 AM

A snapshot *IS* point-in-time.
The reason it keeps growing is that as the source is updated, the "pre-update" blocks are copied to the snap to ensure the P-i-T consistency. Snaps are not a good backup in themselves, but they are a superb source for a backup. What I do is take a snap then copy that off at my leisure to some permanent backup media. Then the snap can be deleted to stop it continually consuming (more) space.
Snaps have to be managed, but they are the best thing for data consistency.

SedAwk 06-24-2018 12:05 PM

Quote:

Originally Posted by syg00 (Post 5871252)
A snapshot *IS* point-in-time.
The reason it keeps growing is that as the source is updated, the "pre-update" blocks are copied to the snap to ensure the P-i-T consistency. Snaps are not a good backup in themselves, but they are a superb source for a backup. What I do is take a snap then copy that off at my leisure to some permanent backup media. Then the snap can be deleted to stop it continually consuming (more) space.
Snaps have to be managed, but they are the best thing for data consistency.

Thank you very much, I am well aware of the reason why it is growing. I was just hoping I can get an exact copy of what it looked like at a specific time, like just before I made a change to.
I found the following:
lvcreate -L 1GB -s -n My-ROOT_snap /dev/vg_root/root

I will see if this one is the growing type too.

TIA

syg00 06-24-2018 06:15 PM

Quote:

Originally Posted by SedAwk (Post 5871399)
I was just hoping I can get an exact copy of what it looked like at a specific time, like just before I made a change to.

That is exactly what a snap does. Maybe you need to read up on how copy-on-write works - perhaps think of it as a de-dup for your original data and any snaps.
When you reference the data in a snap, unchanged blocks are retrieved from the original data, while changed blocks are read from the snap itself. All the data are as they were at the time of the snap. This is why I can use a snap as a source for a backup - and it doesn't when I actually do the backup.
I don't use LVM snaps but btrfs, but conceptually they are similar in effect. I regularly take a snap before I work on my photos - if I screw up I revert to the snap and all my (bad) changes are gone. Else if I'm happy with the work, I simply delete the snap. Maybe you are hoping to do similar.

SedAwk 06-25-2018 12:59 PM

Quote:

Originally Posted by syg00 (Post 5871519)
That is exactly what a snap does. Maybe you need to read up on how copy-on-write works - perhaps think of it as a de-dup for your original data and any snaps.
When you reference the data in a snap, unchanged blocks are retrieved from the original data, while changed blocks are read from the snap itself. All the data are as they were at the time of the snap. This is why I can use a snap as a source for a backup - and it doesn't when I actually do the backup.
I don't use LVM snaps but btrfs, but conceptually they are similar in effect. I regularly take a snap before I work on my photos - if I screw up I revert to the snap and all my (bad) changes are gone. Else if I'm happy with the work, I simply delete the snap. Maybe you are hoping to do similar.

Thank you for that, Syg00 & 5871519 ?

I have a few more questions on this, if you all don't mind...
Linux snapshot scenarios

====================




1) On 1 Jan, create a snapshot of /etc

2) On 2 Jan, change /etc/hosts

3) On 3 Jan, make another change to /etc/hosts

4) On 4 Jan, make a change to /etc/sysconfig/network




Q1) Is it still possible on 6 Jan, to restore /etc/hosts from the lvm snapshot to what it looked like on 1 Jan?

Q2) Which copy of /etc/hosts will be on the system if the snapshot is rolled back on 7 Jan?

Q3) If I send the snapshot across to a different system using dd or scp, what which of the /etc/host versions will arrive on the other system?

TIA


All times are GMT -5. The time now is 12:48 AM.