Hi there,
I just set up timeshift in my two openmediavault machines. I just wanted to describe my process (almost a mini-guide) in case somebody finds it useful. Any comments are welcome!!
Timeshift is a well known software to run a back-up of a running system, with the ability to create snapshots.
On normal desktop machines the program has a very nice and functional GUI for both set-up and restore process.
For an headless system the configuration needs to be performed via CLI, but this is really easy. Similarly, it is possible to revert to a previous snapshot via CLI or using a live distro (e.g. Systemrescue) in case the main system is no longer functional.
1) First thing we need to install timeshift. From terminal run
next we need to write the configuration file
copy and edit the following text in the configuration file:
{
"backup_device_uuid" : "UUID of the disk that will contain the backup files",
"parent_device_uuid" : "",
"do_first_run" : "false",
"btrfs_mode" : "false",
"include_btrfs_home_for_backup" : "false",
"include_btrfs_home_for_restore" : "false",
"stop_cron_emails" : "true",
"schedule_monthly" : "false",
"schedule_weekly" : "true",
"schedule_daily" : "false",
"schedule_hourly" : "false",
"schedule_boot" : "false",
"count_monthly" : "2",
"count_weekly" : "3",
"count_daily" : "5",
"count_hourly" : "2",
"count_boot" : "5",
"date_format" : "%Y-%m-%d %H:%M:%S",
"exclude" : [
"/home/USERNAME/**",
"+ /srv/salt/***",
"+ /srv/pillar/***",
"/srv/**",
"/root/**"
],
"exclude-apps" : []
}
Display More
the content of the file is self explanatory and it closely mimics the GUI parameters that are filled in during the set-up process on a desktop machine.
pay attention to the following
- enter the UUID of the disk that will save the backup files (not the main disk). Saving the files in a disk that is not the main system is highly recommended
- in the exclude section add the home directory for each user in the system
- the include/exclude syntax requires you to add first the directories to include and then the directories to exclude, in this order, see my example with the /srv directory . The other way round fails on my system
- look up the difference between *, ** and ***
Once all this is taken care of, run the following command to make the first snapshot
the command will create the first snapshot and it will create a new cron job /etc/cron.d/timeshift-hourly
every hour the system will run the check command and create snapshots based on the json file
that's it!
to restore the system to a previous snapshot run
and the system will interactively guide you during the task. Alternatively fire up Systemrescue, timeshift is included in the base packages.
as usual:
is your best friend.
Enjoy!
FT