GB
  
You are currently viewing the United Kingdom version of the site.
Would you like to switch to your local site?
17 MIN READ TIME
ZFS

Next-gen filesystem management

ZFS is a lot more than a filesystem. Neil Bothwick tells all about this advanced volume manager and Swiss Army Knife of filesystems.

THE LICENCING ISSUE

TESTING, TESTING

You may wonder why you have to install external kernel modules to use ZFS when most other filesystems are integrated into the kernel. The reason is due to licencing. When Sun released the ZFS source code, it did so under the CDDL licence. This is an accepted open source licence, but it’s incompatible with the GPL that’s used to licence the kernel. This means that distributing binaries linked to both sets of source code could break the licence terms. Note the use of the word ‘may’ here: there are differing opinions on the legal ramifications of this, but the only way to truly test it is to go ahead and get sued, then fight the battle in court. As a result, the general approach is to play safe and not include ZFS kernel modules with distros.

Jumping in and converting a whole system to use a different filesystem and volume manager is a big step. It may make more sense to experiment with the possibilities of ZFS before committing to it, and you can do that by using files as the backing store for a pool. Cd into a partition with a decent amount of space and create some sparse files to use as virtual disks. Sparse files appear to be a fixed size, but only occupy the disk space they need for their contents. 

Credit: www.freenas.org/zfs

OUR EXPERT

However, Ubuntu has made ZFS available in its main software repositories for a few years and nothing bad has happened, so it’s easy to install ZFS on Ubuntu and friends. However, other distros may require you to compile the modules from source.

$ truncate -s 25G temp0 

Neil Bothwick has been using and writing about Linux since before the first “This is the year of Linux on the Desktop”. His life is so full of excitement that he finds filesystems fascinating!.

$ losetup --show --find temp0

QUICK TIP

This will create a 25GB sparse file and set it up as a loop device, printing the device name (/dev/loop0 if you don’t currently have any loop devices). Repeat this for as many virtual disks as you want to create, then use those to create a pool, for example 

While we haven’t shown it here, most of the commands should be run as root or prefixed with sudo. The only exceptions are commands that only retrieve information, such as zpool status or zfs list.

$ zpool create testpool mirror /dev/loop{0,1}

L ife used to be so much simpler. A typical desktop computer had one small – and expensive – hard drive with no more than four partitions using standard filesystems like ext2/3. Okay, so half the hardware out there wasn’t supported by Linux, but that just simplified things even further.

This will set up a mirrored array (effectively RAID1) using two virtual devices. You can now create datasets within the pool. When you’ve finished and want your disk space back, destroy the pool and datasets, then remove the loop devices with 

Now we have huge hard disks, often more than one of them, and lots of data strewn across them. Simple partition schemes have been replaced with RAID arrays, volume management and multiple filesystem types. Then we start worrying about privacy and start throwing encryption into the mix, and that’s without considering backups. Thanks to the way in which Linux uses block devices, these multiple technologies can be layered on top of one another fairly easily, so we have filesystems on top of LVM volumes on top of LUKS-encrypted devices on top of a RAID array of several hard disks… and it all works well. It can be a bit of a management headache though, with each layer using a different set of software to manage it.

$ zpool destroy -f testpool 

Unlock this article and much more with
You can enjoy:
Enjoy this edition in full
Instant access to 600+ titles
Thousands of back issues
No contract or commitment
Try for 99p
SUBSCRIBE NOW
30 day trial, then just £9.99 / month. Cancel anytime. New subscribers only.


Learn more
Pocketmags Plus
Pocketmags Plus

This article is from...


View Issues
Linux Format
March 2021
VIEW IN STORE

Other Articles in this Issue


WELCOME
Orchestral Manoeuvres in the Docker
Jonni’s been arguing with me this issue –
REGULARS AT A GLANCE
Is online privacy the hot topic for 2021?
PRIVACY
Linus vs Intel
Linus Torvalds blasts Intel for not supporting ECC memory
Affordable RISC-V PC arrives
BeagleV is a RISC-V computer designed to run Linux
THE END IS NIGH, SO…?
Matt Yonkovit is Percona’s Chief Experience Officer and
SPRING CLEANING
Keith Edmunds is MD of Tiger Computing Ltd,
Apple M1 Macs get Linux support
Apple’s OS 11.2 now supports booting custom kernels
FOSS watch
PineTime takes on the Apple Watch and other wearables
Faster Firefox
Firefox 84 brings HW acceleration to Linux
Distro watch
What’s down the side of the free software sofa?
IT’S GOOD TO SHARE
Alyssa Rosenzweig is a software engineer based at
TIME’S UP FOR OLD KIT
Jon Masters has been involved with Linux for
Kernel Watch
Jon Masters summarises the latest happenings in the Linux kernel, so you don’t have to
Mailserver
Write to us at Linux Format, Future Publishing, Quay House, The Ambury, Bath BA1 1UA or lxf.letters@futurenet.com.
Helpdex
shane_collinge@yahoo.com WRITE TO US Do you have a
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to lxf.answers@futurenet.com
SUBSCRIBE!
EiskaltDC++
FILE-SHARING APPLICATION
TabFS
FILE SYSTEM
TuxPaint
DRAWING APPLICATION
Chipmunk
LOG VIEWER
Darktable
PHOTO EDITOR
EasyLogic Studio
CSS AND SVG EDITOR
Zenith
SYSTEM MONITOR
Tux Vs Yeti
PLATFORMER GAME
Invasion
ARCADE GAME
Qsnapstore
SNAP STORE VIEWER
REVIEWS
AMD Ryzen 5 5600X
As Alan Dexter discovers, this chip may be the runt of the Zen 3 family, but it delivers where it counts most: gaming
Slackel 7.4
Before he couldn’t work with Arch, he couldn’t work with Slackware, which is why Mayank Sharma jumps at everything that mentions the venerable distro
RebornOS 2020.12.28
The constant deluge of Arch-based distros can put anyone to sleep, but this one makes Mayank Sharma wake up from his slumber
Rescuezilla 2.1
With perennial fat fingers, Mayank Sharma has been messing with hard disks long enough to know that good rescue tools are worth their weight in gold
Garuda Linux 210101
Mayank Sharma has enjoyed one Arch-based distribution this month, but will lightning strike twice or has he been taken in by the distro’s tall claims?
Wasteland 3
Management simply hates weirdos and snow, so this is a bad time of year for them and they’re taking it out on Jody Macgregor
Roundup
Game engines
There’s never been a better time to get into game development on Linux. Michael Reed puts five capable engines under the microscope
How free is it?
There are different kinds of free…
Community and support
A game engine is useless without a way of learning how to use it
Programming environment and GUI
A difficult environment can lead to eventual loss of interest
2D workflow and features
Top down, overhead, side on or something else?
3D workflow and features
How easy is it to create a world to move around in?
Extras
Anything that makes it stand out from the rest?
Ease of use
This is relative because some engines are more capable in terms of what they can do
Game engines
The Verdict
Better virtual machines
BETTER VIRTUAL MACHINES
Forget about the draconian confines of reality and immerse yourself (well, your computing) in a virtual world. Jonni Bidwell’s here with a machines-inside-machines extravaganza
A virtual history
Datacentres are full of VMs, but why and how did they get that way?
QEMU, KVM and the other ones
Learn about virtualising the Linux way, with libvir t and Virtual Machine Manager, and jokes about Inception
Orchestrating with Xen
Set up a machine dedicated to hosting VMs with yet another high-powered hypervisor, XCP-ng
INSTALL XCP-NG
1 Launch the installer Fetch the latest ISO
Contain yourself
Containerisation is even more of an ugly word than virtualisation, but it’s a big deal too. A Docker whale-sized big deal, as we’ll discover…
IN-DEPTH
THE LINUX GAMBIT
Jonni Bidwell once again sets a graphics card on fire, this time calculating chess positions…
Pi USER
PASSING ON THE KNOWLEDGE
Thierry Chantier is a French coder and maker.
Pi Foundation boosts support for teachers
Over 300 free curriculum-mapped video lessons now available via the Oak National Academy
Cool HAT dude!
This Pi Smart Fan HAT is stackable and GPIO friendly, too
Raspberry Pi Pico
In a break from the norm Les Pounder tests the latest Pi: a $4 microcontroller featuring the first ‘Pi Silicon’ created by Raspberry Pi
Turn a Pi HAT into a Magic 8-ball project
SENSEHAT
Build a Pi-powered helicopter diorama
Sean Conway uses a helicopter model to demonstrate how lighting, sound and motion can be accomplished using a Raspberry Pi
Connect, configure and use gamepads
GAMING
TUTORIALS
A terminal multiple window manager
You can’t use the mouse or run multiple windows in a text environment… unless you’re Shashank Sharma and know just the right tool for the job
Construct your own mind-maps
Nick Peers reveals how you can easily manage all of your thoughts – from simple ideas to fully formed projects – with this powerful free tool
Run a classic BBC Micro under Ubuntu
Les Pounder reminisces about that one time when he caused a core meltdown in a nuclear reactor, then flew away in a spaceship
Decode signals from weather satellites
Weather satellites transmit signals that you can receive and decode to generate images of the Earth. Mike Bedford shows you how
Dify
IMAGE COMPARISON TOOL
Using Active Directory with Debian & Samba
Stuart Burns rolls up his sleeves and
CODING ACADEMY
Coding Arm 64-bit assembly language
Continue writing 64-bit assembly code for the Pi with John Schwartzman, who calls on Linux kernel services and the C run-time library
Write a maze runner game in Python
One way in, and only one way out… video game aficionado Calvin Robinson reveals how to create a vintage maze runner-style game
REGULARS AT GLANCE
On the disc
Discover the highlights from this month’s packed DVD!
GeckoLinux 152
SUPER GECKO MUSCLES
Chat
X
Pocketmags Support