# ZFS - FreeBSD / Linux compatibility issue (USB drive)



## funkz (Jan 31, 2014)

Hi all,
I recently decided to try using ZFS on an external USB3 HDD. I created the pool and slice in FreeBSD 9.2, and am having issues importing it in Ubuntu linux.

Here's the USB drive and pool (just started a scrub):

```
da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
da0: <SAMSUNG HD103SI 0010> Fixed Direct Access SCSI-2 device 
da0: 40.000MB/s transfers
da0: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da0: quirks=0x2<NO_6_BYTE>
```


```
[root@skunk /home/funkz]# zpool list
NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dumpy     928G   257G   671G    27%  1.00x  ONLINE  -

[root@skunk /home/funkz]# zpool status
  pool: dumpy
 state: ONLINE
  scan: scrub in progress since Fri Jan 31 22:13:04 2014
        11.2G scanned out of 257G at 30.9M/s, 2h15m to go
        0 repaired, 4.36% done
config:

	NAME        STATE     READ WRITE CKSUM
	dumpy       ONLINE       0     0     0
	  da0s1     ONLINE       0     0     0

errors: No known data errors
```
The issue is, I cannot get it to import on my Ubuntu 13.10 desktop machine. I am using the following ZFS packages in Ubuntu:

```
darkstar:~> sudo dpkg --get-selections | grep zfs
libzfs1						install
ubuntu-zfs					install
zfs-dkms					install
zfs-fuse					deinstall
zfsutils					install
```
Here is the output of a couple of commands when the USB drive is plugged in - as you can see it thinks the pool is faulted:

```
darkstar:~> sudo zpool list
no pools available
darkstar:~> sudo zpool status dumpy
cannot open 'dumpy': no such pool
darkstar:~> sudo zpool import dumpy
cannot import 'dumpy': one or more devices is currently unavailable
darkstar:~> sudo zpool import 
   pool: dumpy
     id: 7833949838513738690
  state: FAULTED
 status: One or more devices contains corrupted data.
 action: The pool cannot be imported due to damaged devices or data.
   see: http://zfsonlinux.org/msg/ZFS-8000-5E
 config:

	dumpy                                 FAULTED  corrupted data
	  ata-SAMSUNG_HD103SI_S1VSJ1PB401587  UNAVAIL  corrupted data
darkstar:~>
```
If I plug the drive back into the FreeBSD box, it works like a charm. Just run `zfs import dumpy` and it's there ready.
Can anyone provide some insight? Does it have to do with it being da0 on one box and ata-SAMSUNG...etc on the other?

Cheers.


----------



## SirDice (Jan 31, 2014)

funkz said:
			
		

> Does it have to do with it being da0 on one box and ata-SAMSUNG...etc on the other?


That's very much possible. Although I thought that ZFS uses the drive's UUID internally. The UUID of the drive should be the same on both systems but I'm not sure how Linux handles them.


----------



## ShelLuser (Jan 31, 2014)

Which Ubuntu version are you using? More importantly: which version(s) of ZFS does it support?

Because I don't think it's related to the OS not being able to access the device. If that would be the case it wouldn't have recognized the pool name. I'm tempted to blame it on incompatible ZFS versions, though I cannot be sure of that of course.


----------



## funkz (Jan 31, 2014)

@ShelLuser, what you say makes sense. I'm using Ubuntu 13.10. But I just checked both FreeBSD/Ubuntu and they are reporting exactly the same output for the below commands:


```
[root@skunk /home/funkz]# zfs upgrade -v
The following filesystem versions are supported:

VER  DESCRIPTION
---  --------------------------------------------------------
 1   Initial ZFS filesystem version
 2   Enhanced directory entries
 3   Case insensitive and filesystem user identifier (FUID)
 4   userquota, groupquota properties
 5   System attributes

For more information on a particular version, including supported releases,
see the ZFS Administration Guide.

[root@skunk /home/funkz]# zpool upgrade -v
This system supports ZFS pool feature flags.

The following features are supported:

FEAT DESCRIPTION
-------------------------------------------------------------
async_destroy                         (read-only compatible)
     Destroy filesystems asynchronously.
empty_bpobj                           (read-only compatible)
     Snapshots use less space.
lz4_compress                         
     LZ4 compression algorithm support.

The following legacy versions are also supported:

VER  DESCRIPTION
---  --------------------------------------------------------
 1   Initial ZFS version
 2   Ditto blocks (replicated metadata)
 3   Hot spares and double parity RAID-Z
 4   zpool history
 5   Compression using the gzip algorithm
 6   bootfs pool property
 7   Separate intent log devices
 8   Delegated administration
 9   refquota and refreservation properties
 10  Cache devices
 11  Improved scrub performance
 12  Snapshot properties
 13  snapused property
 14  passthrough-x aclinherit
 15  user/group space accounting
 16  stmf property support
 17  Triple-parity RAID-Z
 18  Snapshot user holds
 19  Log device removal
 20  Compression using zle (zero-length encoding)
 21  Deduplication
 22  Received properties
 23  Slim ZIL
 24  System attributes
 25  Improved scrub stats
 26  Improved snapshot deletion performance
 27  Improved snapshot creation performance
 28  Multiple vdev replacements

For more information on a particular version, including supported releases,
see the ZFS Administration Guide.
```

The USB drive is at the latest version as expected:

```
[root@skunk /home/funkz]# zfs get version
NAME           PROPERTY  VALUE    SOURCE
dumpy          version   5        -
storage        version   5        -
storage/media  version   5        -
[root@skunk /home/funkz]# zpool get version
NAME     PROPERTY  VALUE    SOURCE
dumpy    version   -        default
storage  version   28       local
```

Oh... it doesn't have a value under version.. hmm...


----------



## usdmatt (Jan 31, 2014)

Does the `zpool upgrade -v` output on your Linux box show it supports feature flags?
The missing version number for dumpy shows it's a 'feature flags' (version 5000) pool.

ZFS-on-Linux does support feature flags but depending on how long ago you installed it, it's possible yours doesn't.
I've no idea how trying to import a v5000 pool on a v28 system will behave, but showing 'corrupted data' is entirely plausible.

Disk names or IDs shouldn't matter. All the information ZFS needs it will find by scanning the labels stored on the disk.


----------



## Nukama (Feb 1, 2014)

I've also had some corrupted data as I was trying to import a pool lastly used by a compiled version newer than 0.6.2 from github in an installation of FreeBSD-{9.2,10.0}-RELEASE or a zfsonlinux installation based on {spl,zfs}-0.6.2.


```
status: The pool metadata is corrupted.
 action: The pool cannot be imported due to damaged devices or data.
    see: http://illumos.org/msg/ZFS-8000-72
 config:

   share                                 FAULTED  corrupted data
     disk/by-partlabel/serialnumber      ONLINE
```


----------



## j77h (Jun 22, 2014)

usdmatt said:
			
		

> ZFS-on-Linux does support feature flags ...


Does this page help?
http://open-zfs.org/wiki/Features

The first table (under 'Feature Flags ') seems to show that ZFS-on-Linux is missing a few features that are present in FreeBSD STABLE, but not vice versa. I hope this means that moving a pool from Linux to FreeBSD is easy (although moving from FreeBSD to Linux might not be possible).

But what if you have both Linux and FreeBSD machines at the same time, and you want to move a zpool from one to the other at will? If a pool was *created by* ZFS-on-Linux, and if FreeBSD were to merely import and write to it, would that change the pool in such a way that ZFS-on-Linux would subsequently not be able to use it?


----------



## j77h (Jun 22, 2014)

I wrote:


> if FreeBSD were to merely import and write to it, would that change the pool in such a way that ZFS-on-Linux would subsequently not be able to use it?


From this page http://open-zfs.org/wiki/FAQ#Compatibility the answer seems to be "no problem" :

"Pools can be moved freely between different implementations of OpenZFS wherever the implementations support the same feature flags."

Also it says "You can disable a feature flag for a pool when the pool is created. This may be appropriate if you expect to use the pool with a different implementation that does not support the feature." 
But when starting from Linux, this should be taken care of by the fact that ZFS-on-Linux has no feature that FreeBSD doesn't have.


----------



## ondra_knezour (Jun 22, 2014)

As far as I know, the ZFS filesystems are not "automagically" upgraded during import on systems which supports more feature flags, you have to issue the zpool(8) and/or zfs(8) `upgrade` command(s). Consult linked manpages for more info. But bear in mind that like with all interoperability questions, nobody can give you better advice than own testing in environment in question.
---
Edit: After rereading the thread it looks to me, that I am responding more to some of the responses in discussion that the original questions


----------

