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. This 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. FreeBSD does not limit GPT labels to 15 characters. These labels are limited to 36 UTF16LE encoded characters. gpart(8) will silently truncate longer labels. See the Wikipedia entry on GPT and 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 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.
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 topis is destined for “FreeBSD Mastery: Advanced ZFS”.

Upgrading XenServer 6.2

  1. Download the required updates.
  2. Extract the XS*.xsupdate files.
  3. Transfer the XS*.xsupdate files to, say, /tmp/xsup on the master.
  4. Login on the XenServer console.
  5. Delete old log files in /var/log, e.g. /bin/rm /var/log/*.gz.
  6. Create if necessary, and change directory to /tmp/xsup.
  7. Run:
    uuidlist=`for f in XS*; do xe patch-upload file-name=$f; done`
  8. Run:
    for u in $uuidlist; do xe patch-pool-apply uuid=$u; done
  9. Delete the XS*.xsupdate files from /tmp/xsup.
  10. Shutdown the running VMs and restart each node.

Also, make sure you give XenServer more than 4 GiB of disk space to dom0 when installing the system, preferably 8 GiB or even 10 GiB.

Autorativ vs autoritativ

Jeg har lagt merke til at flere bruker ordet «autorativ» der jeg vil bruke ordet «autoritativ». Jeg har lest flere steder om «autorativ DNS-tjener» og lignende, men jeg ville ha skrevet dette som «autoritativ DNS-tjener».

Loose camera connector in Dell Latitude E5540

A colleague came into my office claiming the camera in his Dell Latitude E5540 didn’t work. Here’s a link to the Dell Latitude E5540 Owner’s Manual.

After a bit of troubleshooting, I removed the display bezel. Lo and behold, the camera connector was halfway out of its socket. Once I pressed the connector into place, the camera immediately started working. But only after a few seconds the connector dislodged again, and Skype/Windows didn’t detect any camera.

I removed the display, rearranged the camera’s flat cable to lessen the stress, and reconnected the connector. As I began to fasten the display, the camera lost its connection again. Apparently, the socket is slightly too wide or the connector is slightly too narrow, or maybe both, and they slip easily apart.

I removed the display again. I reconnected the camera connector one final time and applied a drop of super glue of the kind I use for security markings. While the glue dried, the camera kept working. After 10 minutes or so, I reattached the display and the display bezel, and the camera was still working. Successful surgery!

Adding 24 hour clock to FreeBSD’s hardstatus string for GNU Screen

FreeBSD gives the user an option of installing the file /usr/local/etc/screenrc with some sensible defaults along with GNU Screen, aka sysutils/screen.

Among the defaults are a format string for the hardstatus line. It shows the date using yy/dd/mm notation and the time as a 12 hour clock. That may be fine in the English speaking parts of the world.

hardstatus string '%{gk}[%{G}%H%{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}]%{=b C}[%m/%d/%y %C %A]%{W}'

Continue reading Adding 24 hour clock to FreeBSD’s hardstatus string for GNU Screen

Strange spam

Return-Path: <Preston_Charlie30@blueleo.com>
Received: from 204-56-183-213.static.edis.at (204-56-183-213.static.edis.at [213.183.56.204] (may be forged))
    by [WITHHELD] with SMTP id t46IO57r032988
    for [WITHHELD]; Wed, 6 May 2015 20:24:06 +0200 (CEST)
    (envelope-from Preston_Charlie30@blueleo.com)
Date: Wed, 6 May 2015 20:24:05 +0200 (CEST)
From: Preston_Charlie30@blueleo.com
Message-ID: <6[10
To: undisclosed-recipients:;

Apart from what I withheld by choice, the above is all that appears in this spam. Notice the strange Message-ID on line 8. Spam programming gone wrong? Maybe they should have used Erlang.

Yet another technical oriented blog, more or less