Ubuntu USB Stick Day 2 - Using free space to install ZFS
Daniel Nashed – 20 January 2026 20:32:36
Yesterday I have been using /dev/shm to have disk storge for containerd and Docker.
Today I found a way to get some space from the persistent partition /cow and create a ZFS pool.
RUFS can't make this adjustment. But there is a simple tick:
Just create the USB image with as much of persistent storage as possible.
Then use GParted on Linux to make the partition smaller and create another partition.
After that I booted from the USB stick and did all the installation again using ZFS for Docker.
--- Update 21.1.2026 ---
It turned out that today with UEFI you can install directly on a USB stick and boot from there.
No tricks needed. But all I did was a very good experience and some of it will be helpful in other sencarios. Like the trick to use tmpfs to speed up in a lab environment.
Check this block post for the final solution --> https://blog.nashcom.de/nashcomblog.nsf/dx/ubuntu-usb-stick-day-3-native-usb-install.htm
But this information is still mostly useful and see how I came up with new layout.
In the new layout I leave out free space on a native installed Linux on USB allocating an unformatted partition to add ZFS when Linux is installed.
---
New disk layout
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 5.8G 5.3G 529M 92% /cdrom
/cow 30G 5.8G 22G 21% /
tmpfs 16G 8.0K 16G 1% /dev/shm
tmpfs 16G 8.0K 16G 1% /tmp
tank 21G 128K 21G 1% /tank
tank/local 23G 1.4G 21G 7% /local
tank/containerd 21G 384K 21G 1% /tank/containerd
tank/docker 21G 3.3M 21G 1% /tank/docker
ZFS Filesystems
zfs list
NAME USED AVAIL REFER MOUNTPOINT
tank 2.81G 20.9G 104K /tank
tank/containerd 272K 20.9G 272K /tank/containerd
tank/docker 1.41G 20.9G 3.18M /tank/docker
tank/local 1.39G 20.9G 1.39G /local
That's pretty cool. But the original setup was a lot faster. Now I am bound to the USB stick performance.
Before I was just using RAM. At runtime we could still put the Domino data disk into tmpfs for testing ...
Installation notes
# Create zpool
zpool create -o ashift=12 -o autotrim=on tank /dev/sda3
zfs set compression=lz4 tank
zfs set atime=off tank
zfs set xattr=sa tank
zfs set recordsize=32K tank
# Create file-systems
zfs create -o mountpoint=/local tank/local
zfs create -o mountpoint=/tank/docker tank/docker
zfs create -o mountpoint=/tank/containerd tank/containerd
# Link storage location for containerd to the new location
ln -s /tank/containerd /var/lib/containerd
# Ensure Docker uses ZFS and the file-system created
mkdir -p /etc/docker
vi /etc/docker/daemon.json
{
"data-root": "/tank/docker",
"storage-driver": "zfs"
}
# Start Docker and containerd
systemctl start containerd
systemctl start docker
systemctl start docker.socket
- Comments [0]