Virtual Solaris ZFS raw disks Topic is solved

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
AmitDeshwar
Posts: 4
Joined: 14 Mar 2012, 17:42

Virtual Solaris ZFS raw disks

#1 Post by AmitDeshwar »

Hi

I'm running a Solaris 11 VM (using Vmware Workstation) on a Win7 host. It looks like I may have accidentally "initialized" my ZFS disks in Windows (which were being accessed as raw drives from the solaris VM). Now, in Solaris the disks simply report "cannot open" and format cannot see the geometry of the disks.
Does this sound like an MBR issue?
Does TestDisk fix ZFS partitions?

Thanks,
Amit
User avatar
cgrenier
Site Admin
Posts: 5438
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Virtual Solaris ZFS raw disks

#2 Post by cgrenier »

TestDisk can locate partitions using ZFS filesystem but it doesn't know how to find the filesystem size. So in pratice, you have to manually add (using 'a') after Quick Search or Deeper Search each ZFS partition using the beginning found by TestDisk and use for the partition end the location of the next partition minus one sector.
AmitDeshwar
Posts: 4
Joined: 14 Mar 2012, 17:42

Re: Virtual Solaris ZFS raw disks

#3 Post by AmitDeshwar »

Okay, that's good news that it can properly detect them.
As additional information, these disks are part of a RAIDZ configuration, with the whole disk being used by ZFS. Quick search finds the following partition:

Code: Select all

 2 P Whole disk                                          0      0  1  121601   80 63 1953525168
I tried using the write command, but it gave an error about write_sun_part not being implemented.
Does that mean I should manually add a partition with identical information (start at 0, end at 121601, type "whole disk") and then write that?
AmitDeshwar
Posts: 4
Joined: 14 Mar 2012, 17:42

Re: Virtual Solaris ZFS raw disks

#4 Post by AmitDeshwar »

Even after manually adding the partition I still received the "write_sun_part" error.
What should I do?
AmitDeshwar
Posts: 4
Joined: 14 Mar 2012, 17:42

Re: Virtual Solaris ZFS raw disks

#5 Post by AmitDeshwar »

In case anyone has the same problem as me in the future:
I managed to fix the problem using dd.
After examining the disks, it appeared that the Windows initialization only overwrote the MBR and left the rest of the GPT intact. Luckily in disks that use GPT, the MBR doesn't contain anything useful or unique to the disks/partitions.
I fixed the problem by copying the MBR from one of my remaining good disks to the "bad" disks. This allowed solaris to recognize them properly.
To copy the MBR from a good disk to a file:
dd if=/dev/dsk/GOODDISK of=./gooddisk.dd bs=512 count=1
To copy the MBR on disk to the bad disk:
dd if=./gooddisk.dd of=/dev/dsk/BADDISK bs=512 count=1
I've attached a zip file containing the MBR I copied over in case all of your disks have been wiped. Remember to unzip before copying!!!!
Attachments
c0d0.zip
(148 Bytes) Downloaded 882 times
User avatar
Fiona
Posts: 2835
Joined: 18 Feb 2012, 17:19
Location: Ludwigsburg/Stuttgart - Germany

Re: Virtual Solaris ZFS raw disks

#6 Post by Fiona »

Thank you for your feedback! :)
I'll set your topic as solved.
Locked