Tutorial for file transfer zfs on Linux machine

Okay, this tutorial is going to be for if you have backed up your data onto, let’s say, a Linux machine or a Windows machine, and you don’t want to have to transfer over the network and would prefer to transfer with the hard drives inside of the physical machine.

Keep in mind this is done using Fedora Linux. The process is very similar on other derivatives, such as Ubuntu, etc.

  1. Install and set up your TrueNAS machine.

In my case, I set up striped volumes because I chose maximum storage over anything else. Yes, I know RAID can be set up to do certain things, but I don’t care. As I’ve already stated, my data is being restored from backups that are on another machine. And I absolutely refuse to wait the amount of hours that it takes for data like that to transfer over the network.

That being said:

Go to the OpenZFS site and choose your particular operating system.

Install following the directions.

But for my case, Fedora, the directions are:

  1. sudo rpm -e --nodeps zfs-fuse

  2. sudo dnf install -y https://zfsonlinux.org/fedora/zfs-release-2-8$(rpm --eval "%{dist}").noarch.rpm

  3. sudo dnf install -y kernel-devel-$(uname -r | awk -F'-' '{print $1}')

  4. sudo dnf install -y zfs

  5. sudo modprobe zfs

There’s no need to go past this part. You can simply restart your system.

You can create a Zpool with a drive.

Check volumes:
lsblk d
lsblk or df -h

Check the version of ZFS installed:
zpool --version

Wipe the specific drive that will be used as a pool:

sudo wipefs --all --force /dev/sd???

Create the new pool (which is just a drive), but for ZFS’s sake, it’s called a pool):

sudo zpool create poolname sd????

Now check the status of the new pool created:

zpool status

And of course, you can also list ZFS pools:

zfs list

You can give yourself write permissions to the newly created pool:

sudo chmod -R 777 /poolname

Then you can mount it; in this way, it will show in the GUI:

sudo zfs mount poolname

And as previously stated, you can change the mount point with the following command:

sudo zfs set mountpoint=/home/user/zfs poolname

Your newly mounted pool will be mounted in the “ZFS” folder.

But for me, that’s unnecessary, as I choose to create Z pools with TrueNAS.

And it’s a little bit different when we talk about write permissions with a ZFS created in TrueNAS.

After you reboot, it’s best to have the drive already plugged in, or you can put your drive into an external dock after your system is booted and do the following:

This command will find your TrueNAS-created pool:

  1. sudo zpool import -a

This command will allow you to mount your TrueNAS pool:

  1. sudo zpool import -f "pool name"

You can use this command to check the status of the Zpool.

  1. sudo zpool status

Now, this last step isn’t difficult, but I just want you to pay attention:

Create a folder to be the mount point in your home directory as such using the command line:

  1. sudo mkdir /home/user/foldernameyoucreated

In my experience, if you create a mount point on the directory itself, the transfer speed is very slow.So it’s best to mount it in your home directory as such:

sudo zfs set mountpoint=/home/user/zfs poolname

Whatever the name of the pool you created will be mounted in the ZFS folder as the name itself.

You may find that you are unable to copy data when you import a pool that you created on TrueNAS, but we’re going to fix that right now.

sudo chown -R user:user /home/user/zfs

To see all drives in your system and where they are mounted, you can use the command:

df -h

This is a use case for those who have lots of data they don’t want to have to back up over the network and would prefer to back up locally after creating their pool using TrueNAS.

Needless to say, TrueNAS does not have to be running while you transfer all your data back.

You can simply pull the disk out, and when the data is done transferring, you can put the disk into TrueNAS, boot TrueNAS up, and the data will be available for you to use.

I failed to mention one thing: You will have to reestablish the appropriate mount point like such:

sudo zfs set mountpoint=/yourpn yourpn
(yourpn means your pool name 2 times)

So let’s say your pool, aka drive name, was “media.” The command you would issue would look something like this:

sudo zfs set mountpoint=/media media

In this way, your drive will be mounted under the appropriate location for TrueNAS.

If you fail to do this, there will be problems that you encounter, so be sure to issue the following command for whatever the pool is.