# ZFS Data Recovery



## passager (Oct 19, 2011)

I have two hard drives that were in a mirrored array but stopped working. I didn't set them up, but I'm trying to recover them. The partitions are visible in gparted, but I can't get them to mount at all. I can get around linux but I don't quite know enough about FreeBSD to troubleshoot this one on my own.

Do the drives have to be in the same mirrored array to read them? Is there a way to mount them in linux? (ubuntu-zfs and zfs-fuse don't seem to be working for me). 

Any help at all is much appreciated.


----------



## SirDice (Oct 19, 2011)

Depending on the ZFS version you may be able to mount it on Linux. But I think the Linux ZFS is only at version 15. So if you have a newer ZFS (version 28 for instance) it's not going to work.

Post the output of zpool status so we can see how it's set up.


----------



## vermaden (Oct 19, 2011)

SirDice said:
			
		

> But I think the Linux ZFS is only at version 15.



Its also on v28: http://zfsonlinux.org/


----------



## davidgurvich (Oct 19, 2011)

You could try the PC-BSD 9 live or install dvd/usb image.  That uses FreeBSD 9 and will have the same version of zfs.

There is also the openindiana and oracle's solaris express cds.


----------



## soulreaver1 (Oct 20, 2011)

You can find useful commands here: ZFS Administrator Guide. Read chapter "Repairing ZFS Storage Pool-Wide Damage".


----------



## passager (Oct 21, 2011)

Thank you for the help.  The ZFS Administrator Guide is exactly what I needed to point me in the right direction.

So far, FreeBSD hangs at 'Mounting local file systems', so I haven't been able to get anything like a zpool status. I need to 
- Boot without the pool
- Move the zpool.cache file
- Do an fmdump to figure out what went wrong. 

But I can't do any of those.

Booting without looking for the pool (boot -m milestone=none) still hangs at 'Mounting local file systems..' I can however boot with the drives disconnected. I moved the zpool.cache file, but the system still hangs at boot. The file looked like either it's a binary file or it was corrupted.
Just to make it more interesting, when it boots without the drives, and I've done an fmdump, it says Command not found. So I can't even do the next step.

So, is there any way for me to get the information on the zpool from the zpool.cache file itself? 
Is there any way to get the zpool information from the drives themselves? 
Is there a way to boot the drives alone without the zpool (isn't that the whole purpose of a mirrored array?).
Is it possible to rebuild the zpool without knowing how it was originally setup?

Thanks again.


----------



## passager (Oct 21, 2011)

Another question: When I boot a version of FreeBSD 8.2p3, and do a zpool status I still get no pools available. But if I do a zpool import, I get:

```
pool: nwp
id: ##BUNCHOFNUMBERS##
state: online
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and the '-f' flag.
see : http://www.sun.com/msg/ZFS-8000-EY
config
nwp    ONLINE
  mirror    ONLINE
    gpt/ada0    ONLINE
    gptid/1fd65c..... ONLINE
```

What's the risk to the data on the drives if I do the zpool import -f?\


----------



## soulreaver1 (Oct 21, 2011)

> What's the risk to the data on the drives if I do the zpool import -f?\



Well, importing the pool is the only way to do anything with that. If it would be imported than you can use all zfs/zpool commands.



> So, is there any way for me to get the information on the zpool from the zpool.cache file itself?


I'm not sure, but think that zpool.cache is only storing "cache" data to be written on zpool. If something goes wrong (ex. I/O Errors), it may be a need to delete this file



> Is there any way to get the zpool information from the drives themselves?


You need to import pool first, than use "*zpool status*".



> Is there a way to boot the drives alone without the zpool (isn't that the whole purpose of a mirrored array?).


Disable/comment 
	
	



```
zfs=enable
```
 line in /etc/rc.conf. It would disable zfs auto mount devices at startup. ZFS would start if you use any of zfs/zpool command.



> Is it possible to rebuild the zpool without knowing how it was originally setup?


"*zpool import*" would tell you name of your pool. If you would "*zpool import -f*" it, then the pool (whatever mirror or raid) would be mounted as it should be. ZFS will do it for you.


----------

