KYkid85
Posts: 18
Joined: Mon Mar 21, 2016 1:51 pm

Saving to a USB through Linux

Thu Mar 24, 2016 6:40 pm

ImaNewbie
I am fixing some bugs from downloading Noobs and I want to be able to backup all my data/ OS settings to a USB so if something crashes and i have to re-download Noobs back to default I wont have to go back and make all the corrections.

So basically how do I Backup my settings/ OS to a USB? I know how to access USB stick fyi

-thanks

phelum
Posts: 72
Joined: Thu Jul 17, 2014 7:05 am
Location: Sydney, AUS

Re: Saving to a USB through Linux

Thu Mar 24, 2016 8:20 pm

Hi,

Here is my batch file (save2media) to save everything to a volume (e.g. USB stick partition) mounted on /media.

Code: Select all

#!/bin/bash
read -p "Backup all files to /media ? [y/n] "
[ "$REPLY" == "y" ] && \
rsync -av --delete --exclude-from=save2exlist / /media  &&
sync &&
echo done

exit
The ancilliary file that tells rsync not to save directories such as /dev is save2exlist and mine contains

Code: Select all

/dev/*
/home/cubie/*
/media/*
/mnt/*
/proc/*
/root/.cache/*
/run/*
/srv/*
/sys/*
/tmp/*
/swapfile
The batch file must be run with root privileges (e.g. sudo ./save2media).

Cheers,
Steven

Return to “Troubleshooting”