Operating System - HP-UX
1834644 Members
2930 Online
110069 Solutions
New Discussion

which option can tar a directory to tape

 
SOLVED
Go to solution
Rambo_1
Regular Advisor

which option can tar a directory to tape

thanks
8 REPLIES 8
Bart Paulusse
Respected Contributor
Solution

Re: which option can tar a directory to tape

Hi,

tar -cvf

tar -cvf /dev/rmt/0m /tmp

regards,

Bart
Pete Randall
Outstanding Contributor

Re: which option can tar a directory to tape

try "tar -cv -C /directory_name ."


Pete

Pete
Sunil Sharma_1
Honored Contributor

Re: which option can tar a directory to tape

tar cvf
*** Dream as if you'll live forever. Live as if you'll die today ***
Rambo_1
Regular Advisor

Re: which option can tar a directory to tape

Thanks all

And, I want to tar more than one directory to tape ,such as directory1 , directory2 , directory3 , which option should be used ?
and , what command to restore them from tape ?

thanks again
Bart Paulusse
Respected Contributor

Re: which option can tar a directory to tape

Hi Rambo,

to restore replace the c with x (extract)

tar -xvf

man tar will tell you a lot more than we can...

multiple directories:

tar -cvf -C -C .....etc.

regards,

Bart
Pete Randall
Outstanding Contributor

Re: which option can tar a directory to tape

Rambo,

That's why I gave you the example with the -C option:

tar -cv -C /directory_name . -C /other_directory .

- or, if you're not using the default tape device /dev/rmt/0m -

tar -cvf /dev/rmt/?m -C /directory_name . -C /other_directory .


This method does a cd to the specified directory before tar'ing it's contents and you can just keep on adding -C options until you've covered all the directories you want to.

Restoring, as mentioned, is done with the -x option.


Pete

Pete
Joseph Loo
Honored Contributor

Re: which option can tar a directory to tape

hi,

to tar many directories:

# tar -cvf ...
but watch for the size of your tape

to untar use -xvf option

and to view, use -tvf option following by the

regards.
what you do not see does not mean you should not believe
V. Nyga
Honored Contributor

Re: which option can tar a directory to tape

Hi,

one more tip:
tar restores date with the path you write it!
So often it's better to create tar files with a relative path ./dir if you want to exchange files for example.
So you can write it in any directory where the relative path is restored.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***