1826811 Members
3679 Online
109704 Solutions
New Discussion

Re: Backup using TAR

 
SOLVED
Go to solution
Mauro_3
Advisor

Backup using TAR

Hi,

I want to backup some directories using tar and bzip2. In my tape I should have 04_07_03.bz2 where 04_07_03 is the backup date. In this file I should have all the directories that I want to backup, for example /dir1, /dir2 and /dir3. If I have disk space I should copy each directory to /temp then compress /temp and then put on the tape, but I do not have space in my disk, so I want to do it using just one command line and with no need of /temp directory, so I have to put it directly on the tape, like:
tar cjvf /dev/nst0 /dir1 /dir2 /dir3, but using it I can not put the name in the file and I need it to indicate the backup date.

Any ideas ?

Cheers,
Mauro
4 REPLIES 4
Ramkumar Devanathan
Honored Contributor
Solution

Re: Backup using TAR

Mauro,

you can achieve a space saving, use this with "gnu tar" -

$ tarname=`date +%m_%d_%y`.tar.bz2

$ tar cjvf $tarname /dir1 /dir2 /dir3

works fine for me with gnu tar.

- ramd.
HPE Software Rocks!
Mauro_3
Advisor

Re: Backup using TAR

Ramkumar,

It works but the file you called "tarname" would be in my disk not on the tape. This is the problem, after what you said I should do a tar cvf /dev/nst0 tarname to put on the tape, but I do not have disk space to create the "tarname" file. Do you undestand my problem ?

Cheers,
Mauro
Ramkumar Devanathan
Honored Contributor

Re: Backup using TAR

Mauro,

while creating the tar bzip file, wouldn't writing to stdout and then redirecting that to the tape device help?

i haven't tried this ever. so i might be silly in asking this question.

- ramd.
HPE Software Rocks!
Ramkumar Devanathan
Honored Contributor

Re: Backup using TAR

Mauro,

can you explain to me how if the /dev/nst0 is your final tape file, you can create another file with the date as a name? maybe you could create another tape file /dev/`$tapename` using mknod and then write to that?

Would that help either?

So tell me, once you write to tape, the next time around when you mount the tape device, still the tape name would be /dev/nst0 isn't it?

Initially i thought that you were avoiding creating an intermediate tar file before creating the zip file.

or else, stick labels on the tapes to show the date of backup ;-))) i know i am asking for some good kicks in the back if i suggest this...

- ramd.
HPE Software Rocks!