ZFS correctly using external zfs hdd between multiple pc`s

Hi, i have multiple pc`s. 2x FreeBSD and 1xLinux (Debian 12 without zfs on root but with zfs for mounting my external 4TB hdd)
My external 4TB drive contains zfs and i want to move him around.
If i want to watch movies/series i want to plug my drive to laptop or daily ( both FreeBSD 14.1-Release) otherwise keep it connected to my WS (Debian 12 ) but i dont want to have plex/jellyfin plus my daily rig is only 250GB ssd so kinda small and 4TB hdd is my escape if i have to download something big.
I did some errors i created zfs pool on my drive i just removed hdd and connected to my WS and then had to use -f option to import but when i moved back to my daily with FBSD on it - i could not use any options and had to reboot and use -f option again.
How correctly i need to move my disk around ?
Do i need to export my pool first every time and then import back in ?
Or i can use zfs umount and then zfs mount options ? or export --> umount --> import --> mount ?
Im a bit struggling to understand zfs/zpool usability
 
How correctly i need to move my disk around ?
Do i need to export my pool first every time and then import back in ?
Yes, before disconnecting the disk, you should use zpool export. Without this, next system will alert you that the pool belongs to another OS.

Or i can use zfs umount and then zfs mount options ? or export --> umount --> import --> mount ?
No, there is no need to use zfs umount. All datasets will be automatically unmounted when the pool is exported.
 
I did some errors i created zfs pool on my drive i just removed hdd and connected to my WS
Do you actually mean: "just removed hdd" --> just unplugged the USB cable ?
If so, where did you get that idea?


Edit: if you just unplug the disk, that is a sudden powerloss.
Although ZFS is rather resilient against a power outage, at a minimum you risk losing some data.
At worst you risk losing the pool: your only option is then to recreate the pool afresh and restore its data from backup.


Using -f* almost always means something has not been done right.

Do i need to export my pool first every time and then import back in ?
Yes, zpool-export(8):
Code:
DESCRIPTION
       Exports the given pools from the    system.     All devices are marked    as ex-
       ported,    but  are still considered in use by other subsystems.  The de-
       vices can be moved between systems (even    those of different endianness)
       and imported as long as a sufficient number of devices are present.

       Before exporting    the pool, all datasets within the pool are  unmounted.
       A  pool    can not    be exported if it has a    shared spare that is currently
       being used.

       For pools to be portable, you must give the zpool command whole    disks,
       not  just partitions, so    that ZFS can label the disks with portable EFI
       labels.    Otherwise, disk    drivers    on platforms of     different  endianness
       will not    recognize the disks.
zpool-import(8) is the natural inverse operation.

___
* Be careful with any -f option, especially in the ZFS world, Today's ZFS Michael W Lucas (from ca. 11:31 min.):
One other thing to remember on ZFS and the ZFS tools is the -f flag is important. It's dangerous and any time you come across -f you should think hard and thoroughly before typing that, and then you shouldn't type that. -f stands for force. [...]

The -f point is worth hammering home twice in this talk, because one of the most common messages you'll see on forums and mailing lists is "I used -f and now my life is terrible." Yes, it is, you used -f.
 
In one word - only two commands for my use case right ? export , disconnect usb hdd , plug to my other pc and --> import and once im done -- export plug to my pc and again --> import ?
Do you actually mean: "just removed hdd" --> just unplugged the USB cable ?
If so, where did you get that idea?
Nowhere, as i mentioned - i did some mistakes. sometimes i forget to write a command and just grab usb out.
But all things considering -f - going to keep in mind specially when my 4TB is non-mirrored and no back-up/recovery if it goes tits up.
 
One more thing: When configuring ZFS options, make sure you only use the common subset of all the OSes you connect the disk to.
 
One more thing: When configuring ZFS options, make sure you only use the common subset of all the OSes you connect the disk to.
I just used this:
# zpool create example /dev/da0
so im sure this is not harmful :) if it is - i will pay the price.
At the moment i just made this way copied all the data back while im reading more about zfs and trying to understand and comparing things between FreeBSD zfs and Linux zfs.

For external disk why don't use FAT32 / exFAT?
Same with zfs isnt ? .. and also i dont have Mac nor Windows and if i need to copy from or to these systems i have usb flash drives.
And im keen to explore zfs more on hard drive with compressions etc. etc. so why waste with other systems when i can play with something is more usefull to me and have better advantages :) if im correct - zfs can dettect errors even on a single disk not sure about exFAT or FAT32 as im kinda forgot about these 2 fs`s.
When i had only Linux machines - my hard drive was ext4.
 
If i want to watch movies/series i want to plug my drive to laptop or daily
Don't know what options are open to you. However, if this (i.e. no real fast IO) is one of your main usage for moving a non-redundant ZFS pool about, perhaps another option to consider is setting up a NAS configuration that could function as a fileserver.



I just used this:
# zpool create example /dev/da0
so im sure this is not harmful :) if it is - i will pay the price.
At the moment i just made this way copied all the data back while im reading more about zfs and trying to understand and comparing things between FreeBSD zfs and Linux zfs.
In connection with those mentioned "options" / feature flags, be extra careful with zpool-upgrade(8). Further links: cannot open ZFS USB Disk on Debian, FreeBSD / ZFS Upgrade Best Practice Question and ZFS on Linux.

The beauty of ZFS is that it is both supported on Linux and FreeBSD (and Solaris/Illumos) in an equal manner*, but there are a few important things that you must be aware of. One are the feature flags as mentioned earlier; these can trip you up within FreeBSD as well when trying to import a pool by different FreeBSD versions! The second is the support for Boot Environments (BEs) for ZFS on root: BEs are fully functional on FreeBSD (& Solaris/Illumos); wit Linux they are not. There seems to be some work on going to get BEs on Linux, don't know the details of that.
___
* ZFS treats both Linux and FreeBSD as first class citizens: OpenZFS & its code base history
 
Don't know what options are open to you. However, if this (i.e. no real fast IO) is one of your main usage for moving a non-redundant ZFS pool about, perhaps another option to consider is setting up a NAS configuration that could function as a fileserver.
I/O does have a play in my life ... it took me 12-14h to transfer 40GB of data over net from this hard drive (ntfs at that time) and from hdd(zfs ) to nvme trough usb - 350GB in 1h ( maybe its wrong comparison as 350GB was large files and 40GB was with small ones and not net and not zfs if fs does have a play in read/write speed ). I still have to try with zfs on this 4TB drive to transfer 40GB over net and see where it lands and how fast it goes...
I do have samba and nvme dedicated for it but i found out that midnight Commander sftp works wonders for me so im doing it this way but still 40GB 12-14h its no way i want to keep my 4TB as non-movable :)
Im currently testing my 4TB with zfs with 130GB transfer and it looks far better as of now but who know whats going to happen in 1 or 2 or 3h ... or even in 30 min.


In connection with those mentioned "options" / feature flags, be extra careful with zpool-upgrade(8). Further links: cannot open ZFS USB Disk on Debian, FreeBSD / ZFS Upgrade Best Practice Question and ZFS on Linux.
This is awesome, specially link with compatibility list which now makes my life easier.

The beauty of ZFS is that it is both supported on Linux and FreeBSD (and Solaris/Illumos) in an equal manner*, but there are a few important things that you must be aware of. One are the feature flags as mentioned earlier; these can trip you up within FreeBSD as well when trying to import a pool by different FreeBSD versions! The second is the support for Boot Environments (BEs) for ZFS on root: BEs are fully functional on FreeBSD (& Solaris/Illumos); wit Linux they are not. There seems to be some work on going to get BEs on Linux, don't know the details of that.
As all my FreeBSDs are 14.1 - im hope im fine for now.
I dont know if zfs is BE in Linux myself .... i know you can have root on zfs but thats about it its just pitta with updates/upgrades ... excluding Proxmox as you can choose zfs when installing it.
 
Back
Top