LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Backup and Restore with TAR (https://www.linuxquestions.org/questions/linux-newbie-8/backup-and-restore-with-tar-222155/)

jay2809 08-25-2004 06:32 AM

Backup and Restore with TAR
 
Really, really new to Linux so sorry if this is obvious and I've missed it. I'm using SuSE 9 and I want to backup my home folder to tape which I've managed with

tar -cvf /dev/st0 /$HOME

This shows me all the files being backed up and my tape spins giving me the impression that its writing.

My Question: How do I get my files back? How can I verify the data is there?

Thanks in advance

chrism01 08-25-2004 06:53 AM

You could try
tar -tvf /dev/st0
which should list the filenames (t = table of contents)
or tar -xvf /tmp/test /dev/st0
which should extract the files into /tmp/test if you want to compare sizes/checksums etc.
Make sure the tape is rewound first.
I've tended to use taper (http://sourceforge.net/projects/taper/) as it has a nice (curses) based interface and is pretty stable. It's up to v7.
I suggest you try it out as it's free.

Charalambos 08-25-2004 06:53 AM

To get the files back just apply the tar to extract the files.
--> tar xvf /dev/st0

To access the tape, work with the command "mt". Look up the different commands available in the man pages ("man mt").
Some examples:
- mt /dev/nrst0 rewind --> rewind the tape
- mt dev/nrst0 fsf 1 --> to the next file on the tape
- mt dev/nrst0 fsf --> skip to files (go to next but one file)

If you're using the driver st0, the tape will rewind after each backup.
If you want to avoid these, e.g you want to put several backups on the tape one after one, use the driver nrst0. This driver won't automatically rewind the tape. The command mt should always be used with the nrst0 driver only.

jay2809 08-25-2004 06:54 AM

so quick
 
you see, this is why Apple Macintosh will always rule. You post a question on a Mac forum and it gets answered before you can work it out for yourself.

The answer is simply tar -xvf /dev/st0 which restores all data to /root

Thanks me

jay2809 08-25-2004 06:56 AM

sorry
 
And whilst I was writing my findings two nice people have given me new things to try! OK so Linux might not be that bad ;)

Thanks for imput guys, very useful, downloading taper now!

Charalambos 08-25-2004 06:59 AM

Re: so quick
 
Quote:

Originally posted by jay2809
you see, this is why Apple Macintosh will always rule. You post a question on a Mac forum and it gets answered before you can work it out for yourself.
Well, seems they're way ahead of us.
Quote:

The answer is simply tar -xvf /dev/st0 which restores all data to /root
It will extract the files to where you execute the tar command.

shengchieh 08-25-2004 04:28 PM

You may also want to save space by compressing the file.
Learn about zip & unzip, gzip & gunzip, or bzip2 & bunzip2.
I think there is a way to compress and uncompress using tar
- others may know.

Sheng-Chieh

Charalambos 08-25-2004 04:47 PM

Quote:

Originally posted by shengchieh
I think there is a way to compress and uncompress using tar
By adding the option z you compress / uncompress with gzip, with the parameter j with bzip2.
E.g: "tar cvzf tar-file.tar.gz files" you create a gzipped tar archive.
(".tar.gz" is the same as ".tgz")


All times are GMT -5. The time now is 12:24 PM.