Sharing ZFS USB with FreeNAS and Linux? How safe is it?

Status
Not open for further replies.

tprelog

Patron
Joined
Mar 2, 2016
Messages
297
I've been reading up on using an external usb with zfs as a backup drive but I'm still unsure or have not found clear answers to a few remaining questions. Most of what I've read deals with either Linux OR FreeNAS but I can't find much on using the same drive on BOTH.

I bought an external WD usb3 6TB Hard Drive to use for off-line backups and transferring files between sites (without a network). I am using zfs on my server (FreeNAS), as well as zfs-on-linux on both my laptop (KDE Neon) and my desktop (Antergos). My linux computers are only using zfs for storage pools, not for booting.
I plan to use zfs on the WD usb drive and in hoping to maximize flexibility I would like to mount it to both FreeNAS or a Linux box. One at a time of course! :p I know it might be asking for trouble but maybe even create a dataset with Linux in a zpool created by FreeBSD.

Anyways a few questions I have:
After I export my zpool zpool export <pool> is safe to just just unplug the drive? Or put another way, When I am ready to unplug the USB drive, is zpool export <pool> basically the same as "safely removing drive" or "eject" as one might click using USB in normal use with a desktop GUI?

Considering I'd like to read/write files from both Linux and FreeNAS -- Is it preferred to use one OS over the other when creating the zpool or adding datasets? Are there any feature flags I should enable/disable to help avoid issues?
One example I have tested this already. When I use FreeNAS GUI it creates the 2GB partition and the rest is zfs. When I create the zpool using linux the whole drive is zfs with NO 2GB partition at the beginning. Can I zpool create in FreeNAS but still avoid the extra 2GB partition or this something I should keep?

Is it actually safe to create a zpool using FreeNAS, export the pool - then add a dataset AFTER importing the pool in LINUX? I have tested this and it SEEMS to work (export pool from Linux / import the pool back to FreeNAS) But now I am only testing.
I just want to be aware or any unseen risks I could be taking by sharing ZFS on USB between Linux and FreeNAS. Soon the wait will be over! And I can actually start this for real
Badblock on 6TB USB.png
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Considering I'd like to read/write files from both Linux and FreeNAS -- Is it preferred to use one OS over the other when creating the zpool or adding datasets? Are there any feature flags I should enable/disable to help avoid issues?
I would create the pool on Linux if it were me. ZFS on FreeNAS should be able to access it with no trouble except that permissions will be different between the two computers. That might cause you a little trouble.
Can I zpool create in freenas but still avoid the extra 2GB partition or this something I should keep?
That 2GB partition is something you should not keep. That is why I say create the pool on Linux. It is a swap partition and you don't want either OS trying to use it on a drive that you are going to eject.
I just want to be aware or any unseen risks I could be taking by sharing zfs on usb between Linux and FreeNAS. Soon the wait will be over! And I can actually start this for real
One of the concepts behind ZFS (the way it was explained to me) was that it is supposed to be portable, so you are not tied to a single platform. The compatibility is supposed to be such that it does just work.
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
297
Thanks for the reply.
I would create the pool on Linux if it were me. ZFS on FreeNAS should be able to access it with no trouble except that permissions will be different between the two computers. That might cause you a little trouble.
I probably took extra steps here but my drive is formatted and seems to working as expected. I have few users/groups and computers to manage so it's easy for me to manually assign matching UID/GID across all my systems. So far, it seems that's all it takes to keep permissions in check!
I used gdisk a linux box to create a single GPT partition w/ type set to: a504 FreeBSD ZFS
Then from the FreeNAS console I used zpool create -R /mnt <pool> <disk> to create my zpool without the extra 2GB swap. It's probably the same thing but in my mind zfs seems more native to FreeNAS. After trying it both ways I just felt better using FreeNAS to create the pool.

I added some initial datasets w/FreeNAS as well as additional datasets using two different linux distros. Everything including permissions seems to be working out!

One of the concepts behind ZFS (the way it was explained to me) was that it is supposed to be portable, so you are not tied to a single platform. The compatibility is supposed to be such that it does just work.
Great! This is my understanding as well. Testing seems to confirm I can create datasets from both systems without issue as well
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
It was several years ago, but I used to have a RAIDz1 pool of four drives in an external enclosure that I moved between my Linux computer and my FreeNAS server. I never had any trouble with it except for the UID/GID not matching between the two systems initially. Once I gave myself permission, it worked very nicely. Export the pool on one system and import it on the other.
 
Status
Not open for further replies.
Top