Page 5 of 5

Re: SD card backup / copy: how to ?

Posted: Thu Jan 07, 2016 2:45 pm
by rpdom
The -a option (auto-compress) also means that it will auto decompress. You need this to extract from a compressed (.gz) archive, rather than an uncompressed (.tar) archive.

The -f option needs to be followed by the file name of the archive.

-v just lists all the file names as it goes. That can slow it down a bit, but you can see progress.

tar will decompress the files to the current directory. So normally you would cd to where you want to extract to and then run tar with the full path name of the archive file. Or you can use the "-C directory" option to change where to extract to.

xavf and -xavf mean the same thing. The original tar didn't use the "-" in front, that was added in later to bring it in line with all the other commands. The old method still works for those who are too lazy to type the "-" ;)

Re: SD card backup / copy: how to ?

Posted: Thu Jan 07, 2016 2:53 pm
by davenull
that's fine, now I see!
I understood -a was for compress, not for uncompress.

So then I assume this will be absolutely correct then finally:

Code: Select all

tar -avxf  /media/pi/USB120DRV/Akten/pibackup.tar.gz
I'll try it by a manually corrupted SD card copy and see how it will work tonight.

Thanks for your input! 8-)

Re: SD card backup / copy: how to ?

Posted: Thu Jan 07, 2016 2:57 pm
by DougieLawson
The -a parameter means you don't have to decide which format has been used to compress a file (the tar program does that for you)

tar xavf foo.tar.gz
tar xavf foo.tgz
tar xavf foo.bz2
tar xavf foo.xz

have the same syntax but four differing file suffixes because they were created using differing programs.

I have to say, you are the hardest person to explain things to and my German isn't good enough to write in your native language.

Re: SD card backup / copy: how to ?

Posted: Thu Jan 07, 2016 3:01 pm
by QuietZone
I have to say, you are the hardest person to explain things to and my German isn't good enough to write in your native language.
Check out this guy ("Chris Glur"), found, e.g., at:

http://compgroups.net/comp.os.linux.mis ... us/3057922

Re: SD card backup / copy: how to ?

Posted: Thu Jan 07, 2016 3:09 pm
by davenull
Dougie,
I appreciate your input and your willingness to help very much, even if my English is not good enough to always understand what you are trying to tell me vice versa ( and my Linux skills still are even worse) :)

Re: SD card backup / copy: how to ?

Posted: Fri Jan 08, 2016 1:25 am
by craigrachow
excellent
so davenull, can you give us a quick sentence on what your backup does and the code to do it and restore it? maybe it can be placed into a sticky or something thereafter to help others.

Re: SD card backup / copy: how to ?

Posted: Fri Jan 08, 2016 2:47 am
by asandford
I would suggest that a dedicated backup tool is used. If you have resources, then try something like Amanda (I haven't tested it, but I will this weekend).

Re: SD card backup / copy: how to ?

Posted: Fri Jan 15, 2016 7:48 am
by davenull
the tar command does not work at all.
after typing in LX terminal window
tar -avxf /media/pi/USB120DRV/Akten/pibackup.tar.gz
and ENTER
then there is just a Line feed,
but nothing happens any more, no screen output, absolutely nothing, not even when repeatedly pressing ENTER.

So what's wrong? Can someone/anyone confirm that or not?

Re: SD card backup / copy: how to ?

Posted: Fri Jan 15, 2016 3:31 pm
by tito-t
edit: is the tar file in the correct target folder?

Re: SD card backup / copy: how to ?

Posted: Fri Jan 15, 2016 5:40 pm
by davenull
no - there was a mistake :-/
thank you Tim!

ps, edit:
I'll check it and fix that!

Re: SD card backup / copy: how to ?

Posted: Sat Jan 16, 2016 7:54 am
by davenull
update:
so I checked and confirmed that the tar file is on
/media/pi/USB120DRV
(USB drive root dir)

then I installed Raspian anew from a new NOOBS image on a new SD card (=> ok).
then I plugged the USB drive (mounted correctly, tar file visible => ok).
then just to check if tar is installed, I typed
man tar
(all options listed: => ok!)

Then I entered the restore command into the LX terminal window

Code: Select all

tar -avxf /media/pi/USB120DRV/pibackup.tar.gz /
[enter]

but then still it does not happen anything after that:
just a line feed, but no screen message, no file name, no error - NOTHING.

So there is still something faulty with that tar -avxf... command

any ideas?

Re: SD card backup / copy: how to ?

Posted: Sat Jan 16, 2016 8:27 am
by jojopi
How long did the "tar -c" originally take to make the file, and how long are you waiting for the "tar -x" before concluding that it is not working?

When you created the archive, tar probably told you that it was "Removing leading `/' from member names". So if you ask it to extract /, it should read the whole file and then say "/: Not found in archive".

Either list no files, to extract everything, or mention specific directories without leading /, such as "home".

tar extracts to the current directory by default. That is what you want, because directly overwriting all your files with old versions would probably break the operating system.

Re: SD card backup / copy: how to ?

Posted: Sat Jan 16, 2016 8:33 am
by davenull
it lasted maybe 5 minutes to write the archive (3GB) and I waited about 2 minutes while nothing happend

ps,
I entered the tar restore command at
pi@raspberrypi: ~$
prompt.
It's the same location where I once entered the tar backup cmd.

of course there are also root files in that archive,
and of course I need to overwrite all existing files (root and pi home), that's finally the reason why I need to restore the old state (e.g. when OS files are deleted or corrupted).

ps,
if I do the same at root after
cd /
tar -avxf /media/pi/USB120DRV/pibackup.tar.gz /

or even
sudo tar -avxf /media/pi/USB120DRV/pibackup.tar.gz /

also nothing happens!

Re: SD card backup / copy: how to ?

Posted: Sat Jan 16, 2016 11:57 am
by davenull
now I made this:

cd /
tar -avxf /media/pi/USB120DRV/pibackup.tar.gz

then I saw it was restoring files.
but the result was faulty, many errors "access denied" have been rushing through. It lasted about half an hour.

So I rebootet, but still programs like Geany could not be startet again.

So I tried

Code: Select all

cd /
sudo tar -avxf /media/pi/USB120DRV/pibackup.tar.gz
that lasted about 2 hours, then I rebootet again,
and after that the desktop now looks like before, the language settings are correct again, Iceweasel is recovered, and Geany works fine with openvg libs, without having been manually reinstalled either one before, just everything from the restored tar file.

So that latter thing probably did the trick!

Thanks to all who helped to manage this task!