Ubuntu Server LTS and ZFS
2025/06/28
Posted Tag: #Linux
Other Tags: #Windows, #Personal, #All
This is why I like ZPS. I have two M.2 SSD drives on my motherboard for my everyday computer. Well since I had the two drives why not create a mirror pool of the two and run Arch Linux in that mirror. MDADM is a part of Linux so I tried that. But I simulated losing one of the two drives and the system crashed and lucky i maintain backups That defeated the entire reason for mirroring two drives.
I stated reading about Arch Linux on ZFS. Oracle holds the license for ZFS but OpenZFS gets around the license since it was forked before Oracle acquired it. But Arch Linux does not include it in their distribution. However it is maintained and can be compiled with Arch Linux during updates. The Arch Linux AUR has zfs-dkms you can use. So I tried Arch Linux on a ZFS mirror. I simulated losing one of the drives and the system still booted. Put the drive back in and ZFS re-slivered the mirror with everything working. I was impressed. So I operated like this for months until one time in an update the AUR package was not updated to the new kernel yet and the update crashed. No I do not use Arch Linux LTS, which is safer for ZFS. I even updated Strings for ZFS. But I gave up on using Arch Linux on ZFS and installed Windows 11 in a dual boot on the other SSD.
Ubuntu Server LTS maintains ZFS for the Linux kernel because people want to use ZFS on servers but you have to install it to get around licensing. Lose a drive you can get an email about losing the drive and even which one it is so just replace the drive and keep running the server. ZFS repairs the pool in the background. I really like ZFS as a software raid and it beats hardware raid in every aspect.
Drives
I have two Samsung SSD EVO 500GB drives I use for SLOG drives with ZFS. SLOG drives are caches for hard drive writes. My hard drives are Wester Digital 6TB drives or WD60EFRX models in two mirrored pools so four drives. SLOG drives I have in mirror pools also for my two hard drive pools. I use a lot of RAM with ZFS and the SLOG drives are to supplement the RAM and increase performance. Below you will also see that I use atime=off
with the pools which turns off access time writes with ZFS increasing performance too. A setting of ashift=12
is a 4096 block size which works with newer drives like I use and probably you will use.
Partitioning SLOG Drives
Most would use fdisk
but here I am using sgdisk
. The -100M
with the second partition is a way to use the remaining space on the disc without tabulating what space is left for the second partition.
lsblk
sde 8:64 0 465.8G 0 disk
sdf 8:80 0 465.8G 0 disk
sudo sgdisk -n 1:0:+250G --typecode=1:BF00 /dev/sde
sudo sgdisk -n 2:0:-100M --typecode=2:BF00 /dev/sde
Do the same for the other drive sdf
, whatever your drives are.
Installation
sudo apt install zfsutils-linux
If you are installing Ubuntu Server LTS again and had ZFS pools before just import the pools and everything is good. By the way, traditional in ZFS we name pools after the movie Matrix characters. I use the -f switch because it avoids any issues in case pools were not exported.
sudo zpool import -f tank
sudo zpool import -f dozer
zpool status
Creating Pools
Your drives for the pools should be installed and do not need to be formated or partitioned. List your drives and what you need is at the top of the listing.
ls /dev/disk/by-id/
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L-part1
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L-part2
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E-part1
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E-part2
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74D464
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74D464-part1
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74D464-part9
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74DHNN
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74DHNN-part1
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74DHNN-part9
ata-WDC_WD60EFZX-68B3FN0_WD-C82GDWTK
ata-WDC_WD60EFZX-68B3FN0_WD-C82GDWTK-part1
ata-WDC_WD60EFZX-68B3FN0_WD-C82GDWTK-part9
ata-WDC_WD60EFZX-68B3FN0_WD-C82GWB6K
ata-WDC_WD60EFZX-68B3FN0_WD-C82GWB6K-part1
ata-WDC_WD60EFZX-68B3FN0_WD-C82GWB6K-part9
This is how I list them out.
slog
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L-part1
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L-part2
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E-part1
ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E-part2
tank
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74D464
ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74DHNN
dozer
ata-WDC_WD60EFZX-68B3FN0_WD-C82GDWTK
ata-WDC_WD60EFZX-68B3FN0_WD-C82GWB6K
tank
sudo zpool create -o ashift=12 tank mirror ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74D464 ata-WDC_WD60EFRX-68L0BN1_WD-WX21DC74DHNN
sudo zfs set atime=off tank
sudo zpool add tank log mirror ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L-part1 ata Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E-part1
zpool status tank
dozer
zpool create -o ashift=12 dozer mirror ata-WDC_WD60EFZX-68B3FN0_WD-C82GDWTK ata-WDC_WD60EFZX-68B3FN0_WD-C82GWB6K
zfs set atime=off dozer
zpool add dozer log mirror ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536552L-part2 ata-Samsung_SSD_860_EVO_500GB_S3Z1NY0M536554E-part2
zpool status dozer
I have two 6TB pools to fill with whatever I want. You can do other than mirrors with ZFS and I may one day if I ever fill these pools.