Recovering a deleted ZFS partition?

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
Posts: 1
Joined: 02 Apr 2014, 14:53

Recovering a deleted ZFS partition?

#1 Post by Petro »

Howdy folks.

Through a cascade of errors too embarrassing to admit, I've lost the partition table on a ZFSOnLinux mirror set of mine.

The disks are 3TB WD Reds, formatted with GPT labels and ZFS partitions using gpart.

I know that prior to partition deletion, there was a partition #1 that held the ZFS volume and a partition #9, that held the volume descriptor.

Running a deepscan in TestDisk returns this:

Code: Select all

Disk /dev/sdb - 3000 GB / 2794 GiB - CHS 364801 255 63
     Partition               Start        End    Size in sectors
>P Mac HFS                145095330  715524771  570429442
So, I have two questions:

1.) I'm not completely certain what I should set the type as, on that disk. Obviously, HFS isn't right. gdisk tells me there's a protective MBR on that disk, but my gut feeling is that I'd set it as EFI System and then set the type to ZFS. Am I correct in this reasoning?

2.) I know from searching this forum, that TestDisk can't discern the size of a ZFS volume on it's own. (It's reporting this as 272GiB). The usual trick for recovering a deleted ZFS partition is to manually (A)dd the partition after a scan, use the TestDisk reported starting sector, and then set the end location to the starting sector of the next partition on disk -1 sector.

...but I'm not seeing that 9th partition in my scans. Would anyone happen to know how I might discern that final sector on the first partition? Some additional reading has told me that even without that 9th partition, ZFS will probably be able to figure out what's going on.

I'd appreciate any and all guidance that anyone might offer. Any relevant documentation, other tools or advice would be great.