8

How does one do that? Is there not any way of saving one's backups up to a directory other than the default one? Such as, for example, an external drive?

muru
  • 197,895
  • 55
  • 485
  • 740
Fiksdal
  • 2,121

2 Answers2

5

UPDATED ANSWER:

The hard drive you want to use as a backup device must have one of the following filesystems:

  • ext2/3/4
  • reiserfs
  • reiser4
  • xfs
  • jfs
  • btrfs
  • luks

If that's the case, it will show up in the backup devices list in the GUI of timeshift and/or it's possible to add it via --backup-device on the cmdline.

OLD ANSWER:

You need your filesystem to be compatible to the backed up system. So let's say you have an ext2/3/4 formatted Ubuntu filesystem. You need to format the backup filesystem (e.g. your external HD) to ext2/3/4.

I am not sure which are all the working combinations in the end, but this will definitely do always:

Ubuntu (extX) -> External Drive (extX) - Where X is {2,3,4}

After you formatted your external drive with the correct filesystem (e.g. with exactly the same filesystem as your Ubuntu partition), the new backup drive will show up as one of the options in the GUI of timeshift.

EDIT (Background information):

The true answer lies in these lines (Main.vala):

public Device? get_device_from_name(Gee.ArrayList<Device> device_list, string device_name){
    foreach(Device pi in device_list) {
        if (!pi.has_linux_filesystem()) { continue; }
....

Here you can see a function from Timeshift sources. -> While iterating through the possible devices, those that have not a Linux filesystem will be excluded from possible backup devices.

Another source file provides us with what is defined as Linux_filesystem in Timeshift (Utility.vala:633ff):

public bool has_linux_filesystem(){
        switch(type){
            case "ext2":
            case "ext3":
            case "ext4":
            case "reiserfs":
            case "reiser4":
            case "xfs":
            case "jfs":
            case "btrfs":
            case "luks":
                return true;
            default:
                return false;
        }
    }
Jan
  • 1,193
  • 11
  • 11
1

I was able to set it up using a disk image on an the network share, then format that image as ext4, then mount it, which gives us a blkid!

Below are the details of how I did it:

#for a 15 gb drive (15Megabytes x 1024 = 15GB)
sudo dd if=/dev/zero of=/mnt/path/to/network/share/timeshift.img bs=15M count=1024

#format the partition as ext4 sudo mkfs.ext4 /mnt/path/to/network/share/timeshift.img

#create a mount point for your new drive sudo mkdir /mnt/timeshift_parition_mount_point -p

Next set up a systemd mount file in /etc/systemd/system/

[Unit]
Description=Timeshift partition mount service
After=remote-fs.target

[Mount] What=/mnt/path/to/network/share/timeshift.img Where=/mnt/timeshift_parition_mount_point Type=ext4 Options=defaults,loop,_netdev,auto

[Install] WantedBy=multi-user.target

Note: it must be named "mnt-timeshift_parition_mount_point.mount" to match your mount point (any /'s get converted to -'s)

#Next enable it, so it gets mounted at boot:
sudo systemctl enable mnt-timeshift_parition_mount_point.mount

sudo systemctl start mnt-timeshift_parition_mount_point.mount

#get the blkid of your new partition you created blkid | grep loop

sudo vi /etc/timeshift.json #and edit the "backup_device_uuid" to match the blkid of your newly mounted partition

Note: if you need to copy your timeshift backups from the old location, I find this works best:

sudo cp /old/timshift/directory/timeshift /mnt/timeshift_parition_mount_point/ --preserve=links -R
Jared
  • 351