[How to] Make periodic backups of whole OSMC system

Sorry I meant my script. It’s not an rsync problem, just me :unamused:

Thanks for testing! It should be that quick for only 2.7GB. That’s one of the advantages over imaging with dd :slight_smile:

Script 0.1.6a, cloned this morning :slight_smile:

I’m going to exclude my downloads folder (because its usually full of rubbish) so that should keep it small.

Try to add next string

touch $LOGFILE

after the string #73 in your script.

Yeah. No I just didn’t redirect the rsync ouput in 229. It’s fixed in a version I have which uses a remote rsync server but forgot to add it to the master branch.

Would it be worth having a ‘if then’ check for a mounted folder for an NTFS drive? So that if there isn’t a mounter folder then it creates and mounts, if there is then leave it alone and run as normally.

Could un-hash the check lines and then customise the paths. It makes it moron proof (aimed squarely at me!).

Or is that too dangerous?

You would have to tell it how big to make it. Once you’ve created and formatted the image, it’s just like any other disc. You could put it in fstab if you are backing up regularly.

We could say if the destination is on ntfs, try and mount some part of the path (iteratively) and check if that is an ext partition, but automatically creating it does sound a bit scary.

I’m still not sure what happens if you try to back up to an ntfs, shared via nfs (which should fail) or ext4, shared via samba. Can’t cater for everyone!

I’m getting this in my backlog:

boot is on /dev/mmcblk0p1
Backing up boot partition to /media/backup/2017-07-11/boot
There are 1 previous backups
Found latest backup at /media/backup/2017-07-10/boot
Incremental backup: copying new and changed files to /media/backup/2017-07-11/boot
rsync: link_stat "/media/ --exclude=.gvfs" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Making a copy of the new and changed files in /media/backup/2017-07-11/boot-delta
Cloning unchanged files from previous backup
Deleting files no longer on source
rsync: link_stat "/media/ --exclude=.gvfs" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Time to back up boot: 00h:00m:04s

Anything I need to be worried about?

I checked, and you are right in that the boot flag was not set.
The boot partition was also empty.
I copied across the boot partition files form the backup and reset the flag to be bootable, but the backup still doesn’t boot.
What would you like me to post in way of debugging it?

Not sure. If you mount your ext image, does it look like all the files in /media/backup/2017-07-11/boot are there? (ie vs /boot on the SD card). You can get a detailed comparison using diff.

Can you post the whole output for the 2017-07-11 backlog, please?

It’s the LBA flag you need. RPi doesn’t care about the boot flag. Should look something like this

osmc@osmc:~$ sudo fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7354d8e6

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        8192   507903   499712  244M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      507904 62333951 61826048 29.5G 83 Linux

Please try version 0.1.7 where I have added some tweaks which may avoid these errors.

Ok 0.1.7 works great except for one small thing, it is not removing the /media/backup directory when it finishes.

It seems it is not unmounting and rmdir the /media/backup directory. No errors in the log file though :confused:

Did you ask it to? I didn’t make any changes myself to allow for a setup like yours.

Well, that’d explain it! :innocent:

Thanks! That sorted it and the backup now boots.
Great stuff!

this is a great script. im try to use today and i have a little problem
I git it and OK
i mount a NFS unit and OK
but when i run the script a lot of files give me this error:
failed:Operation not permitted (1)

any idea?
thanks a lot

Can you pastebin the output containing the errors?

Just saying thanks for providing this great resource. Installed on my Raspberry Pi3, up and running no issues.

30 posts were split to a new topic: Need help with full backup

Can do, while it would be interesting for the threat to might precise the instructions :wink: