update: safety first!

when it comes to important files: safety comes first

thus recommend to the user that wants to go pro the following backup system:

  • have two complete backups at two different places:
    • backupA: at the company, USB 3.0 (! THE MORE DATA IS BACKED UP THE MORE SPEED IS NEEDED (or restore might take DAYS!)) connected to the server, doing daily incremental backups
    • backupB: being a fire-proof double-metal casing (EMP proof) vault at a different place (home?)
  • change those backups every day if possible otherwise every week
    • if ransomeware destroys backupA then in the worst case scenario, one day or one week of work is gone
    • remember: whatever is physically connected to the server, can be encrypted by ransomeware
  • have the backup strategy tested once a year
    • where the backup is restored completely on a backup-server, to test if all data is there and how long the process takes (USB 2.0 is definitely a massive bottleneck)


a simple file wise rsync based backup of your system (currently without boot partition or boot manager) that:

  • does exclude mountpoints on debian and centos – thus really only backups your internal root partition /dev/sda (probably)
  • automatically creates subdirectory in the structure hostname/year-month-day
  • test if your backup destination exists (cancels backup if not)

NOTE: It would be wise to powerdown the system – boot from IDEAL-Linux-Stick and do a dd wise backup of /dev/sda as well, because this will backup every bit on your root partition including boot partition, boot manager etc. etc.

but because people tend to be lazy and machines hate offline backups, at least do the file wise manual started backups to your external drive that you then (of course) carry home and not leave in the office (where it might get stolen) – so you can sleep well at night.


if it not allready has – label your external drive “BACKUP”:

tune2fs -L "BACKUP1" /dev/sdc1; # label

unplug, plugin… it should be automatically mounted as BACKUP1 under /run/media (CentOS/RedHat) or /media/ (Debian/Ubuntu)

find out where your external backup drive was mounted:

mount|grep BACKUP1
/dev/sdc1 on /run/media/StandardUser/BACKUP1 type ext3 (rw,nosuid,nodev,relatime,seclabel,data=ordered,uhelper=udisks2)

create new script in your script collection directory:

vim /scripts/backup.sh

fill it with:

echo "
   _____ _____   _____ ____   _____ 
  / ____|  __ \ / ____|  _ \ / ____|
 | (___ | |__) | (___ | |_) | (___  
  \___ \|  _  / \___ \|  _ / \___ \ 
  ____) | | \ \ ____) | |_) |____) |
 |_____/|_|  \_\_____/|____/|_____/ 

SimpleRsyncSystemBackupScript v1.0";

# this is where my external drive is mounted without trailing /
DESTstatic=/run/media/StandardUser/BACKUP1 <- MODIFY THIS LINE!

if [ -d "$DESTstatic" ]; then

DEST=$DESTstatic/$(hostname)/$(date +"%Y-%m-%d")
cd $DESTstatic;
mkdir $(hostname);
cd $(hostname);
mkdir $(date +"%Y-%m-%d");
echo ".............. backup destination:" $DEST;
rsync --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs} -aAXv --update / $DEST;
chown -R StandardUser:StandardUser $DEST;


echo ".............. backup destination:" $DESTstatic;


make it runnable

chmod +x /scripts/backup.sh

run it as root:

su; # become root
# or
sudo /scripts/backup.sh

you either get an error that your backup directory does not exist… or it will start the backup.

regular filesystem checks:

are also important to keep your backup files in order.

tune2fs -C 1 -c 10 /dev/sdc1; # check filesystem every 10 boots/mounts

you can check that a filesystem check was performed with:

tune2fs -l /dev/sdc1 | egrep -i "mount count|Check interval|Last|Next"
Last mounted on: /run/media/canoodle/BACKUP1
Last mount time: Sat Jan 20 09:43:02 2018
Last write time: Sat Jan 20 09:43:02 2018
Mount count: 2
Maximum mount count: 10
Last checked: Sun Dec 3 11:23:00 2017
Check interval: 0 (<none>)

or have the filesystem checked straight after the backup:

ll /dev/disk/by-uuid/ | grep sdc1
lrwxrwxrwx. 1 root root  10 Jan 20 09:43 43c5d78f-70d0-45df-8cf7-ce17bf59cac5 -> ../../sdc1

# then include those two lines before "else"
umount /dev/disk/by-uuid/43c5d78f-70d0-45df-8cf7-ce17bf59cac5;
fsck -y -v -f /dev/disk/by-uuid/43c5d78f-70d0-45df-8cf7-ce17bf59cac5;

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!