recovery partition table from fdisk?

I have two disks on a sun blade 100. I just installed a solaris8 on the first disk. The installation was successful. But the problem is now I lost all data / partition on my second hard disk.

The possible reason could be:

  1. I used default web start install. During the installation I didn't select the disk2. so I am not sure if solaris 8 will automatically erase the whole partition table on all disks in the system.
  2. I did something like:
    fdisk /dev/rdsk/c0t2d0s0 (the 2nd disk)
    and answered 'yes' when it asked "type 'y' to accept the default partition. otherwise type 'n' to edit the partition table.

Now I guess 2 has caused the problem. and might have wiped out the partition table on the 2nd disk. Is there any way to recover it back? cuz the data are very important. I am a beginner in solaris. please offer your generous help here.

Thanks,
motor98

without interaction solaris don't "format" other disks then the selected (!) normaly there is no way to get a partition table back

see:

gP

**
i am working a long time with solaris now, but i've used fdisk only 2 times for scripting. always wondering what everyone does with that tool.... you can manage the partition table with the CLI-tool "format" or with the GUI "smc"
**

you may be able to get a good guess at the lost partition table if you can look at another box with an approximate build ... if not, try setting the partition table on the second drive to hold everything in the root slice ...

for future use ... get a script that prints out the partition table on both drives regularly so you have a hard copy of it ... (see ugly code; use your disk designators)

for disk in c0t0d0s2 c0t1d0s2 (...)
do
    echo "Begin ${disk}"
    prtvtoc /dev/rdsk/${disk}
    echo "End ${disk}\n\n"
done > myfile
mailx -s "disk partitions for `hostname` - `date`" my.email < myfile

to recover,

awk '/Begin ${disk}/,/End ${disk}/' myfile | egrep -v "^Begin|^End" | fmthard -s - /dev/rdsk/${disk}