Operating System - HP-UX
1831294 Members
3607 Online
110022 Solutions
New Discussion

using tar to list backup date

 
SOLVED
Go to solution
Norman_21
Honored Contributor

using tar to list backup date

Hi Guys,

I would appreciate if someone can advise how to extract the last date from a tar backup tape.
the command
tar tv
will list all the files. I don't realy need to see the files but just the date.
Thanks in advance.
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
6 REPLIES 6
Michael Tully
Honored Contributor
Solution

Re: using tar to list backup date

Hi,

As 'tar' does not actually create a header from which the backup has been performed (like 'fbackup'), it is not actually possible to get an exact date.

You could however guesstimate by extracting a file list and viewing the contents of /tmp or /var/tmp These two areas do get files written to them all the time.

Regards
Michael
Anyone for a Mutiny ?
Norman_21
Honored Contributor

Re: using tar to list backup date

Hi Micheale,

I appreciate your quick support. Could you please provide me with an example.
This is very important because I mixed up the labels on two tape with the same date and I want to find out which is which.

Thanks again.
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
Michael Tully
Honored Contributor

Re: using tar to list backup date

To get the contents off the tape. Substitute you tape drive device if yours is different to /dev/rmt/0m

# tar tvf /dev/rmt/0m >/tmp/tape.out

One good example of getting the date and time of a file other than something in /var or /var/tmp is
/etc/utmp
/var/adm/wtmp
/var/adm/syslog/syslog.log

If you can, I suggest you use 'fbackup'. It creates volume headers, it is far more flexible than 'tar' and can write more than 2Gb of data to tape. 'tar' cannot do these things.

HTH
Michael
Anyone for a Mutiny ?
T G Manikandan
Honored Contributor

Re: using tar to list backup date

tar does not have a header to find out the date directly.
The only way is to do a tvf of the file you are trying to restore.

as Micheal suggested fbackup has those features
It uses this
/var/adm/fbackupfiles/dates
file to store the date of backup.
THus incremental backup's are possible using fbackup.

Thanks
Elif Gius
Valued Contributor

Re: using tar to list backup date


Go to the directory you want to tar...then "touch a file" and after that create your tar archive of the directoriy...

then you 'll have a file which will tell you the date
in a script you can do something like this

#Time stamp
temp="/dir/$(date +%d.%m.%y_%H:%M)"
touch $temp


Norman_21
Honored Contributor

Re: using tar to list backup date

Closed...
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003