1834461 Members
2845 Online
110067 Solutions
New Discussion

File Recovery on DAT

 
vipa
Occasional Advisor

File Recovery on DAT

HP-UX version is B10.01. how can I view a file located on C1533A device 4GB DAT and possibly recover this file. The backup was not done using fbackup?
13 REPLIES 13
Patrick Wallek
Honored Contributor

Re: File Recovery on DAT

You really need to know exactly how the backup was done. You say it wasn't fbackup. OK, so was it tar, cpio, ftio, dd? Something else?
vipa
Occasional Advisor

Re: File Recovery on DAT

backup was called buroot. trying to view the /etc/hosts file to resolve my network setup problem,which you also replied to.
Thanks for your help.
harry d brown jr
Honored Contributor

Re: File Recovery on DAT

do this:

dd if=/dev/rmt/TAPEDRIVENAMEHERE bs=1024 count=1 | od -bc

then post the output here

also try

dd if=/dev/rmt/TAPEDRIVENAMEHERE bs=1024 count=1 | what


live free or die
harry d brown jr
Live Free or Die
Bill Hassell
Honored Contributor

Re: File Recovery on DAT

buroot sounds like a script that someone wrote. There are several backup choices in addition to fbackup. You can try tar, cpio, pax (which reads both tar or cpio), dump, even ftio. Without knowledge of the actual backup program, you'll just have to try various tools to see if any of them can read the tape. Start with pax:

pax -v -f /dev/rmt/0m


Bill Hassell, sysadmin
vipa
Occasional Advisor

Re: File Recovery on DAT

dd if=/dev/rmt/TAPEDRIVENAMEHERE bs=1024 count=1 | od -bc
output = a ton of files, to many to post.

dd if=/dev/rmt/TAPEDRIVENAMEHERE bs=1024 count=1 | what
output = 1+0 records in,1+0 records out

ran pax -v -f /dev/rmt/0m
output = a ton of files. ran for 15 minutes and had to halt.

Bill Hassell
Honored Contributor

Re: File Recovery on DAT

Great. pax can read the tape for you. Change the command to:

pax -v -f /dev/rmt/0m > /var/tmp/mytape.index

and go have dinner. tar/cpio/pax do not have a central index so the entire tape must be read to create the index file. When the command is done (plan for an hour or so), do this:

grep etc/hosts /var/tmp/mytape.index

It will report either /etc/hosts or ./etc/hosts or maybe etc/hosts. The leading / is a problem because tools like tar will try to restore in right back where it came from. If this is the case, you'll need to restore using the pax options -k (to prevent accidental overlay of existing files), and -s to rename the /etc/hosts file to something like /tmp/oldhosts.


Bill Hassell, sysadmin
vipa
Occasional Advisor

Re: File Recovery on DAT

mytape.index is now in /var/tmp
grep pulls up 3 files containing "etc/hosts"
How can I view these files to see if this is what I want to restore? If it is, what would the command be?
I also noticed a file in /var/tmp called index.
lawrenzo
Trusted Contributor

Re: File Recovery on DAT

I believe you can use tar;

so from the index file have to restore the file first before you can view is.

as long as the file you require does not have the absolute path ie /etc/hosts then go to /tmp and do

tar xvf /dev/rmt/0m etc/hosts

then the file will be in /tmp/etc/hosts.

if this is the file then move it into place.

HTH
hello
vipa
Occasional Advisor

Re: File Recovery on DAT

From /var/tmp;
tar xvf /dev/rmt/0m etc/hosts says;
Tar: blocksize = 10
directory checksum error
Bill Hassell
Honored Contributor

Re: File Recovery on DAT

You'll have to use pax. HP's version of tar cannot handle diferent blocksizes automattically. Use something like:

cd /var/tmp
pax -r -k -i -f /dev/rmt/0m etc/hosts

The above command will prevent accidental overwrite of etc/hosts. and will pause to ask you what to call the restored file. If will say something like:

rename etc/hosts?

(don't answer yes or no) just answer the new name like: /var/tmp/host1

Since you said there were several copies, the tape was recorded in append mode so when the next copy is found, answer with another name like /var/tmp/host2 and so on.

Multiple backups on the same tape are almost as bad as no written information on the tape. There is no command to get the 2nd or 3rd file, just quick fingers typing CTRL-C. It is definitely not a recommended practice to store the same files on the same tape.


Bill Hassell, sysadmin
vipa
Occasional Advisor

Re: File Recovery on DAT

The 3 files that grep etc/hosts/var/tmp/mytape.index found were; etc/hosts, etc/hosts.old, usr/newconfig/etc/hosts. all ok.
ran pax -r -k -i -f/dev/rmt/0m etc/hosts & it did exactly what you said. What do the switches mean? I looked at etc/hosts & found 127.0.0.1 & 192.168.0.1. How do I get 127.0.0.1 into the IP addresses? What file contains the gateway info?
Bill Hassell
Honored Contributor

Re: File Recovery on DAT

As with all Unix commands, the man page gives you all the details. Type the command:

man pax

The switches are:

-r recover (read) files
-k do not overlay existing files on disk
-i interactive renaming of files
-f name-of-tape-devicefile

The hosts file is simply: IP-addr hostname
so your entire hosts file would be this:

127.0.0.1 localhost loopback
192.168.0.1 mycomputer

Now 192.168.0.1 looks suspiciously like a router address, not a computer address. The best way to configure your LAN settings is to run this command (after you have the required information):

set_parms inital

You need the following address information:

hostname (lowercase, no FQDN like name.company.com)
IP address for your computer
subnet mask (ask your network administrator or use the standard 255.255.255.0)
gateway IP adress
DNS server information (ask your network administrator)


Bill Hassell, sysadmin
vipa
Occasional Advisor

Re: File Recovery on DAT

Bill, Thanks for the info on the man page. I am just learning HP-UX. This server was setup on an MS workgroup through a router 192.168.0.1 All the clients could use telestar to acess the HP9000. I can't get the right combination of network setup to do the same thing. I ran set_parms initial many times without luck. I set 192.168.0.100 as the IP address of the HP9000 and 192.168.0.1 as the gateway. I can ping 192.168.0.100 and 127.0.0.1 & 192.168.0.1 from another computer ok. 127.0.0.1 used to be in the Internet Addresses but now it is not. Still confused.