Category Archives: ZFS

Anything related to ZFS

Replacing drives on AMANDA server

I spent some days last week converting our 32-bit AMANDA server to a 64-bit counterpart using spare but aged hardware. The former AMANDA server ran on very aged hardware in comparison. Going 64-bit also ment turning to ZFS-based storage.

Today, I replaced the two 320 GB first generation SATA drives with two 1 TB third generation SATA drives. The new drives, like their predecessors, are connected to the second generation SATA controller on the motherboard. Replacing the drives is nevertheless an improvement. Continue reading Replacing drives on AMANDA server

FreeBSD’s UEFI boot loader now supports ZFS pools

As of r294999 it’s possible to boot FreeBSD/amd64 stable/10 from ZFS pools on systems running UEFI firmware. Up until now I have booted my UEFI ZFS laptop using the older boot1.efi boot loader with /boot located on a UFS partition. Earlier today I updated my EFI System Partition (ESP), put /boot back where it belongs, in the ZFS pool, and scrapped the UFS partition. Thanks to everyone who made this happen.

An exercise on ZFS clones

This is an exercise I made, just to remind myself of how snapshots and clones work in ZFS. Also, how to properly get rid of them when you’re short of diskspace, or the dataset listing is too long, etc.

First, we have the shell script that demonstrates the rise and fall of the initial dataset, and the intermediary snapshots and clones.

#!/bin/sh
set -x

zfs create zroot/clones
zfs list -rt all zroot/clones

zfs create zroot/clones/a
zfs list -rt all zroot/clones

zfs snapshot zroot/clones/a@b
zfs list -rt all zroot/clones

zfs clone zroot/clones/a@b zroot/clones/b
zfs list -rt all zroot/clones

zfs snapshot zroot/clones/b@c
zfs list -rt all zroot/clones

zfs clone zroot/clones/b@c zroot/clones/c
zfs list -rt all zroot/clones

zfs snapshot zroot/clones/c@d
zfs list -rt all zroot/clones

zfs clone zroot/clones/c@d zroot/clones/d
zfs list -rt all zroot/clones

zfs snapshot zroot/clones/d@e
zfs list -rt all zroot/clones

zfs clone zroot/clones/d@e zroot/clones/e
zfs list -rt all zroot/clones

zfs promote zroot/clones/b
zfs list -rt all zroot/clones

zfs promote zroot/clones/c
zfs list -rt all zroot/clones

zfs promote zroot/clones/d
zfs list -rt all zroot/clones

zfs promote zroot/clones/e
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/a
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/b
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/c
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/d
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/e@b
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/e@c
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/e@d
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/e@e
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones/e
zfs list -rt all zroot/clones

zfs destroy -v zroot/clones

Continue reading An exercise on ZFS clones

Unofficial errata: FreeBSD Mastery: ZFS

I bought the ebook edition of FreeBSD Mastery: ZFS this June. While the authors’ intentions are good, the 2015-05-21 edition has some errors and mistakes. The table below is nothing more than an unofficial errata of said book. Beware, what you find below might be due to my lack of understanding FreeBSD, ZFS, or the English language.

BTW, if you print this ebook as a booklet using Adobe Reader or similar software, specify a custom range of 1,11,2-234. This trick creates a blank page after the cover page, and places the titlepages and the first page of each chapter on the right side of the sheet. In addition, I had to specify portrait orientation and no auto-rotate. Otherwise the front and back of each sheet would be rotated by 180 degrees. Imagine reading such a book(let).

Page(s) Complaint
10-11 GPT labels have a maximum length of 15 characters, so you might have to truncate long serial numbers.
GPT labels are not limited to 15 characters. Nor does FreeBSD limit GPT labels to 15 characters. Such labels are limited to 36 UTF16LE encoded characters (72 octets). Beware, gpart(8) will silently truncate labels longer than 36 UTF16LE characters. See the Wikipedia entry on GPT and the header file sys/sys/gpt.h. In other words, a label of “s2d9-WD-WCAW36477223” consists of 20 UTF16LE characters, and that’s well within the limit.
17 Look at the second entry, named zroot/ROOT. This is a ZFS dataset created for the root filesystem.
In this case, zroot/ROOT is not a dataset created for the root filesystem. It is a dataset, but it serves more as a classifier. On the other hand, zroot/ROOT/default, is truly a root filesystem, and often what the bootfs property refers to. I suggest a rewrite: “Look at the second entry, named zroot/ROOT. This is a ZFS dataset created to contain the root filesystems.
33 Traditional RAID let you combine multiple disks into one virtual disk, permitting the creation of massive disks as large as 100 MB, or even bigger!
A virtual disk of 100 MB has been easy for many years. Today, most (physical) disks range from 128 GB to 3 TB. Let’s scale the number up to 100 TB.
69 Every zpool retains a copy of all changes that have ever been made to the pool, all the way back to the pool’s creation.
Yes and no. It depends on how much activity you have in the pool. If you create (and possibly destroy) snapshots regularly, then those commands will eventually fill up the history, and all records of the initial commands will be gone. Maybe this has changed in recent versions of FreeBSD and/or ZFS, but I doubt it.
80 You can show filesystems, volumes, or snapshots.
The list must be extended to include bookmarks, unless this is material for “FreeBSD Mastery: Advanced ZFS”.
84 A source will be set to received when a property was received using the zfs receive command.
114-115 With zpool replace, the faulted provider remains as online as it can manage until resilvering finishes. If you lose a second disk in your RAID-Z1 during resilvering, there’s a chance the pool has enough data integrity to survive.
I can’t make sense of the second and the third sentence of the last paragraph on page 114. I suggest a rewrite: “With zpool replace, the faulted provider remains online for as long as it can manage until resilvering finishes. If you lose a second disk in your RAID-Z1 during resilvering, there’s a chance the pool has enough data integrity to survive.
154-159 I’m missing a discussion on the dedupditto property, unless this topic is destined for “FreeBSD Mastery: Advanced ZFS”.

Cloning a ZFS dataset using only zfs snapshot, zfs send, and zfs receive

Creating new BE’s using snapshots and clones can get messy with dependencies all over the place. I had an epiphany the other day, why not create a snapshot on the current dataset, send that snapshot to a new dataset within the same zpool (or elsewhere), and subsequently destroy the (two!) snapshots?

Instant transfer of data, and no strings attached to either dataset once the snapshots have been removed. Continue reading Cloning a ZFS dataset using only zfs snapshot, zfs send, and zfs receive