User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: SD card backup / copy: how to ?

Thu Jan 07, 2016 2:45 pm

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 "-" ;)

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Thu Jan 07, 2016 2:53 pm

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-)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SD card backup / copy: how to ?

Thu Jan 07, 2016 2:57 pm

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.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

QuietZone
Posts: 89
Joined: Sat Dec 05, 2015 7:13 pm

Re: SD card backup / copy: how to ?

Thu Jan 07, 2016 3:01 pm

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
"If you haven't got anything nice to say about anybody come sit next to me." — Alice Roosevelt Longworth

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Thu Jan 07, 2016 3:09 pm

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) :)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

craigrachow
Posts: 19
Joined: Wed Oct 28, 2015 12:56 am

Re: SD card backup / copy: how to ?

Fri Jan 08, 2016 1:25 am

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.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: SD card backup / copy: how to ?

Fri Jan 08, 2016 2:47 am

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).

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Fri Jan 15, 2016 7:48 am

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?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

tito-t
Posts: 298
Joined: Thu Jan 07, 2016 5:14 pm

Re: SD card backup / copy: how to ?

Fri Jan 15, 2016 3:31 pm

edit: is the tar file in the correct target folder?
- Tim

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Fri Jan 15, 2016 5:40 pm

no - there was a mistake :-/
thank you Tim!

ps, edit:
I'll check it and fix that!
Last edited by davenull on Sat Jan 16, 2016 8:26 am, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Sat Jan 16, 2016 7:54 am

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?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
jojopi
Posts: 3271
Joined: Tue Oct 11, 2011 8:38 pm

Re: SD card backup / copy: how to ?

Sat Jan 16, 2016 8:27 am

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.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Sat Jan 16, 2016 8:33 am

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!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: SD card backup / copy: how to ?

Sat Jan 16, 2016 11:57 am

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!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

Return to “Raspberry Pi OS”