1753454 Members
6169 Online
108794 Solutions
New Discussion юеВ

tar

 
Cathy Arora
Frequent Advisor

tar

Hi All;
I have to backup two directories on the tape.
I am not sure what the commnad should be if I wanted to do it at the same time without overlaying the information.
I do have to do tar because I have got ASCii and binary files all over the place in these directories.
So here it is the Q- copying /dev and copy /home/kk
to /dev/rmt/0M and keeping the same tree- first /dev and then /home/kk.

Thanks all
I appreciate your help.
raj
11 REPLIES 11
Mark Grant
Honored Contributor

Re: tar

The general syntax would be

cd /
tar cvf /dev/rmt/0m /home/kk

When you restore, ensure you are in the / directory before you start. Don't necessarily expect the files in /dev to make any sense if you restore to another machine.
Never preceed any demonstration with anything more predictive than "watch this"
Tim Sanko
Trusted Contributor

Re: tar

Cathy,

You are best off using a scratch tape and putting both directories on a single tape.

tar -cvf /dev/rmt/0mn ./relativepath1 ./relativepath2

tar -cvf /dev/rmt/0m ./relativepath1 ./relativepath2
will rewind the tape at the end of the archive.

You will over write on the tape itself unless you can read to the end of the first archive tar -tvf /dev/rmt/0mn and then start where you want to. That is a pain.

I tend to put all of my needs into a tar file on the disk, gzip it and tar the zip to a tape...

Tim
Cathy Arora
Frequent Advisor

Re: tar

thnaks
But this syntax only copy one one directory I have to copy two directories on one tape( since I have only one tape) without overlaying two directories.
Thanks again,
raj
Graham Cameron_1
Honored Contributor

Re: tar

I think that Mark omitted the /dev directory, what you want is

tar cvf /dev/rmt/0m /dev /home/kk

or

cd /
tar cvf /dev/rmt/0m dev home/kk

The 1st form uses absolute paths, can only be restored to the same path.
The 2nd form uses relative paths, can be restored anywhere under the current directory.

BTW, files in /dev are generally special files and may not be much use when restored - they may need to be recreated.

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Tim Sanko
Trusted Contributor

Re: tar

The commands will put both directories on the tape. I would do it relative beacause I am a paranoid person.
Mark Grant
Honored Contributor

Re: tar

Thanks graham!

I did omit the /dev directory.

Just to clarify, you can put as many directories as you like on the command line and they will all be backed up onto the one tape, just as you like

tar cvf /dev/rmt/0m /dev /home/kk

If you do it from "/" and restore from "/" you will be absoultely fine. Unless I've made another typo :)
Never preceed any demonstration with anything more predictive than "watch this"
Cathy Arora
Frequent Advisor

Re: tar

Thanks all,
sorry I am being a pain but what is all that rmt/0m and rmt/0n.
should I do rmt/0n and not rmt/0m becuase it will rewinf the tape and ovelay the info.
I am paranoid too and do want to loose data.
dev was an example it is my application dierectory(/export)
Thanks so much guys.
Please clear that for me.
raj
Michael Schulte zur Sur
Honored Contributor

Re: tar

Hi,

if you do tar cvf /dev/rmt/0m /dev /home/kk, you have first /dev and then /home on the tape. The rewind takes place, after tar finishes copying the files onto tape and not before!! So you are save. And test the data with tar tv to be sure, it is correctly on the tape!!.

be happy,

Michael
Mark Grant
Honored Contributor

Re: tar

Don't panic Cathy!

The 0mn device just means that the tape won't rewind when you have finished copying EVERYTHING. Of course this is a bit stupid for you because it will just rewind when you take the tape out so ignore all that. However, kernels patched recently enough will insist that you use the 0mn device so just go with it.

When you specify two or more directories on the "tar" command line, they all get written as one stream to the tape and none will get in the way of any others.

I find it often helps before doing anything that you are particularly nervous of, to take a deep breath and exhale slowly and possibly go on a short vacation to a tropical island. However, in this case, it really isn't necessary! Everything will be fine :)
Never preceed any demonstration with anything more predictive than "watch this"