1832938 Members
2954 Online
110048 Solutions
New Discussion

Re: TAR command

 
Mauro_8
Frequent Advisor

TAR command

Hi,

I want to backup some files in a tar file, named day_of_month.tar and send to the tape. But I do not have free space to create this tar file in my hard disk and then send to tape. So, is there a way of creating this file on the tape without using a temp file in the hard disk ?

I??m doing this:

%tar cvf /home/temp.tar /opt /var /work
%tar cvf /dev/rmt/0mn /home/temp.tar

I want to avoid the creation of temp.tar.

Cheers,
Mauro
5 REPLIES 5
RAC_1
Honored Contributor

Re: TAR command

tar -cvf /dev/rmt/0m /opt /var /work

is all you require
There is no substitute to HARDWORK
Jeff Schussele
Honored Contributor

Re: TAR command

Hi Mauro,

You can just tar them directly to the tape drive

tar cvf /dev/rmt/0mn /opt /var /work

They will not be in a tar file on the tape but just the actual files archived with absolute pathnames.
So if you think you may want to extract them to another location, you may wish to tar them up as relative pathnames as follows:

cd /
tar cvf /dev/rmt/0mn ./opt ./var ./work

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Vicente Sanchez_3
Respected Contributor

Re: TAR command

Hi Mauro,

I don't know different sizes of directories, but perhaps you can try this:

%tar cvf /home/opt.tar /opt
compress /home/opt.tar
%tar cvf /home/var.tar /var
compress /home/var.tar
%tar cvf /home/work.tar /work
compress work.tar
%tar cvf /home/temp.tar /home/*.Z (files compressed)

Regards, Vicente.



Mauro_8
Frequent Advisor

Re: TAR command

Hi,

I agree with all but these way I am going to have a lot files in the tape instead of just one. With just one file I could set the day of the backup, for example, I want to have in the tape a file called 10_22_2002.tar that contains all the files that I did backup. It helps me if I need to restore some file.

Cheers,
Mauro
Darrell Allen
Honored Contributor

Re: TAR command

Hi Mauro,

To help identify the date the tar was written to the tape, you can do something like this:

cd /
DATEFILE=$(date +%m_%d_%Y)
touch $DATEFILE
tar cvf /dev/rmt/0m $DATEFILE ./opt ./var ./work
rm $DATEFILE

Whenever you want to see the date the tar was created, simply do:
tar tf /dev/rmt/0m | head -1

Running this today creates an empty file named 10_22_2002. It will be the first file on the tape and will be listed by the "tar tf /dev/rmt/0m | head -1" command.

This means your tar will contain an extra file (10_22_2002) but it's an empty file that shouldn't present a problem.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)