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 ?

Sun Jan 03, 2016 9:31 am

the problem is:
the Raspi has a tiny screen, I can't recognize almost nothing of the miles of commandline parameters which are or have to be written and it's a torture to use Iceweasel on this screen.
So I always have to copy 1 line from my PC to the thread, change to the Raspi, start Iceweasel, try to find this forum, try to find the topic, try to find the post, then try to find this line by Iceweasel anyhow again, try to c+p it into the LX terminal, and having done that I don't see anything what's actually happening, just if there once will appear a new prompt or not.

All that entire whole minus this and minus that and minus theother and minus onemore and minus againonemore is incredibly confusing me!

It was much easier if I had a program or just a script to start which is configured correctly and which I can start from cmd line by sth like
./backup
(or just by double-click on it's desktop link)
These 8 characters I can handle, but nothing more additionally.

So can you please give me a correctly written command line which backups everything to my usb drive ( /media/pi/USB120DRV/ )
- the whole root dir
- and the whole pi dir ?

and which I only need to c+p just the way it's written?

(unfortunately I found out that many important folders have been automatically stored at /pi/ and not at / as I had expected before)
#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 ?

Tue Jan 05, 2016 2:31 pm

I'm still clueless, what is faulty with this?

Code: Select all

sudo tar --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run cvzf /media/pi/USB120DRV/pibackup.tar.gz /
#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 ?

Tue Jan 05, 2016 2:57 pm

Exactly the same thing. "cvzf" just looks like a file name. You need "-cvzf".

Historical versions of tar did not have options, but expected a clump of letters as the first argument. This is still supported for compatibility, but only when it is the very first argument.

The modern way to write options, for all programs, is with a leading hyphen.

(Usually you can clump single-letter options together if they do not take arguments. Therefore options that are full words like --exclude require two hyphens.)

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 ?

Tue Jan 05, 2016 3:06 pm

ah, ok, thank you - I have to apologize, I don't always understand everything at once because I'm not good in English.

Code: Select all

sudo tar --exclude=/media/* --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/run -cvzf /media/pi/USB120DRV/pibackup.tar.gz /
and the blank space at the end is correct between
../pibackup.tar.gz
and
/

:?:
#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 ?

Tue Jan 05, 2016 4:10 pm

davenull wrote:and the blank space at the end is correct between
../pibackup.tar.gz and / :?:
Yes, …/pibackup.tar.gz is the name of the archive you are creating. It is the argument to the "-f" part of the preceding "-cvzf" option. Everything that is not an option or an argument to an option, is a file or directory to back up. So "/" means to backup everything, except the directories you already excluded.

Incidentally, you should add "--exclude=/sys" as well. It is a virtual filesystem, similar to /proc, and does not store real data. An alternative to lots of exclusions is to tell tar to stay in the filesystem you specify, and then name the two filesystems you care about: / and /boot:

Code: Select all

sudo tar -cvzf /media/pi/USB120DRV/pibackup.tar.gz --one-file-system / /boot

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 ?

Tue Jan 05, 2016 4:12 pm

thank you very much! :)

Code: Select all

sudo tar --exclude=/media/* --exclude=/proc --exclude=/sys --exclude=/dev --exclude=/tmp --exclude=/run -cvzf /media/pi/USB120DRV/pibackup.tar.gz /
#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(;;);}

grumpy_dad
Posts: 8
Joined: Sun Jan 03, 2016 10:31 am

Re: SD card backup / copy: how to ?

Tue Jan 05, 2016 6:15 pm

I doubt rsync can restore in case of an SD card corruption, in which case you'll need to wipe everything and reinstall. I simply make SD card clones every month and save 3 most recent clones, it's much easier to restore as well (at least for me!). I just have an 8gb sd card.

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 ?

Tue Jan 05, 2016 6:57 pm

quite that had been almost my next question:

In case files and folders of the the SD card got damaged, deleted, or corrupted:
by which command can I restore everything from the pibackup.tar.gz file?

At the worst case:
if I had to make a complete new installation by NOOBS (the first basic installation),
and now want to update to my latest backup state?

( I now have the pibackup.tar.gz file (1.5 GB) in the root dir of my USB drive ( USB120DRV ).
#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(;;);}

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: SD card backup / copy: how to ?

Wed Jan 06, 2016 3:07 am

grumpy_dad wrote:I doubt rsync can restore in case of an SD card corruption, in which case you'll need to wipe everything and reinstall. I simply make SD card clones every month and save 3 most recent clones, it's much easier to restore as well (at least for me!). I just have an 8gb sd card.
This was why having an image of the boot and os while keeping the data on a different drive/partition makes sense.

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 ?

Wed Jan 06, 2016 8:24 am

asandfort (edited) wrote: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 /
so how to proceed then in case of need to restore the files from the *.tar.gz ?
davenull wrote: In case files and folders of the the SD card got damaged, deleted, or corrupted:
by which command can I restore everything from the pibackup.tar.gz file?

At the worst case:
if I had to make a complete new installation by NOOBS (the first basic installation),
and now want to update to my latest backup state?

( I now have the pibackup.tar.gz file (1.5 GB) in the root dir of my USB drive ( USB120DRV ).
#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(;;);}

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

Re: SD card backup / copy: how to ?

Thu Jan 07, 2016 2:32 am

davenull wrote:
so how to proceed then in case of need to restore the files from the *.tar.gz ?
google "extract a gzipped tarball"

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 8:28 am

Code: Select all

unzip  -xvzf /media/pi/USB120DRV/Akten/ pibackup.tar.gz /
??
#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 10:40 am

cd /tmp # change to the directory when you want the output stored

tar xavf /media/pi/USB120DRV/Akten/pibackup.tar.gz # NO SPACES between directories and filenames

That xavf stuff means x == extract, a == analyse, v == verify, f == filename. The analyse parameter gets the tar program to read the magic numbers from the file (defined with the filename parameter) and choose the right way to unzip it before "untar'ing" it.
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.

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 11:05 am

thank you!

what means
cd /tmp # ?
what is /tmp?
#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 11:37 am

/tmp is the temporary directory, it's a place to put things that you don't want to keep beyond the next time the system gets booted.

I just used it as an example because, by convention, you should NOT write stuff to the root (/) directory. You could use your home directory cd ~.
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.

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 11:52 am

well, my situation is as follows:

I have a backup tar file on my USB drv
and - in case my raspi root dir ane maybe others have become corrupted - I now want to overwrite all existing files and folders on my Raspi and addtionally all those which have (or might have) been deleted.

So the uncompress (unzip) function now should restore everything to the state of the last backup.
IMO it also must copy all and everything on root and home and pi and all that automatically, too.

So I open the LX Terminal (even better: the File Manager),
move to the USB folder,
and start the restore program out of that folder.

Code: Select all

tar xavf /media/pi/USB120DRV/Akten/pibackup.tar.gz
Is this the functionality which is provided and which is needed?
Does this tar command know then to which path and to which folders it has to write all and everything?
#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 12:58 pm

Try typing this
man man
then this
man tar
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.

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 1:32 pm

the man is too cryptic and too technical English, too hard to understand for my poor English skills.
#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
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 1:35 pm

davenull wrote:the man is too cryptic and too technical English, too hard to understand for my poor English skills.
Try this then
http://manpages.debian.org/cgi-bin/man. ... &locale=de

You could also try installing the manpages-de package which should give you local man pages for many commands in German. :)
Last edited by rpdom on Thu Jan 07, 2016 1:38 pm, edited 1 time in total.

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 1:37 pm

ok, lets se...

Mod edit: Just imagine the whole man page for tar in German, right here.I know you don't really want to see it.

author's edit:
no, I want to see it, because I have to see all the options which are actually possible, in order to access it at any time and not to risk to miss anything.
As it is not forbidden to post a documentation acc to forum's rules, I would insist to keep them visible.

[mod edit. Please stop posting the man page as it adds nothing to the forum and just clutters up the thread with extra verbage that is not required, also this is not the German language forum. if you want to keep it handy print it out and file it in a ring binder.]
[german tar manpage delted by mod]
Last edited by davenull on Thu Jan 07, 2016 2:35 pm, edited 2 times 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 ?

Thu Jan 07, 2016 1:45 pm

THAT stuff is REALLY weird!!


xavf


1st I see: shouldn't it be -xavf == -x -a -v -f ?

x is ok
-x, --extract, --get
Dateien aus einem Archiv extrahieren

a is strange: why that ?
-a, --auto-compress
Die Archiv-Endung verwenden, um das Kompressionsprogramm herauszu-
finden

v verbose....well....list everything... not needed!

f don't find!

but my question is still not answered:
So I open the LX Terminal (even better: the File Manager),
move to the USB folder,
and start the restore program out of that folder.

Code: Select all
tar xavf /media/pi/USB120DRV/Akten/pibackup.tar.gz



Is this the functionality which is provided and which is needed?
Does this tar command know then to which path and to which folders it has to write all and everything?
Last edited by davenull on Thu Jan 07, 2016 2:09 pm, edited 2 times 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(;;);}

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 1:48 pm

The minus sign on my keyboard sticks so I don't like to wear it out.
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.

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 1:49 pm

haha, that is funny, ok then
#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 ?

Thu Jan 07, 2016 1:50 pm

so for restoring = EXTRACTING this file
/media/pi/USB120DRV/Akten/pibackup.tar.gz
is this the correct procedure?
So I open the LX Terminal (even better: the File Manager),
move to the USB folder,
and start the restore program out of that folder by this command:

Code: Select all

tar -xavf /media/pi/USB120DRV/Akten/pibackup.tar.gz
Is this the functionality which is provided and which is needed?
Does this tar command know then to which path and to which folders it has to write all and everything during EXTRACTING ?

I want to extract to restore, not to compress!
#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 ?

Thu Jan 07, 2016 2:00 pm

in the German man page they only say
Alle Dateien aus archive.tar extrahieren.
tar -xf archive.tar
to restore though.

that would mean by my settings:

Code: Select all

tar -xf  /media/pi/USB120DRV/Akten/pibackup.tar.gz
no -v parameter, no -a parameter.


correct?
#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”