Safely Moving Timeshift

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ovrflo
Level 3
Level 3
Posts: 110
Joined: Sat Feb 25, 2017 3:12 pm

Safely Moving Timeshift

Post by ovrflo »

Background:

To keep /home as small as possible and for ease of maintenance, I put most of my user data on a separate volume /mnt/hd/user, and then symlink Documents, Downloads, Pictures, etc to a directory on /mnt/hd/user. I am currently using Timeshift and it puts it's data on /mnt/hd/timeshift.
/mnt/hd/ is getting full, and I have just added a new empty drive to the system that I would like to use exclusively for Timeshift. (I may put some Back in Time data on this drive as well later-at the moment all that data is on a network share.)

System: Linux Mint 18.3 - Timeshift v17.11

Questions:
  1. Can I move a Timeshift backup to another drive and continue adding to that backup set after the move?
  2. How is the safest way to move the data to the new drive? rsync? If so what options do I need, I've never worked with hardlinks and am afraid of screwing it up.
  3. Does it matter where in the filesystem should I mount the new drive? Suggestions?
Thanks in advance for any assistance you can offer. I have seen similar questions, mostly about USB drives, but nothing that matches my use case closely enough that I can be sure of what to do.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Safely Moving Timeshift

Post by pbear »

What I would do is start saving snapshots to the new location, then about a month from now, delete all the old ones at the current one. If you're pressed for space on the current drive, you could free some space by weeding out as many of the current snapshots as makes sense. For that matter, 18.3 is a stable version receiving only security updates. Would be perfectly reasonable to save a snapshot to the new location and delete all the old ones now.

What I don't know is whether copied snapshots restore correctly. My hunch would be yes, but that's just a SWAG.
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

There is nothing magical about Timeshift. It saves all the snapshots in a root-owned directory "/timeshift" on the partition you have set in timeshift settings->location menu . In that directory, tha snapshots are in subdirs. These snapshots are based on rsync.

So, you can simply move (OR COPY FOR SAFETY'S SAKE !) the directory to another partition, Then point timeshift to that new partition in the timeshift settings->location menu. It will continue as if nothing was changed. Tested on two USB-sticks. works OK.

This way, you can also use one external hdd to save snapshots of different sytems:
- make snapshot of system 1 on external usb drive
- rename timeshift directory on external usb drive to some other name like "timeshift_system_1"
- make timeshift snapshot of system 2 on same external usb-drive.
- rename timeshift directory on external usb drive to some other name like "timeshift_system_2"

To restore, rename one of these dirs back to "timeshift", the start timeshift program.

Only thing to remember is that timeshift ALWAYS uses directory "timeshift" in root of the partition you told it to use. You can rename or copy this directory as- and however you want, but if you want timeshift to use it, it has to be "/timeshift" on the partition you use.
You will need root-priviliges to copy/move timeshift directory.


Robert
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Safely Moving Timeshift

Post by pbear »

TI58C wrote: Fri Aug 23, 2019 6:12 amTested on two USB-sticks. works OK.
Did this include a test of restore? That really the issue, ISTM.
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

pbear wrote: Fri Aug 23, 2019 11:13 am
TI58C wrote: Fri Aug 23, 2019 6:12 amTested on two USB-sticks. works OK.
Did this include a test of restore? That really the issue, ISTM.
You are of course correct.

I did test so far as to select copied snapshot and click "restore". Got the expected timeshift window "restore snapshot (as superuser)" with bold "select target device". The pre-selected "target device" was also correct. That was confirmation enough that snapshot correctly recognized the copied snapshot. Did not actually restore my system as it was working perfectly.

Still, I am confident enough to use what I wrote in this thread myself.

Again, nothing "magical" about timeshift. Basically it is just an rsync backup with very cleverly pre-programmed --include and --exclude statements.

Robert

BTW: after copying timeshift dir to other USB-stick, creating new timeshift snapshots works perfectly. THIS I DID TEST. Also the newly created snapshots used hard-links for files that were in previous snapshot (before making copy on other device) as expected. THIS I DID TEST / CHECK using ncdu.
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Safely Moving Timeshift

Post by pbear »

TI58C wrote: Fri Aug 23, 2019 12:00 pmThe pre-selected "target device" was also correct. That was confirmation enough that snapshot correctly recognized the copied snapshot.
Fair enough. Whether it would remember where it was supposed to go is indeed what I was wondering also.
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

Could not find any kind of file in the timeshift dir that saves the preferred "target device". So my bet is that Timeshift saves that info somewhere in a conf or ini file.

Will check what happens if I try to restore after boot from live-usb (without actually overwriting system). I suspect I will have to select target device then.

Robert
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
User avatar
JerryF
Level 16
Level 16
Posts: 6571
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: Safely Moving Timeshift

Post by JerryF »

ovrflo wrote: Tue Aug 20, 2019 2:00 pm ...
Questions:
  1. Can I move a Timeshift backup to another drive and continue adding to that backup set after the move?
  2. How is the safest way to move the data to the new drive? rsync? If so what options do I need, I've never worked with hardlinks and am afraid of screwing it up.
  3. Does it matter where in the filesystem should I mount the new drive? Suggestions?
Thanks in advance for any assistance you can offer. I have seen similar questions, mostly about USB drives, but nothing that matches my use case closely enough that I can be sure of what to do.
I needed to do that too (I don't have links) and it worked. First, I used a live USB to move the previous timeshift folder to the new disk in its root (no subdirectory). I used the file manager.

Then rebooted to my installed system and opened Timeshift then changed the location of where to store the backups (the new disk) and it recognized all the restore points and I was able to restore the last backup point with no problem.
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

JerryF wrote: Sat Aug 24, 2019 11:16 am
I needed to do that too (I don't have links) and it worked. First, I used a live USB to move the previous timeshift folder to the new disk in its root (no subdirectory). I used the file manager.

Then rebooted to my installed system and opened Timeshift then changed the location of where to store the backups (the new disk) and it recognized all the restore points and I was able to restore the last backup point with no problem.
Hi Jerry F,

Thanks! good to hear a confirmation. Experiment by 2 people is worth a lot more than just one.


Robert
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
ovrflo
Level 3
Level 3
Posts: 110
Joined: Sat Feb 25, 2017 3:12 pm

Re: Safely Moving Timeshift

Post by ovrflo »

Thanks very much for the replies, I need just a bit more help to finish this;

I have mounted the extra drive at /BACKUP, and the original Timeshift data is at /mnt/hd/timeshift. I executed the command:

cp -av /mnt/hd/timeshift /BACKUP

to copy the data.

Have I used the correct options?

I went into the settings and changed the location to the new drive, and it seemed to pickup the dataset.

I did a BROWSE, and it looked at quick inspection like things were working OK.

I did a du just to compare the copy, and I get slightly different answers.

Code: Select all

# du -d1 /BACKUP/timeshift
4       ./snapshots-daily
4       ./snapshots-weekly
4       ./snapshots-hourly
4       ./snapshots-monthly
94787620        ./snapshots
4       ./snapshots-boot
4       ./snapshots-ondemand
94787648        .

Code: Select all

# du -d1 /mnt/hd/timeshift
4       ./snapshots-daily
4       ./snapshots-ondemand
4       ./snapshots-boot
4       ./snapshots-hourly
4       ./snapshots-weekly
94788628        ./snapshots
4       ./snapshots-monthly
94788656        .
How can I determine what the difference is? I am wondering if just opening Timeshift created a small (but not significant) change, or maybe it is due to a difference in disk type between the original backup and the copy.

Can someone please tell me how I can verify what the exact differences are?

My current system disk is 3TB, but only has about 150GB on it. I would like to test my ability to restore by swapping that for a 240GB SSD, booting from a live CD and running Timeshift. Can I restore to a smaller disk as long as there is enough space, or does the target disk for the restore need to be the same size or larger than the original disk?

I should mention that when the system was initially installed, not really knowing what I was doing I installed with LVM on an encrypted volume. Here is the relevant part of /etc/fstab:

Code: Select all

/dev/mapper/mint--vg-root                       /               ext4    noatime,errors=remount-ro       0       1
# /boot was on /dev/sda2 during installation
UUID=8672d6b2-7076-4d7e-8c87-0b6e2f613e55       /boot           ext2    defaults                        0       2
# /dev/mapper/mint--vg-swap_1                   none            swap    sw                              0       0
UUID=c8ba0e21-1ca0-4b70-9bcc-6dee31d10b79       none            swap    sw                              0       0
I'm happy to either leave the LVM/encryption or remove it. I would just like to be able move my installation to an SSD (and at the same time validate that I can restore my system with Timeshift). I am perfectly fine using GParted partition the SSD as required.

I have some user data in /home, but mostly the stuff that gets created in "dot" files, and .config, and ~/Desktop. I have replaced folders like /Documents /Downloads etc with symlinks to 2 other volumes, 1 single ext4 HD, and a ZFS Mirror depending on the importance of the data.

Any guidance would be much appreciated.
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

Hi ovrflo,

Although I would not use cp for that purpose, your "cp -av" should be ok. Does preserve everything like permissions etc.

The diferences in sizes are very small. Would not worry about that too much. But... checking is always better.
I would use grsync to do that.
- select one timeshift dir as source, one as target;
- tab basic options select all "preserve" checkboxes + verbose
- tab advanced options check "always checksum", "copy symlinks as symlinks" and "protect remote args"

Then do A DRY RUN ! That is the green "i" icon left side of the cog wheel.
Then inspect the log. Small window can be maximized to make reading easier. If the 2 dirs are the same, there should not be too much difference. But am not sure if cp -av will for instance change time-stamps.

Do not know anything about LVM or encrypted volumes, so maybe I'm making the wrong assumption that, once opened, there should not be a difference to a normal volume ???

If your system hdd now ony uses 150G, it should be perfectly possible to use timeshift to move system. Timeshift only copies linux system files +mbr , and does not function like clonezilla which can only restore to same-size or bigger volume.
BUT: Restoring Timeshift from your old hdd to new ssd, will (over)write your /etc/fstab and your /boot directory, including grub.
In your case that means that after restoring timeshift image, fstab will be set up for your "big" , encrypted LVM hdd, not small ssd !

I have restored timeshift image from one machine to another, using these steps:
- make timeshift image of machine A (this time including home)
- do fresh install on machine B (do not bother with updates as timeshift makes that unnecessary)
- save /etc/fstab and total boot dir of machine B on external disk
- restore timeshift image from machine A on machine B. I did uncheck the mbr/grub restore options, as I did not want the partition table in
the mbr to be changed. Maybe a good idea to make backup of mbr of your ssd using something like this (adapt to your needs) :

Code: Select all

sfdisk -d /dev/sda > /home/rob/partition_table_backup_sda_compaq_6730
- restore the saved /etc/fstab and boot dir on machine B again (these were overwritten by timeshift)

Procedure should be the same going from hdd to ssd. Read machine A as hdd and machine B as sdd. I can only say anything about mbr-type systems, as I do not have UEFI-type system. If you do, you have some additional googling to do but the situation is alike. Make sure timeshift does not mess up your mbr/uefi boot record or partition table !!!

Disclaimer: I'm no guru and all three machines were old mbr-style. If I've been lucky, and should have done something different, I hope more experienced forum members will correct me or give additional steps.

Again, concerning LVM and encrypted volume, I may be totally wrong !

Good luck,

Robert

PS: buy a cheap USB-case for that 3TB drive. Once you are VERY sure your ssd-system is functioning well, it'll make a nice backup-drive.
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

JerryF wrote: Sat Aug 24, 2019 11:16 am I needed to do that too (I don't have links) .......
Hi JerryF,

missed it the first time I read your post. Or I misuderstand. You DO have links ! Timeshift creates hard-links to files that are already in the previous snapshot. This saves both time and space.

Open terminal in a timeshift snapshot directory and find them with:

Code: Select all

find . -type f -links +1 -printf '%i %n %p\n'
Load of them...

Robert
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
User avatar
JerryF
Level 16
Level 16
Posts: 6571
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: Safely Moving Timeshift

Post by JerryF »

TI58C wrote: Sat Aug 31, 2019 7:06 am
Hi JerryF,

missed it the first time I read your post. Or I misuderstand. You DO have links ! Timeshift creates hard-links to files that are already in the previous snapshot. This saves both time and space.

Open terminal in a timeshift snapshot directory and find them with:

Code: Select all

find . -type f -links +1 -printf '%i %n %p\n'
Load of them...

Robert
I misunderstood when ovrflo said:
How is the safest way to move the data to the new drive? rsync? If so what options do I need, I've never worked with hardlinks and am afraid of screwing it up.
I thought the hard links ovrflo mentioned were ones created for something else. I didn't realize it was the Timeshift hard links that were the concern.

Thanks Robert.
ovrflo
Level 3
Level 3
Posts: 110
Joined: Sat Feb 25, 2017 3:12 pm

Re: Safely Moving Timeshift

Post by ovrflo »

Does anyone know if I can restore to a smaller drive given the situation described above?
TI58C
Level 4
Level 4
Posts: 389
Joined: Tue Jul 18, 2017 5:57 am

Re: Safely Moving Timeshift

Post by TI58C »

Hi ovrflo,

Didn't this :
TI58C wrote: Sat Aug 31, 2019 6:36 am If your system hdd now ony uses 150G, it should be perfectly possible to use timeshift to move system. Timeshift only copies linux system files +mbr , and does not function like clonezilla which can only restore to same-size or bigger volume.
BUT: Restoring Timeshift from your old hdd to new ssd, will (over)write your /etc/fstab and your /boot directory, including grub.
In your case that means that after restoring timeshift image, fstab will be set up for your "big" , encrypted LVM hdd, not small ssd !
answer your question ? Short answer: Yes, but you have to take some extra steps as outlined above. If you need extra info, could you explain what was not clear ?

Robert
Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.
Locked

Return to “Beginner Questions”