.img backup of a running system

On raspbmc I was able to backup my sd card from the command line by stopping xbmc and then using the dd command to create an image.

I am unable to stop kodi (using RC1 on rpi2) from the command line or from the GUI to get to a state where I can create an img.

Can anyone advise me how to do this?

To stop kodi in osmc:

sudo systemctl stop mediacenter

However I would point out that imaging any filesystem with dd that is mounted read/write is not going to be reliable (this applies to raspbmc too) - the image file will have some subtle corruption in it that you may not notice until you really need your backup - you are taking a snapshot of a filesystem that is not in a consistent state. (Some data may be still cached in memory and not yet written out to disk - the state of the filesystem will most likely change between the time when dd started and finished causing inconsistencies etc)

I would find an alternative backup method.

It will change:

*procfs
*sysfs
*dev

S

Many thanks both of you.
I’m not wedded to any particular method of taking backups, and I’m a linux noob. Is there a recommended backup method that doesn’t involve turning everything off and removing the card?

The simple answer is, you cannot make an image of a mounted disk. You could .tar up the /home/osmc/.kodi/ folder and copy it off to a network location. This gives you the ability to make a fresh install and then restore all your kodi settings.

Thanks everyone.

How would this work if I Upgrade to a new version? Would copying the .kodi folder over the new version still work ?

Use the backup options in My OSMC

Sam

I use a simple script using rsync.

#!/bin/sh rsync -av /boot /mnt/tera/pi/osmc-pi2/osmc rsync -av /etc /mnt/tera/pi/osmc-pi2/osmc rsync -av /home /mnt/tera/pi/osmc-pi2/osmc rsync -av /usr /mnt/tera/pi/osmc-pi2/osmc rsync -av /mnt/tera/pi/osmc-pi2/osmc /mnt/16GB/pi/osmc-pi2/

“/mnt/…” is the mounted flash drive/dir where the rsync’d data goes to. Setup cron to run the script about 3 times daily. Restore by rsyncing in the opposite direction:

rsync -av /mnt/tera/pi/osmc-pi2/osmc/home /

You should put the text in code tags to make the forum not interpret special characters like #

# Your text

Are these all the directories that osmc and kodi uses? If I use git to backup these directories and pushed the changes out to my other units would it keep all my add-ons and profile settings?

You are going to have great difficulty in preventing such shared directories from using unique IP address configurations I think.

couldn’t you exclude the network config from syncing so it doesn’t overwrite network settings?

I setup git to sync the /boot /etc /home and /usr directories. I am able to push changes out to my other units and any new addons or shortcut changes show up on those units as expected. The only problem I have right now is whenever I go to the home screen the skin builder runs and generates an error. Any clue as to why that may be happening? I can provide log files if needed.

I would have thought rsync would be more applicable to this than git ??

Can you use rsync with a remote repository like github? I’m still pretty new to working with Linux and not familiar with rsync.

Rsync and Git are two completely different things. Git is a version control system, Rsync is for syncing defined sets of files and folders between two or more different machines automatically.

I don’t really understand why you would choose Git to sync configuration between multiple machines, that’s like using a screwdriver to hammer in nails.

Try something like aufs

@DBMandrake
Thank you for the insight. I am still very new to all of this so
sorry for any silly questions. What I would like to accomplish is being
able to make changes on my main rpi2/osmc (ie. change shortcut menus
and/or install an addons) and then be able to push those changes out to
other units across the internet (ie. my office and parents units). I
also have Retrosmc setup and would like to be able to push any changes
for that as well (ie. new roms and/or saved games).

I was thinking I might be able to do this with Git/GitHub but
apparently I thought wrong. I’m now looking into rclone which is
suppose to be rsync for cloud storage.

@sam_nazarko I will also look into aufs. Thank you Sam for the suggestion.

Be sure not to use a public cloud service for sharing copyrighted material (roms etc.)!
Github would be a bad idea to use.