How to format an external disk to ZFS

6,812

I will post the way I did it in case someone is interested. First you need to know the id of the disk, so go to/dev/disk/by-id/ and get that. After that you need to create a new pool:

sudo zpool create zfs-pool-WD14TB /dev/disk/by-id/usb-WD_Elements_25A3_XXX-0:0

change zfs-pool-WD14TB to a name that make sense to you and use your actual disk id. Then you can specify a mount point and a dataset:

sudo zfs create -o mountpoint=/mnt/WD14TB zfs-pool-WD14TB/fs1

change mountpoint and dataset name to whatever you want. At last change owner so that you can copy and write files:

sudo chown -R youruser:yourgroup /mnt/WD14TB

I am new to ZFS and posted what worked for me so far. In this link you can find more info.

I have not managed so far to have the pool to automount by default. So after reboot I use:

sudo zpool import zfs-pool-WD14TB

Update 18 April 2020

At least in 20.04.RC1 the automount problem is gone. In case you did a fresh install you have to import the pool again. It will complain:

cannot import 'zfs-pool-WD14TB': pool was previously in use from another system

but using -f it will work:

sudo zpool import -f zfs-pool-WD14TB

What I am still missing is the nautilus integration for mount/unmount icon. If anyone knows how to do it, please comment or post it as an answer.

Share:
6,812

Related videos on Youtube

emvidi
Author by

emvidi

Updated on September 18, 2022

Comments

  • emvidi
    emvidi almost 2 years



    I am on ubuntu 19.10 and have a brand new external usb disk (WD 14Tb Elements). I would like to try the ZFS and format the disk. Where would one start as I understand that Ubuntu is experimenting with this format.

    Thanks

  • henning
    henning over 2 years
    If you get an error, your usb drive might be mounted. Unmount it first.