How to automatically backup to an external usb disk

What I am trying to do is automatically reboot but instead of booting normally I want the system not make any changes to my hard drive. after that I want it to copy all my files to a partition on an external USB. (in such a way so that I could just cp everything back over and boot from it) and then reboot normally. I also want this to happen once a week at 3 AM.

I don’t know of any software that will do this for you with a simple click or install. The functionality you desire can probably be achieved without tremendous difficulty, but it would certainly involve writing some code and learning how to create and implement systemd units.

The closest thing I can think of in terms of in terms of an “off the shelf” solution is a software package called “timeshift”. It can certainly handle the scheduled backup. I don’t remember all the options it provides, but I do know that it is fairly flexible.

You should also be aware that recovering an os from backup involves a bit more than the use of “cp”. I have run across good instructions/guidelines on various websites as to how to recover a system from a timeshift backup. The short version, you boot a live usb with timeshift installed on it and restore the system from there.

Not exactly what you are looking for, but probably easier than writing your own code.

That is what I would use (probably) if I cared about being able to restore a system from backup.

I see, maybe I will try that. (And keep you posted if you so desire)

Hello again @40476,

Please do let me (us, the forum) know if timeshift works well for you. It is always good to know what needs a given software package successfully addresses.

If you already do not want to boot normally and do not want “any changes to my hard drive” I think you best option is to boot another minimal OS and make the backup, booting a system will already change things on the disk.

If you make this work “by hand”, i.e. where you still have to do everything yourself, you can step by step automate it. First make the “backup OS” make the backup automatically when booting (minimally up), the make it reboot after done. Next make a script to change the default of grub so the “backup OS” can set it back to the “main OS” and the “main OS” can set it when it wants to make a backup.

just tried it, it made a copy just fine, have not tried to restore anything since i dont have a reason to though.

Hello @40476,

I have a similar problem! I have tried numerous back-up strategies over the years for my gnu/linux installs. But NOT one has ever been tested in the real word. I have NEVER actually NEEDED to restore from backup …

:rofl: me too! maybe I will try to restore it to a USB drive and boot from there, maybe!

screenshot of gparted

first partition is main backup, second partition is backup for music.

Hello again @40476,

So the discussion has come full circle. I always make small customizations to the default install, whatever os I am using. I take notes about the changes I make. Reality, even if something disastrous destroyed my system, restoring from backup would not be my first choice. I can re-install an os and implement all my optimizations in under an hour. Whatever backup strategy is my current flavor of the month (I do keep backups, in case the is something in my notes I don’t understand), it would take more time to understand how to restore from backup than to simply reinstall.

But like I wrote earlier. I have never really tested restore from backup, because I have NOT had to. Reinstall gets tested every year when I upgrade my os(es) … I know I can install and customize in under an hour!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.