Timeshift snapshots

Questions about applications and software
Forum rules
Before you post please read how to get help
Locked
whois1230
Level 3
Level 3
Posts: 174
Joined: Mon Aug 28, 2017 5:35 am

Timeshift snapshots

Post by whois1230 »

Hi, I'm wondering if I should keep all my timeshift snapshots or only leave the latest one, considering my system is running smoothly now. I think the earlier snapshots only waste hard disk space, but I could possibly be wrong. Any advice?
MintBean

Re: Timeshift snapshots

Post by MintBean »

Snapshots share components that haven't changed between them to conserve space, so it might not waste as much storage as you guess. That said, I have a clean out from time to time and only keep the latest. If it's been running fine for a couple of days there's no reason to keep older ones.
User avatar
slipstick
Level 6
Level 6
Posts: 1048
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: Timeshift snapshots

Post by slipstick »

In the settings menu, if you set the number of backups to keep, it will automatically delete the snapshots that are older. The only exception is the on-demand snapshots which will be kept until manually deleted. It might be useful to have some older snapshots, just in case there was a problem (possibly due to an update) that wasn't obvious and wasn't noticed for some time.
In theory, theory and practice are the same. In practice, they ain't.
User avatar
AZgl1500
Level 15
Level 15
Posts: 5563
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: Timeshift snapshots

Post by AZgl1500 »

I make a Baseline and never delete that one, because it contains a full copy of all the System files.

then I keep major updates via Manual and write in something that is meaningful.

I let AutoUpdate take care of the rest..... and only keep 3 daily updates, that is all I need.

all of the updates since the very last one, take up so little extra space, as to be totally unnoticeable in NEMO.
I forgot to write down the original gB left, but it is not much different than when I started.

do NOT erase them, you will cause more problems than the meagre disk space you think you save.
Take a look at the two pages, over two months of updates, and there is NO DIFFERENCE is how much disk space has been used.


this is the first page:
Timeshift.png

and this is the last page:


Image


you need to heed what the previous poster said:
" you need to keep some of the older snapshots "

I keep all of the Manual Backups, unless I did something that I don't like.

I make a backup just prior to a major install, name it:
then a make a backup after that major install, and name that:

and if the new fantastic piece of crap is just that, I delete the AFTER backup, and restore the PRIOR backup.
wallah, Piece of crap is gone.
worst comes to worst, I can go back to Day one....
Linux Mint 19.3 Cinnamon
whois1230
Level 3
Level 3
Posts: 174
Joined: Mon Aug 28, 2017 5:35 am

Re: Timeshift snapshots

Post by whois1230 »

How can I copy my snapshots on an external hard disk or USB? I want to reinstall Mint, encrypt my OS, and have the same programs and settings, but with a newer version of Mint.
User avatar
lsemmens
Level 11
Level 11
Posts: 3546
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Timeshift snapshots

Post by lsemmens »

I understand the reasoning behind timeshift. My question is a little more newbie, than that. Does timeshift also work as a backup program or is it ONLY for system snapshots? If that is all, then, given the stability of my system, and the fact that I'm not afraid of blowing it all away and starting again if I stuff summat up, is there any advantage to it?
Fully mint Household
Out of my mind - please leave a message
MintBean

Re: Timeshift snapshots

Post by MintBean »

AZgl1500 wrote:
Sat Jul 14, 2018 5:38 pm
I make a Baseline and never delete that one, because it contains a full copy of all the System files.
That's true, but EVERY snapshot contains a full copy of all the system files so you're quite safe to delete the original. A hard link to a file (which is what snapshots use to refer back to an earlier copy of a file that hasn't changed) is as good as the original file. You can delete the original and the hard link still retains the file. The actual data is not destroyed/lost until all hard links to it have been deleted. In fact, any file on an EXT4 partition is just a block of data with a hard link to it.

Still it's not a bad idea to keep a few snapshots for reasons previously mentioned.

To backup snapshots, copy the Timeshift directory to an EXT4 formatted backup disc. (Assuming you aren't running a BTRFS filesystem).
MintBean

Re: Timeshift snapshots

Post by MintBean »

Timeshift can be used to back up your user data (music, movies etc) but doesn't by default. There's a good reason for this - if an update borks your system, you want to be able to roll back the system WITHOUT reverting changes to your user files - like that document you've just spent a bunch of time updating.

If you're not bothered by reinstalling, you've no need of Timeshift- but you do need some means of backing up your user data,
gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: Timeshift snapshots

Post by gm10 »

lsemmens wrote:
Sun Jul 15, 2018 8:34 am
I understand the reasoning behind timeshift. My question is a little more newbie, than that. Does timeshift also work as a backup program or is it ONLY for system snapshots? If that is all, then, given the stability of my system, and the fact that I'm not afraid of blowing it all away and starting again if I stuff summat up, is there any advantage to it?
Timeshift can take snapshots of any data you want, theoretically you can use it to only back up your personal data. But it's really designed around restoring the system itself so another tool might be the better choice here.

Whether it has an advantage for you is up to you. Restoring a snapshot is certainly faster than starting over and/or trying to fix a problem manually. But maybe that's exactly the experience you are after. Up to you. :) Also Timeshift/rsync style backups aren't the only option for such a restore - I still like to keep a partition image around, for example, but those don't offer the incremental backups you get with rsync.
User avatar
lsemmens
Level 11
Level 11
Posts: 3546
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Timeshift snapshots

Post by lsemmens »

Thanks for that explanation, it works just as I imagined. I'm happy to work without it because any critical data is backed up off line anyway.
Fully mint Household
Out of my mind - please leave a message
User avatar
slipstick
Level 6
Level 6
Posts: 1048
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: Timeshift snapshots

Post by slipstick »

MintBean wrote:
Sun Jul 15, 2018 8:45 am
To backup snapshots, copy the Timeshift directory to an EXT4 formatted backup disc. (Assuming you aren't running a BTRFS filesystem).
If you just copy the TS directory, I think you will end up with multiple copies of most of the data, because each snapshot looks like a complete system backup - in other words, you lose the advantages of the hard-link structure. Your copied directory would be much larger than the original.

What I do is keep snapshots on my internal HD (monthly, weekly, daily, boot, on-demand, but not hourly). Then every day or two, I plug in my external USB drive and run a script file that uses rsync to back up the snapshots from my internal drive to the USB drive. The script file takes a long time to run (20-30 minutes) but seems to work and keeps all the links intact. Here is the script I use, which I launch from a launcher I made on my desktop:

Code: Select all

#!/bin/bash
#update timeshift backup on external drive from snapshots on internal HD

sudo rsync -aAuHXvis --progress --delete --numeric-ids /media/root/LM18_timeshift/ /media/steve/Z97_LM_Backup/LM18.3_timeshift_backup/timeshift | tee ~/timeshift_backup_log

echo "Finished updating timeshift backup"

sleep 10
exit 0
It starts by deleting all the snapshots from the USB drive that are not on the internal HD, then there is a long pause (10-15 minutes) with nothing apparently happening except for the blinking LED on the the USB drive, then it copies the new snapshots from the internal HD to the USB drive. You would need to change the source and destination in the rsync statement to match your system. It also keeps a log file in my home directory, which is not necessary and takes up a lot of room, but I like to have it to review. If you don't want it, just remove the "| tee ~/timeshift_backup_log" part of the command.
In theory, theory and practice are the same. In practice, they ain't.
MintBean

Re: Timeshift snapshots

Post by MintBean »

slipstick wrote:
Sun Jul 15, 2018 1:05 pm
If you just copy the TS directory, I think you will end up with multiple copies of most of the data, because each snapshot looks like a complete system backup - in other words, you lose the advantages of the hard-link structure. Your copied directory would be much larger than the original.
On second thought, right you are.

Aside from rsync, there are some other ways to preserve hardlinks when copying, according to this. That said I think your rsync solution would be my preference.
kingpin001
Level 1
Level 1
Posts: 2
Joined: Mon Aug 10, 2020 5:12 am

Re: Timeshift snapshots

Post by kingpin001 »

slipstick wrote:
Sun Jul 15, 2018 1:05 pm
MintBean wrote:
Sun Jul 15, 2018 8:45 am
To backup snapshots, copy the Timeshift directory to an EXT4 formatted backup disc. (Assuming you aren't running a BTRFS filesystem).
If you just copy the TS directory, I think you will end up with multiple copies of most of the data, because each snapshot looks like a complete system backup - in other words, you lose the advantages of the hard-link structure. Your copied directory would be much larger than the original.

What I do is keep snapshots on my internal HD (monthly, weekly, daily, boot, on-demand, but not hourly). Then every day or two, I plug in my external USB drive and run a script file that uses rsync to back up the snapshots from my internal drive to the USB drive. The script file takes a long time to run (20-30 minutes) but seems to work and keeps all the links intact. Here is the script I use, which I launch from a launcher I made on my desktop:

Code: Select all

#!/bin/bash
#update timeshift backup on external drive from snapshots on internal HD

sudo rsync -aAuHXvis --progress --delete --numeric-ids /media/root/LM18_timeshift/ /media/steve/Z97_LM_Backup/LM18.3_timeshift_backup/timeshift | tee ~/timeshift_backup_log

echo "Finished updating timeshift backup"

sleep 10
exit 0
It starts by deleting all the snapshots from the USB drive that are not on the internal HD, then there is a long pause (10-15 minutes) with nothing apparently happening except for the blinking LED on the the USB drive, then it copies the new snapshots from the internal HD to the USB drive. You would need to change the source and destination in the rsync statement to match your system. It also keeps a log file in my home directory, which is not necessary and takes up a lot of room, but I like to have it to review. If you don't want it, just remove the "| tee ~/timeshift_backup_log" part of the command.
Have you tested restore using your external hard drive?

I'm testing restore on a VirtualBox. First used clonezilla to restore my base clonezilla image to a virtualbox machine. Then used your script to copy first ever timeshift backup snapshot (held on shared directory) from host to virtualmachine.

Checked directory size of both snapshots. I noticed a slight difference in size. So it seems some files were not copied across. Actually, while the copying was going ahead I noticed some 'Operation not permitted (1)' errors for some files. (strange as I'm running script as root)

Anyway, after the script completed. I did the timeshift restore. Rebooted. But the virtualbox machine got to starting network then came up with press 'Ctrl-D' to drop to root shell.
When I entered root password, it would not accept root password.

Luckily, I kept a copy of the VirtualBox machine, so dumped the current box, copied the files across of the copy box.

I was backup (pun intended) and running to square one..

Then I tried tarring the snapshot. So:

Code: Select all

sudo tar -cvf 2020-08-06_13-00-01.tar 2020-08-06_13-00-01
while in the /timeshift/snapshots directory.

then started the virtualbox.

copied the tar file to the /timeshift/snapshots directory on the virtualbox machine.

Untar tar file within the snapshots directory.

Start timeshift, then do restore. When the virtualbox restarted it gave an error and asked 'do you want to halt' hit 'ok' or 'continue'

Hit 'Ok'. Box shutdown. Restarted box again.

This time it was trying to mount a partition which didn't exist on the virtualmachine. Fair enough, because it was unique to the host machine.
So, I edit fastab and comment out the line mounting that partition. Save file then reboot.

Back in to KDE no probs.

I'm now testing restoring using a 3,4,5 th timeshift snapshot without first restoring base snapshot. Just in case the later timeshift snapshots rely on the base snapshot. I want to be sure it doesn't.

Will post back how it goes.
kingpin001
Level 1
Level 1
Posts: 2
Joined: Mon Aug 10, 2020 5:12 am

Re: Timeshift snapshots

Post by kingpin001 »

kingpin001 wrote:
Mon Aug 10, 2020 5:40 am
slipstick wrote:
Sun Jul 15, 2018 1:05 pm
MintBean wrote:
Sun Jul 15, 2018 8:45 am
.......
I'm now testing restoring using a 3,4,5 th timeshift snapshot without first restoring base snapshot. Just in case the later timeshift snapshots rely on the base snapshot. I want to be sure it doesn't.

Will post back how it goes.
I've restored Clonezilla base image from 10 July 2020 (taken just after installing the O/s), then restored the latest timeshift snapshot taken at 4:00pm today using the method above. i.e. tarring that specific snapshot directory then tar extracting to the virtual machine /timeshift/snapshot directory.

All the applications I've installed up to now have been restored. Everything seems okay.

Of course, none of my favorites on KDE desktop or browser bookmarks are there. This is expected though, because I haven't restored the /home directory. I'm using a separate backup application for backing up /home directory.
User avatar
MrEen
Level 22
Level 22
Posts: 16571
Joined: Mon Jun 12, 2017 8:39 pm

Re: Timeshift snapshots

Post by MrEen »

Hi kingpin001,

You're replying in a topic that hasn't been active for a couple of years. As it looks like you've mostly figured out what you're doing, I'll leave the posts here, but lock the topic. If you have any more questions, please start a new thread, linking back to this one if necessary.

Thanks.
Locked

Return to “Software & Applications”