How can I access a thumb drive formatted as ZFS?

I am a little confused on how to do this exactly, I have a system running ext4.

Someone gave me a thumb drive but said its formatted as ZFS. How do I access the data off it? Do I need to install some compatability package to be able to see the information on the drive?

Edit: To clarify, I thought it would operate like a regular thumb drive and mount instantly in my file manager (Dolphin). I can see the drive, but it isn’t mounting automatically,

SOLVED: The solution is a little wonky, but made very messy due to the zfs drive being encrypted. But mounting the drive and enabling your computer to run ZFS, a large part of that solution is provided in a post by mbod

Linux can’t handle zfs by default, you’ll have to set it up. Here is the ZFS wiki article

Can I ask for some additional help? I’m a little confused on what to do exactly.

I installed the packages from the AUR zfs-linux. Then I enabled the zfs-mount.service

However that doesn’t resolve the issue. What am I missing?

I’m afraid I’ve never used zfs, so I don’t really know. Is libunwind installed? The wiki says it’s needed but not marked as a dependency.

Did you reboot after installing the module? See if you zfs file system is picked up by “zpool status” or “zpool list”.

Restarting is pretty much all I know when it comes to troubleshooting, so I tried that first

No, the pool isn’t being picked up though; “zpool list” and “zpool status” both return “no pools available”

The drive is plugged in and again the mounting service has been enabled

What does “lsblk -f” show?

I can see the thumb drive which would be sda. NVME is the drive the OS is installed on

sda
└─sda1 zfs_me 5000 usb_backup 4877238554813059898
nvme0n1
├─nvme0n1p1 vfat FAT32 C1FF-30DE 1021.7M 0% /boot/efi
└─nvme0n1p2 ext4 1.0 endeavouros 3a657751-394a-4fb0-969e-935ecd624b5a 1.3T 21% /

Is the package “linux-headers” installed? I’m assuming you are running the “linux” kernel and not “linux-zen” or another kernel?

I’ll answer the last question first, I’m running the default kernel that comes with EOS (just updated)

Yup, linux headers is installed. “pacman -Qs linux-headers” returns: “local/linux-headers 6.18.2.arch2-1
Headers and scripts for building modules for the Linux kernel”

Are both “zfs-dkms” and “dkms” installed?

First you need to install the zfs packages: zfs-dkms and zfs-utils

zfs-dkms compiles the zfs module for your kernels. This module needs to be loaded. Either manualy with modprobe zfs or automatically with a config file in /etc/modules-load.d/

zfs-utils contains the user space program: zpool and zfs.

In a terminal window type: zpool version to see if everything is loaded and working.

# zpool version
zfs-2.4.0-1
zfs-kmod-2.4.0-1

Now you can plugin the usb drive an check which pools are available.

Type zpool import and zfs will check all attached devices if it finds a pool and it gives you the name of the pool.

Then you need to import the pool to work with it. zpool import -R /mnt/ <poolname>

The -R /mnt option is important because zfs is different to other filesystem in regard to how it mounts directories. The mountpoints are stored in the datasets. If the usb drive contains a dataset which has the mountpoint set to /home/, it will mount the dataset on top of your /home directory, which is not what you want. With -R /mnt you tell zfs to mount everything relative to the /mnt directory.

Once the import is complete, you can access the data in the pool.

2 Likes

Just a shot in the dark, but it reads backup, could this only be used in combination with the package the backup is made, or something like that ?

No, neither are installed.

My reading of the wiki was that you could do it either through dkms or through kernel specific packages. I am already unfamiliar and uncomfortable in dealing with the kernel, so opted for the non-dkms option

Am I wrong in that interpretation?

So yeah, someone I know just started using Truenas. I don’t have one built yet (and with ram prices, who knows when that’s going to happen), so he still wanted me to be his off-site backup for the important things.

Thank you for the detailed answer. Can I pick your brain a little bit?

I do have zfs-utils installed but don’t have zfs-dkms installed. I thought the arch wiki said you could opt for one way or the other; since I’m not at all faimilar with what dkms is or does, I opted to go the way without it. Am I wrong in that understanding?

zpool version returns exactly what you got

How do I load the module? just type the command “modprobe zfs?” Do I have to type that everytime I restart or need to access the pool?

You are wrong. Both packages are needed. zfs-dkms and zfs-utils.

That can not be if you do not have zfs-dkms installed. Without zfs-dkms you would get:

# zpool version
The ZFS modules cannot be auto-loaded.
Try running ‘modprobe zfs’ as root to manually load them.

I explained it in my previous post.

Yes, if it is an external usb drive. You can add your own udev rules for automatic zfs mount if you want. But that is expert stuff.

I’m installing zfs-dkms right now, but to confirm this is what I get when I type in “zpool version”

zfs-2.4.0-1
zfs-kmod-2.4.0-1

I can send a screenshot if you want

If you see this, the zfs module is already loaded.

# lsmod | grep zfs
zfs                  6488064  62
spl                   155648  1 zfs

The zfs module only comes as source code in zfs-dkms. You must have compiled it previously.

Anyways, with everything loaded and the usb drive connected what is zpool import showing?

this is waht I get for “lsmod | grep zfs”, similar but not exactly what you got

zfs 6512640 0
spl 155648 1 zfs

1 Like