The officially official Devuan Forum!

You are not logged in.

#1 2021-03-05 12:20:11

dice
Member
Registered: 2020-11-22
Posts: 354  
Website

Operating System Backups

What do you use for backups?

Im using fsarchiver as it is quick and you can secure the archive with blowfish encryption.

https://www.fsarchiver.org/


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#2 2021-03-05 13:49:00

just
Member
From: Rovaniemi
Registered: 2020-05-08
Posts: 4  

Re: Operating System Backups

FSArchiver here as well.  For its unparagonable versatility, flexibility, reliability.

Offline

#3 2021-03-05 14:06:25

dice
Member
Registered: 2020-11-22
Posts: 354  
Website

Re: Operating System Backups

just wrote:

FSArchiver here as well.  For its unparagonable versatility, flexibility, reliability.

How to do you backup? I have a portable drive ive set up a small devuan system with no X that i can archive from. So the portable drive has an operating system and ext4 partition to backup to. The hot backup or live backup is an option but it has stalled/failed on me in the past.

This is how i do it for the moment.

1. log into portable drive that has devuan installed on a 10GB partition.

2. mount the rest of the portable drive labeled backup from portable drives /etc/fstab

3. fsarchiver savefs  /media/$USER/backup.fsa /dev/sda1 /dev/mapper/cryptroot -v -j4 -c xxxxxxx

With encrypted partitions they need to be opened first of course.

Last edited by dice (2021-03-05 14:33:28)


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#4 2021-03-05 14:18:10

Dutch_Master
Member
Registered: 2018-05-31
Posts: 171  

Re: Operating System Backups

Rsync for backing up data, not the OS.

Offline

#5 2021-03-05 14:39:44

just
Member
From: Rovaniemi
Registered: 2020-05-08
Posts: 4  

Re: Operating System Backups

There's a number of different Linuxes, installed on each of my computers.  Each Linux lives in its own partition and is totaly independent from any other one.  A huge data partition with user data files in it is the only thing shared between them, used by all installed Linuxes.

FSArchiver is added to each installed Linux.

The simple thing is - never backup/restore a mounted partition.  Nothing else.

For example, there are A, B, C, D Linuxes installed in their own partitions.  I want to backup A and B ones.  I simply boot into C or D, and run FSArchiver from them, backing up A and B either separately, in two separated archives, or put them both in a single archive.

To restore A or B, I boot again into C or D, and restore either A or B, or both.

The important thing to note here is that while C or D are running, A and B remain unmounted.  So I can backup, restore, do whatever I want with partitions, corresponding to A and B.

FSArchiver archives are kept on an external USB disk.

Finally, I have a bootable USB flash stick with SystemRescueCD on it.  FSArchiver is included in each and every SystemRescueCD release.  In the worst case, when internal disk is totally damaged and computer doesn't boot from it, I boot from USB stick, fire up FSArchiver, and restore A, B, C, D partitions from the external disk.

SystemRescueCD with FSArchiver is an excellent disaster recovery tool.

Offline

#6 2021-03-05 14:53:47

Altoid
Member
Registered: 2017-05-07
Posts: 677  

Re: Operating System Backups

Hello:

dice wrote:

What do you use for backups?

I use two applications: Timeshift and BackInTime.
Timeshift takes system snapshots and BackInTime takes ~/ snapshots.
Have always worked quite well.

All the snapshots get stored on a separate 300Gb SAS drive living inside the box.
This is quite obviously not the ideal solution and I've been procrastinating for the longest while.

Cheers,

A.

Last edited by Altoid (2021-03-05 14:54:16)

Offline

#7 2021-03-05 14:56:00

dice
Member
Registered: 2020-11-22
Posts: 354  
Website

Re: Operating System Backups

@ just, that sounds like a good idea per computer. The portable drive in my case is a nice option for having both storage media and backup media on the same disk. I can use the portable drive for many other computers if need be as long as i have the correct firmware and drivers installed. At the moment installed devuan to portable ssd drives is good, there is no lag like you would get from a spin drive and the speed of usb3 ports is good for this type of application. Technology has come far in this regard.

Last edited by dice (2021-03-05 15:02:30)


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#8 2021-03-05 17:03:58

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 1,542  
Website

Re: Operating System Backups

For my Debian bullseye system I have a systemd timer calling this simple rsync script every week to back up the system to the spare internal drive in my ThinkPad:

#!/usr/bin/env ksh

_date="$(date -I)"
error_log=/var/log/backup_errors-"$_date".log
uuid=ae1c7741-67e6-4919-b3d8-3d3626709ae1

function rsync_backup {
   /usr/bin/rsync -aAXq --delete --exclude={'/dev/*','/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found','/efi/*','/home/empty/Music/*','/home/empty/Downloads/*'} / /mnt/debian/ 2>"$error_log"
   [ -a /mnt/backup-* ] && rm /mnt/backup-*
   touch /mnt/backup-"$_date"
}

function clear_logs {
   if [ "$(stat -c %s "$error_log")" = 0 ]
   then
      rm "$error_log"
      printf 'Empty error log deleted.\n'
   else
      printf 'Errors in log, not deleting.\n'
   fi
}

printf 'Mounting backup partition...\n'
if mount /dev/disk/by-uuid/"$uuid" /mnt ; then
	printf 'Mounted backup partition.\n'
	printf 'Beginning backup...\n'
	rsync_backup
	printf 'Backup complete.\n'
else
	printf 'Backup failed, partition not mounted correctly.\n'
fi

printf 'Clearing empty error log files...\n'
clear_logs

printf 'Un-mounting backup partition...\n'
umount /mnt && printf 'Un-mounted backup partition.\n'

printf 'All done :-)\n'

I won't share the systemd .timer & .service units because I'm pretty sure nobody will find them of any use :-)

For my Alpine system I drop this script in /etc/periodic/daily/ to take a snapshot of the root filesystem every day and create a submenu listing the available snapshots in GRUB (five snapshots are kept at any one time with the excess being deleted by the script):

#!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin
time=$(date +'%Y-%m-%d@%T')
grub_dir=/boot/grub
config_file="$grub_dir"/alpine-snapshots.cfg
snapshot_dir=/snapshots
subvol_dir="$snapshot_dir"/alpine
uuid=$(findmnt -o uuid -n /)
kernel=/boot/signed-vmlinuz-lts
parameters='rw quiet modules=btrfs'
ucode=/boot/amd-ucode.img
initrd=/boot/initramfs-lts

get_snap_info() {
	snap_list=$(for snap in "$snapshot_dir"/* ; do printf '%s ' "$(basename -- "$snap")" ; done)
	snap_number=$(printf '%s\n' "$snap_list" | wc -w)
	old_snap=$(printf '%s\n' "$snap_list" | awk '{print $1}')
}

if grep -q ' / .*snapshot.*' /proc/self/mounts ; then
	printf 'Booted into snapshot, no action taken.\n'
else
	printf 'Removing old configuration file...\n'
	if [ -e "$config_file" ] ; then
		rm "$config_file"
	else
		printf 'No configuration file found.\n'
	fi
	printf 'Creating new snapshot...\n'
	btrfs subvolume snapshot / "$snapshot_dir"/"$time"
	get_snap_info
	while [ "$snap_number" -gt 5 ] ; do
		printf 'Removing excess snapshot...\n'
		btrfs subvolume delete "$snapshot_dir"/"$old_snap"
		get_snap_info
	done
	printf 'Creating new configuration file...\n'
	printf '#\n' > "$config_file"
	for entry in "$snapshot_dir"/* ; do
		ed "$config_file" > /dev/null <<!
1i
menuentry '${entry##*/}' {
	search --fs-uuid --set=root $uuid
	linux $subvol_dir/${entry##*/}$kernel root=UUID=$uuid rootflags=subvol=$subvol_dir/${entry##*/} $parameters
	initrd $subvol_dir/${entry##*/}$ucode $subvol_dir/${entry##*/}$initrd
}
.
w
!
	done
	printf 'All done!\n'
fi

Snapshots aren't really backups, as such, but I'm tracking Alpine's edge version and the ability to rollback to a prior state is very useful with a rolling release distribution. I have a similar script in my Arch box that's called by another systemd timer unit.

For the family laptop I run rsync manually to a pair of separate stand-alone hard drives. Backups for that are too important to automate...

just wrote:

never backup/restore a mounted partition

I always backup from a running system with all of the target partitions mounted. This is fine with rsync as long as you don't mind the stuff you're working on during the backup process not being saved.


Black Lives Matter

Offline

#9 2021-03-06 01:51:14

GlennW
Member
Registered: 2019-07-18
Posts: 100  

Re: Operating System Backups

I backup my personal data using

rsync -avh <source> <destination>

scripts (which are very basic bash commands)

I also use reverse instructions to restore. But I haven't had to do that in a long time, touch wood. :-)

I used to use "simplebackup" but it stopped working and support for it disappeared, but that was when I was still using Mageia/Mandriva (about ten years ago?).

Thankfully, Devuan Beowulf is more stable than any other OS I have ever used before.

Offline

#10 2021-03-06 10:30:15

PedroReina
Member
From: Madrid, Spain
Registered: 2019-01-13
Posts: 186  
Website

Re: Operating System Backups

I back up data with rsync, wrapped in a customized bash script.

I back up system partitions booting a different OS and using partclone from there.

Offline

#11 2021-03-06 12:22:08

dice
Member
Registered: 2020-11-22
Posts: 354  
Website

Re: Operating System Backups

thanks for the contributions all.


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

Board footer