Page 2 of 5

Re: SD card backup / copy: how to ?

Posted: Sun Dec 27, 2015 6:30 pm
by davenull
is that true that for the RPi there is no single backup-program or script or what ever which works out of the box?
e.g., choose target backup drive by commandline parameter or by menu (listing all available drives / just all USB drives)?

like e.g., most simple:

Code: Select all

sudo ./backup  /media/pi/usb120drv   # usb120drv == drive name 
In case something like that doesn't exist yet, then that would be really rediculous...

Re: SD card backup / copy: how to ?

Posted: Sun Dec 27, 2015 11:20 pm
by SonOfAMotherlessGoat
davenull wrote:is that true that for the RPi there is no single backup-program or script or what ever which works out of the box?
Not one that fits the extremely narrow range of constraints that has been put on the problem...

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 8:57 pm
by davenull
that cannot - that MUST not be true!
How long does Linux and Unix already exist?
And NO BACKUP PROGRAM to a plugged-in USB drive available ?!?

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:12 pm
by asandford
davenull wrote:that cannot - that MUST not be true!
How long does Linux and Unix already exist?
And NO BACKUP PROGRAM to a plugged-in USB drive available ?!?
Of course there are, from free to $$$$. rsync has already been mentioned as has dd'ing the partions.

If you really want a one liner:

Code: Select all

sudo tar --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run cvzf /media/pi/usb120drv/pibackup.tar.gz /
The position of the excludes depends on the version of tar. I've not tested the above as I use rsync...

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:17 pm
by davenull
thank you!
neverless there is this error:

pi@raspberrypi:~ $ sudo tar --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run cvzf /media/pi/usb120drv/pibackup.tar.gz /
tar: Eine der Optionen „-Acdtrux“, „--delete“ oder „--test-label“ ist notwendig.
„tar --help“ oder „tar --usage“ gibt weitere Informationen.

...?

ps,
I'm a complete beginner and my English is very poor, especially I don't understand sort of slang like dd'ing :-/
rsync appears extremely complicated, except there is 1 single install programm for the whole installation (like setup.exe for windows programs)
and just 1 command to start (like double-click on sort of "rsync.exe"
and adjust the settings (like target drive) interactively.

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:26 pm
by davenull
ps,
all directories of /pi/ also should be backup-ed
and why exclude proc and dev?

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:27 pm
by asandford
davenull wrote:thank you!
neverless there is this error:

pi@raspberrypi:~ $ sudo tar --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run cvzf /media/pi/usb120drv/pibackup.tar.gz /
tar: Eine der Optionen „-Acdtrux“, „--delete“ oder „--test-label“ ist notwendig.
„tar --help“ oder „tar --usage“ gibt weitere Informationen.

...?

ps,
I'm a complete beginner and my English is very poor, especially I don't understand sort of slang like dd'ing :-/
rsync appears extremely complicated, except there is 1 single install programm for the whole installation (like setup.exe for windows programs)
and just 1 command to start (like double-click on sort of "rsync.exe"
and adjust the settings (like target drive) interactively.
Well, I did say that may have the alter the position of the excludes, try:

Code: Select all

tar  cvzf /media/pi/usb120drv/pibackup.tar.gz / --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run
Seems to do something...I'll let you know when it finishes

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:30 pm
by davenull
pi@raspberrypi:~ $ tar cvzf /media/pi/usb120drv/pibackup.tar.gz / --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run
tar: Entferne führende „/“ von Elementnamen
tar (child): /media/pi/usb120drv/pibackup.tar.gz: Funktion open fehlgeschlagen: Datei oder Verzeichnis nicht gefunden
tar (child): Error is not recoverable: exiting now
/
/srv/
/etc/
/etc/gai.conf
/etc/polkit-1/
/etc/polkit-1/nullbackend.conf.d/
/etc/polkit-1/nullbackend.conf.d/50-nullbackend.conf
tar: /etc/polkit-1/localauthority: Funktion open fehlgeschlagen: Keine Berechtigung
/etc/polkit-1/localauthority.conf.d/
/etc/polkit-1/localauthority.conf.d/50-localauthority.conf
/etc/polkit-1/localauthority.conf.d/60-desktop-policy.conf
/etc/dhcpcd.duid


that looks better...

ps,
all directories of /pi/ also should be backup-ed
and why exclude proc and dev?

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:32 pm
by davenull
no,...
tar (child): /media/pi/usb120drv/pibackup.tar.gz: Funktion open fehlgeschlagen: Datei oder Verzeichnis nicht gefunden
tar (child): Error is not recoverable: exiting now

did not find the USB target drive
nevertheless, the USB drive is plugged in and can be accessed via the file explorer

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:50 pm
by asandford
davenull wrote: and why exclude proc and dev?
They are psuedo-filesystems populated by the OS at runtime, they probably are empty on the SDcard (if they exist at all).
You exclude /media as you don't want it archiving the archive file...
davenull wrote:no,...
tar (child): /media/pi/usb120drv/pibackup.tar.gz: Funktion open fehlgeschlagen: Datei oder Verzeichnis nicht gefunden
tar (child): Error is not recoverable: exiting now

did not find the USB target drive
nevertheless, the USB drive is plugged in and can be accessed via the file explorer
Try putting sudo in front of the tar command (as in my first example), or:

Code: Select all

cd /media/pi/usb120drv/
sudo tar cvzf ./pibackup.tar.gz / --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:52 pm
by davenull
pi@raspberrypi:~ $ sudo tar cvzf /media/pi/usb120drv/pibackup.tar.gz / --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run
tar: Entferne führende „/“ von Elementnamen
/
/srv/
/etc/
/etc/gai.conf
/etc/polkit-1/
/etc/polkit-1/nullbackend.conf.d/
/etc/polkit-1/nullbackend.conf.d/50-nullbackend.conf
/etc/polkit-1/localauthority/
/etc/polkit-1/localauthority/10-vendor.d/
/etc/polkit-1/localauthority/20-org.d/
/etc/polkit-1/localauthority/30-site.d/
/etc/polkit-1/localauthority/90-mandatory.d/
/etc/polkit-1/localauthority/50-local.d/
/etc/polkit-1/localauthority/50-local.d/55-storage.pkla
/etc/polkit-1/localauthority.conf.d/
/etc/polkit-1/localauthority.conf.d/50-localauthority.conf
/etc/polkit-1/localauthority.conf.d/60-desktop-policy.conf
tar (child): /media/pi/usb120drv/pibackup.tar.gz: Funktion open fehlgeschlagen/etc/dhcpcd.duid
/etc/rpi-issue
: Datei oder Verzeichnis nicht gefunden
tar (child): Error is not recoverable: exiting now
/etc/protocols
/etc/udev/
/etc/udev/rules.d/

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 10:53 pm
by davenull
but I don't find a tar file on my usb drv after that... :(
Google translate of error msgs:

tar (child): /media/pi/usb120drv/pibackup.tar.gz: fuction open failed
/etc/dhcpcd.duid/etc/rpi-issue no such file or directory
tar (child): Error is not recoverable: exiting now

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:13 pm
by asandford
davenull wrote:but I don't find a tar file on my usb drv after that... :(
Google translate of error msgs:

tar (child): /media/pi/usb120drv/pibackup.tar.gz: fuction open failed
/etc/dhcpcd.duid/etc/rpi-issue no such file or directory
tar (child): Error is not recoverable: exiting now
Mine's just failed with

Code: Select all

tar: Exiting with failure status due to previous errors
But there are no errors...
However, it did create a file:

Code: Select all

-rw-r--r-- 1 root root 1473845343 Jan  2 22:52 pibackup.tar.gz
I'm running wheezy from a hdd with 135GB free, so it's not a space issue.

Best try rsync

Code: Select all

sudo apt-get install rsync -y
mkdir -p /media/pi/usb120drv/pibackup
cd /media/pi/usb120drv/pibackup/
sudo rsync -avz --delete --exclude /sys --exclude /tmp --exclude /proc --exclude /run  --exclude /media/* / .
The excludes can be written to a file if required.

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:18 pm
by davenull
it does not find the target USB drv

pi@raspberrypi: $ cd /media
pi@raspberrypi:/media $ cd usb120drv
bash: cd: usb120drv: no such file or directory
pi@raspberrypi:/media $

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:26 pm
by asandford
davenull wrote:it does not find the target USB drv

pi@raspberrypi: $ cd /media
pi@raspberrypi:/media $ cd usb120drv
bash: cd: usb120drv: no such file or directory
pi@raspberrypi:/media $
I was using you previous example:

Code: Select all

sudo ./backup  /media/pi/usb120drv   # usb120drv == d
If your drive is mounted to somewhere else, then use that (use df -h to find the mountpoint).

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:26 pm
by davenull
pi@raspberrypi:~ $ sudo apt-get install rsync -y
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
rsync ist schon die neueste Version.
rsync wurde als manuell installiert festgelegt.
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
pi@raspberrypi:~ $ mkdir -p /media/pi/usb120drv/pibackup
mkdir: das Verzeichnis „/media/pi/usb120drv“ kann nicht angelegt werden: Keine Berechtigung
pi@raspberrypi:~ $ cd /media/pi/usb120drv/pibackup/
bash: cd: /media/pi/usb120drv/pibackup/: Datei oder Verzeichnis nicht gefunden
pi@raspberrypi:~ $ sudo rsync -avz --delete --exclude /sys --exclude /tmp --exclude /proc --exclude /run --exclude /media/* / .


(hangs up)

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:28 pm
by davenull
pi@raspberrypi:~ $ cd /media
pi@raspberrypi:/media $ cd pi
pi@raspberrypi:/media/pi $ cd usb120drv
bash: cd: usb120drv: Datei oder Verzeichnis nicht gefunden
pi@raspberrypi:/media/pi $

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:29 pm
by davenull
what is "mounted" ?
I plug it in and it is opened in the file manager.. :?:
I can see the file tree
\media\pi\usb120drv

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:32 pm
by asandford
davenull wrote:what is "mounted" ?
I plug it in and it is opened in the file manager.. :?:
I can see the file tree
\media\pi\usb120drv
What does this command produce?

Code: Select all

df -h

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:33 pm
by davenull
pi@raspberrypi:/media/pi $ df -h
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root 28G 3,5G 24G 14% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 6,4M 457M 2% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p6 63M 20M 44M 31% /boot
tmpfs 93M 4,0K 93M 1% /run/user/1000
/dev/mmcblk0p5 30M 417K 28M 2% /media/pi/SETTINGS
/dev/sda1 112G 39G 74G 35% /media/pi/USB120DRV
pi@raspberrypi:/media/pi $

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:44 pm
by asandford
davenull wrote:pi@raspberrypi:/media/pi $ df -h
/dev/sda1 112G 39G 74G 35% /media/pi/USB120DRV
pi@raspberrypi:/media/pi $
Unix systems are case sensitive (unlike windows), so /media/pi/USB120DRV is not the same as /media/pi/usb120drv
So, try

Code: Select all

mkdir -p /media/pi/USB120DRV/pibackup
cd /media/pi/USB120DRV/pibackup/
sudo rsync -avz --delete --exclude /sys --exclude /tmp --exclude /proc --exclude /run  --exclude /media/* / .

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:49 pm
by davenull
OMG ...
Image
cd USB120DRV is fine

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:52 pm
by davenull
pi@raspberrypi:/media/pi/USB120DRV $ sudo tar --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run cvzf /media/pi/USB120DRV/pibackup.tar.gz /
tar: Eine der Optionen „-Acdtrux“, „--delete“ oder „--test-label“ ist notwendig.
„tar --help“ oder „tar --usage“ gibt weitere Informationen.
pi@raspberrypi:/media/pi/USB120DRV $

Image

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:53 pm
by davenull
how I LOVE Linux :evil:

Re: SD card backup / copy: how to ?

Posted: Sat Jan 02, 2016 11:56 pm
by davenull
http://www.gnu.org/fun/jokes/unix-hoax.html
We actually thought of selling this to the Soviets to set their computer science
progress back 20 or more years.
yes.
definitely: yes.