ZFS Unable to import zpool

Hi!
suddenly the system crashed and it no longer boot.
I had to change to a backup HDD but now I would like to be able to recover some data from the other disk.
So I installed that HDD in an external HDD adapter and connected in the USB port to be used as external disk.
Code:
# sudo gpart show /dev/da0
=>       40  976773088  da0  GPT  (466G)
         40     532480    1  efi  (260M)
     532520       1024    2  freebsd-boot  (512K)
     533544        984       - free -  (492K)
     534528    4194304    3  freebsd-swap  (2.0G)
    [B]4728832  972044288    4  freebsd-zfs  (464G)     <<< this is the partition I want data from[/B]
  976773120          8       - free -  (4.0K)
So I try to import the zpool and got
Code:
# sudo zpool import -f -R /mnt zroot zrootbad -N
cannot import 'zroot' as 'zrootbad': one or more devices is currently unavailable
Code:
# sudo zdb -l /dev/da0
failed to unpack label 0
failed to unpack label 1
------------------------------------
LABEL 2
------------------------------------
    version: 5000
    name: 'zroot'
    state: 0
    txg: 256475
    pool_guid: 101790034375230234
    errata: 0
    hostname: 'beethoven'
    top_guid: 12788663817577105041
    guid: 12788663817577105041
    vdev_children: 1
    vdev_tree:
        type: 'disk'
        id: 0
        guid: 12788663817577105041
        path: '/dev/ada0p4'
        phys_path: 'id1,enc@n3061686369656d30/type@0/slot@1/elmdesc@Slot_00/p4'
        whole_disk: 1
        metaslab_array: 256
        metaslab_shift: 32
        ashift: 12
        asize: 497681956864
        is_log: 0
        create_txg: 4
    features_for_read:
        com.delphix:hole_birth
        com.delphix:embedded_data
    labels = 2 3
So I don't know what to do in this situation.
Everything I tried is not working at all.
I just want to recover some files before letting this drive leave to the Heaven of HDD!

Any help would be appreciated.

Thank you in advance.
 
[...]
So I try to import the zpool and got
# sudo zpool import -f -R /mnt zroot zrootbad -N
cannot import 'zroot' as 'zrootbad': one or more devices is currently unavailable

Don't know if it'll help but looking at zpool-import(8):
Code:
NAME
     zpool-import -- import ZFS	storage	pools or list available	pools

SYNOPSIS
     zpool import [-D] [-d dir|device]a|
     zpool import -a [-DflmN] [-F [-nTX]] [--rewind-to-checkpoint]
	   [-c cachefile|-d dir|device]	[-o mntopts] [-o property=value]a|
	   [-R root]
     zpool import [-Dflmt] [-F [-nTX]] [--rewind-to-checkpoint]
	   [-c cachefile|-d dir|device]	[-o mntopts] [-o property=value]a|
	   [-R root] [-s] pool|id [newpool]
I think the command should be:
sudo zpool import -f -R /mnt zroot
or, when identifying the pool by pool_guid:
sudo zpool import -f -R /mnt 101790034375230234

By using the -R option you'll be creating a non-persistent alternate root directory (/mnt) that will be prepended to every mounted filesystem in the imported pool. zpoolprops(7):
Code:
The following property can	be set at creation time	and import time:

     altroot
	     Alternate root directory.	If set,	this directory is prepended to
	     any mount points within the pool.	This can be used when examin-
	     ing an unknown pool where the mount points	cannot be trusted, or
	     in	an alternate boot environment, where the typical paths are not
	     valid.  altroot is	not a persistent property.  It is valid	only
	     while the system is up.  Setting altroot defaults to using
	     cachefile=none, though this may be	overridden using an explicit
	     setting.
With zpool list zroot you'll see the alternate root in the column ALTROOT.

Using the -N option, you could try something like:
sudo zpool import -f -N -d /dev/ada0p4 -R /mnt

Filesystems from the imported pool will not be mounted (pool import only) but when you do manually mount a filesystem with zfs-mount(8) from the imported pool then it will be mounted at /mnt
 
# sudo zpool import -f -R /mnt zroot zrootbad -N
cannot import 'zroot' as 'zrootbad': one or more devices is currently unavailable
This disk was part of a RAID set. What was used? Mirrors? RAID-Z? You cannot 'mount' a single disk from a RAID-Z volume for example, RAID-Z is always spread over multiple disks.
 
Don't know if it'll help but looking at zpool-import(8):
Code:
NAME
     zpool-import -- import ZFS    storage    pools or list available    pools

SYNOPSIS
     zpool import [-D] [-d dir|device]a|
     zpool import -a [-DflmN] [-F [-nTX]] [--rewind-to-checkpoint]
       [-c cachefile|-d dir|device]    [-o mntopts] [-o property=value]a|
       [-R root]
     zpool import [-Dflmt] [-F [-nTX]] [--rewind-to-checkpoint]
       [-c cachefile|-d dir|device]    [-o mntopts] [-o property=value]a|
       [-R root] [-s] pool|id [newpool]
I think the command should be:
sudo zpool import -f -R /mnt zroot
or, when identifying the pool by pool_guid:
sudo zpool import -f -R /mnt 101790034375230234

By using the -R option you'll be creating a non-persistent alternate root directory (/mnt) that will be prepended to every mounted filesystem in the imported pool. zpoolprops(7):
Code:
The following property can    be set at creation time    and import time:

     altroot
         Alternate root directory.    If set,    this directory is prepended to
         any mount points within the pool.    This can be used when examin-
         ing an unknown pool where the mount points    cannot be trusted, or
         in    an alternate boot environment, where the typical paths are not
         valid.  altroot is    not a persistent property.  It is valid    only
         while the system is up.  Setting altroot defaults to using
         cachefile=none, though this may be    overridden using an explicit
         setting.
With zpool list zroot you'll see the alternate root in the column ALTROOT.

Using the -N option, you could try something like:
sudo zpool import -f -N -d /dev/ada0p4 -R /mnt

Filesystems from the imported pool will not be mounted (pool import only) but when you do manually mount a filesystem with zfs-mount(8) from the imported pool then it will be mounted at /mnt
still can't import, I think I did try this one before too
# sudo zpool import -f -R /mnt 101790034375230234
cannot import 'zroot': pool already exists

but if importing to a different name
# sudo zpool import -f -R /mnt 101790034375230234 zrootbck
cannot import 'zroot' as 'zrootbck': one or more devices is currently unavailable

So this means it can't import because it's unable to read the first 2 labels.
I'm having second thoughts on using zfs again.
 
This disk was part of a RAID set. What was used? Mirrors? RAID-Z? You cannot 'mount' a single disk from a RAID-Z volume for example, RAID-Z is always spread over multiple disks.
This disk was auto configured during freebsd install,it's the laptop internal HDD and it's a stand alone setup.
 
I'm having second thoughts on using zfs again.
ZFS is quite resilient to issues, but it's not bullet-proof. Don't blame issues with a broken disk on the filesystem's ability to recover. You could just as easily end up with an unreadable filesystem if you had used UFS.
 
Does anything appear in `dmesg` when you try to import?

Does something like `wc /dev/da0p4` work on the partition in question?
 
Does anything appear in `dmesg` when you try to import?

Does something like `wc /dev/da0p4` work on the partition in question?
this happens in /var/log/messages
Code:
Mar  3 14:27:17 beethoven kernel: (da0:umass-sim0:0:0:0): READ(10). CDB: 28 00 2b 4f 7d a0 00 00 18 00 
Mar  3 14:27:17 beethoven kernel: (da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
Mar  3 14:27:17 beethoven kernel: (da0:umass-sim0:0:0:0): SCSI status: Check Condition
Mar  3 14:27:17 beethoven kernel: (da0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
Mar  3 14:27:17 beethoven kernel: (da0:umass-sim0:0:0:0): Error 5, Unretryable error
Mar  3 14:27:17 beethoven ZFS[24433]: vdev I/O failure, zpool=zrootbck path=/dev/gpt/zfs0 offset=369613426688 size=12288 error=5
Mar  3 14:27:17 beethoven ZFS[24437]: pool I/O failure, zpool=zrootbck error=5
Mar  3 14:27:17 beethoven ZFS[24441]: pool log replay failure, zpool=zrootbck
 
You will need enough storage space to do the job and store the recovered data no matter which tool you use - no surprises there.
 
You will need enough storage space to do the job and store the recovered data no matter which tool you use - no surprises there.
Well, I think I will just have to assume the loss.
Both my HDD have the same storage capacity.
No more ZFS from now on.
 
Yeah, because "SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)" screams "ZFS' fault!".
No.
It's because I've 3 partitions 2 faulty and 1 seems just fine and zpool doesn't let me recover/mount the working one.
What's the deal on having a system securely split in several partitions in the same disk if you're not able to reach the data from the good one because of other that got corrupt?
The good old FAT mounts and complaints for bad sectors, you lose only the files that are in those sectors, all other part of the disk even if the same bad sectors partition still work.
I remember recovering almost all data of a broken FAT HDD, and better, I could still use it if the system exclude/mark those bad sectors.
 
No.
It's because I've 3 partitions 2 faulty and 1 seems just fine and zpool doesn't let me recover/mount the working one.
What's the deal on having a system securely split in several partitions in the same disk if you're not able to reach the data from the good one because of other that got corrupt?

In post #3 SirDice asked you whether this partition was part of a RAIDz. You should have answered that.

If it was a RAIDz1 and you lost 2 partitions then you can't use the last one. But we can't know whether that is the case here since you omitted this vital piece of information even after directly asked for it.
 
In post #3 SirDice asked you whether this partition was part of a RAIDz. You should have answered that.

If it was a RAIDz1 and you lost 2 partitions then you can't use the last one. But we can't know whether that is the case here since you omitted this vital piece of information even after directly asked for it.
No it's not part of a RAIDz and I did respond
"This disk was auto configured during freebsd install,it's the laptop internal HDD and it's a stand alone setup."
I don't remember to see any RAIDz option during the system install but I can be wrong about this, I just don't remember to see that.
 
I don't easily quit ok? I'm still learning this BSD and ZFS stuff so it's natural some criticism from my part, comparing this and that.
I just ordered a 500GB SSD for this old laptop, funny isn't it? but I just don't feel like to throw it away.
Because this backup HDD I'm using right now may also die anytime.
Is there any guide on how to prepare an SSD for FreeBSD? Usually it' comes with FAT32 partition from factory.
What I did last time was let the FreeBSD setup to use all disk space. I didn't prepare the disk, you know, zero byte it with dd or whatever I read in some posts.
Should I delete the original partition or keep it?
And since it's a SSD, is there a recommended setup regarding swap partition, etc to avoid burning it fast?
Or letting FreeBSD setup do it all defaults is enough?

Thanks.
 
in https://arstechnica.com/information...01-understanding-zfs-storage-and-performance/

So that's what happened.
I wasn't "very careful here"
UFS will be then.
That reference you quoted is a good one. Yes, ZFS was designed to work with redundancy; see for example The Birth of ZFS by Jeff Bonwick*. In OpenZFS Basics by Matt Ahrens and George Wilson, you'll see the "redundancy in action" explained for a two-way mirror at the slide Self-Healing Data in ZFS (starting at 26 min) and the next slide "End-to-End Data Integrity in ZFS". ZFS will work without redundancy but, after detecting data integrity error(s) it won't be able to provide you with one of its fundamental features regarding data integrity: repairing the errors by relying on redundancy; you're flying without a "safety net". ZFS doesn't have an fsck(8); it does have zdb(8) but I wouldn't consider that a user utility in the sense to be used in a manner like fsck(8). ZFS is inherently more complex than UFS, in its overall structure and its underlying principles and internal data structures. For ZFS users it's intended to provide a more unified interface to all its facilities than a comparable set of separate dedicated hardware and software utilities combined; think for example about the guaranteed data integrity and integrated volume manager.

Sometimes one is forced to use a single disk without any redundancy (copies=2 does improve the odds slightly) for example with a laptop that does only allow for one internal disk. However, in that case I'd want to work with ZFS only with disk devices in premium condition and of premium quality (as opposed to an error generating disk that is near death). Further I'd want to setup (very) regular backups (think for example ZFS send & receive) in case a hardware error takes the pool on that one disk down and all my data with it.

If, preferably with appropriate hardware support (main criterion: disk data redundancy), you want to delve into ZFS, I'd suggest you have a look at FreeBSD Development: Books, Papers, Slides where the two ZFS books (or DRM-free ebooks) provide a wealth of user oriented ZFS information, even though they were written before OpenZFS, I'd say they are still spot on for all but the most recent OpenZFS developments. (Perhaps have a look at ZFS Administration) For more technical oriented (as opposed to user oriented) look for articles/youtube videos by Mathew Ahrens and his colleagues; The OpenZFS site contains many references. Here on the forums, you'll also find valuable references.

Starting FreeBSD without ZFS does not constitute a less viable environment for using (and learning) FreeBSD; FreeBSD has relied on UFS for decades. Both UFS and ZFS are native filesystems, contained in the FreeBSD base install, and therefore I would suggest you'd not use ext4 as your base filesystem for FreeBSD; for data transfer between FreeBSD and Linux there exist other options.

___
* added: The original 2003 article from Sun about ZFS and its design principles: The Zettabyte File System by Jeff Bonwick, Matt Ahrens, Val Henson, Mark Maybee, Mark Shellenbaum
 
Last edited:
That reference you quoted is a good one. Yes, ZFS was designed to work with redundancy; see for example The Birth of ZFS by Jeff Bonwick and OpenZFS Basics by Matt Ahrens and George Wilson . It'll work without redundancy but, after detecting data integrity error(s) it won't be able to provide you with one of its fundamental features regarding data integrity: repairing the errors by relying on redundancy; you'll be flying without a "safety net". ZFS doesn't have an fsck(8); it does have zdb(8) but I wouldn't consider that a user utility in the sense to be used in a manner like fsck(8); ZFS is inherently more complex than UFS, in its overall structures and its underlying principles and internal data structures. For ZFS users it's intended to provide a more unified interface to all its facilities than a comparable set of separate dedicated hardware and software utilities combined; think for example about the guaranteed data integrity and integrated volume manager.

Sometimes one is forced to use a single disk without any redundancy (copies=2 does improve the odds slightly) for example with a laptop that does only allow for one internal disk. However, in that case I'd want to work with ZFS only with disk devices in premium condition and of premium quality (as opposed to an error generating disk which is near death). Further I'd want to setup (very) regular backups (think for example ZFS send & receive) in case a hardware error takes the pool on that one disk down and all my data with it.

If, preferably with appropriate hardware support (main criterion: disks data redundancy), you want to delve into ZFS, I'd suggest you have a look at FreeBSD Development: Books, Papers, Slides where the two ZFS books (or DRM-free ebooks) provide a wealth of user oriented ZFS information, even though they were written before OpenZFS, I'd say they are still spot on for all but the most recent OpenZFS developments. (Perhaps have a look at ZFS Administration) For more technical oriented (as opposed to user oriented) look for articles/youtube videos by Mathew Ahrens and his colleagues; The OpenZFS site contains many references. Here on the forums, you'll also find valuable references.

Starting FreeBSD without ZFS does not constitute a less viable environment for using (and learning) FreeBSD; FreeBSD has relied on UFS for decades. Both UFS and ZFS are native flesystems, contained in the FreeBSD base install, and therefore I would suggest you'd not use ext4 as your base filesystem for FreeBSD; for data transfer between FreeBSD and Linux there exist other options.
I didn't know, I really didn't know that having zpool with a single device could bring me to a unrecoverable data problem if the zfs gets broken.
The system just crashed and that was it. Gone! Kaput!
I will use UFS in my SSD to arrive.
ZFS is still interesting if I had several devices but it's not the case.

Thank you very very much!
 
It' does not matter if you use zfs or ufs. You must in both cases have a backup strategy...
One of my SSD drives recently died completely. So any filesystem on it is dead.
 
For the record - single disc ZFS is no more prone to complete failure than UFS. But with ZFS, it will tell you the data is flaky instead simply reading Heisensektors. Also you miss things like compression, boot environments and such.
 
Back
Top