Lighthouse      Zap's Digital Lighthouse

Zap's Digital Lighthouse is
a Blosxom weblog for our digital outpost on the Internet

For info

Useful links:
The Reg
Wiki soekris

/FreeBSD (24)
/admin (1)
/blosxom (6)
/games (3)
/hardware (17)
/inet (4)
/misc (37)
/notwork (2)
/software (11)
/tech (1)

 2019 (1)   
 | July (1)
 2018 (6)   
 | December (1)
 | November (3)
 | January (2)
 2017 (4)   
 | December (2)
 | January (2)
 2016 (3)   
 | November (1)
 | October (1)
 | January (1)
 2015 (9)   
 | December (2)
 | November (1)
 | October (1)
 | June (1)
 | May (2)
 | February (1)
 | January (1)
 2014 (9)   
 | December (1)
 | October (1)
 | September (1)
 | August (3)
 | May (2)
 | April (1)
 2013 (20)   
 | October (3)
 | June (4)
 | May (2)
 | April (7)
 | March (1)
 | January (3)
 2012 (60)   
 | December (4)
 | October (1)
 | July (5)
 | June (7)
 | May (1)
 | April (6)
 | March (3)
 | February (14)
 | January (19)
 2011 (3)   
 | December (1)
 | November (2)
 2008 (1)   
 | October (1)



Mon, 31 Dec 2018

Moving a Running FreeBSD system from i386 to amd64

Recently, the little Soekris net6501 machine that I use as a home server for DNS and other similar functions decided to die after many years of useful service (it's a known problem of net6501 machines unfortunately; at some point they just self-brick and refuse to reboot :-(

So I took the Gigabyte Brix GB-BXi3-4010 that I had been using on my TV in the living room and simply removed the Windows 10 mSATA drive from it and inserted the mSATA drive from my net6501 into it and Poof! FreeBSD booted fine and It Just Worked.

Therefore in no time at all, poterne (my little home server) was back in action and no one at home even noticed, since we haven't been using the little Brix much since we bought a 4K TV that has Netflix and Youtube in firmware (maybe more on this some other day).

However, the Intel Core i3-4010U Processor at the heart of the little Brix computer is a 64-bit part, so I'd like to move FreeBSD on poterne from i386 to amd64 so that it can use all of its 8GB of RAM, since I've noticed that dmesg presently says:

real memory  = 8589934592 (8192 MB)
avail memory = 3574235136 (3408 MB)

So I searched the Internet for "freebsd upgrade i386 to amd64" and I found a few pages describing successful upgrades. Actually, most of them recommended not to do it and just reinstall, but I decided to go for it anyway.

The methods I found recommended upgrading by recompiling, so I fetched the FreeBSD 12.0-RELEASE installation media and installed the source code onto my little server. Then I started to recompile, but it took ages (maybe because I put the source and object files on the external USB disk?), so I decided to redeploy from RELEASE binaries:

cd /tmp
mdconfig -a -t vnode -f /tmp/FreeBSD-12.0-RELEASE-amd64-dvd1.iso
mount -t cd9660 -o ro /dev/md0 /mnt
cd /

The release tarballs are in /mnt/usr/freebsd-dist/ (such as src.txz, base.txz, etc.)

Of course, I then used rsync to make a backup of my server onto my local NAS machine, in case anything went wrong.

Then, I proceeded with the migration process based on recipes from various websites (notably

Turning the swap partition into a 'miniroot' seemed like a good idea, so I did that... My swap partition is is 6GB, so that worked well (6GB was enough for the 2GB of RAM I had on the Soekris net6501, but may could a bit short with the 8GB of RAM from the Brix... but then again, I probably won't need any swap space on the new machine with 8GB of RAM for a little headless server like poterne).

swapinfo -h
swapoff /dev/ada0p2
sed -i.bak -e '/swap/s;^;#;' /etc/fstab
newfs -U -n /dev/ada0p2
mount /dev/ada0p2 /media
... here, I extracted various files from the FreeBSD-12 release
... and copied various files from _/_ onto _/media_ (notably from /etc)
... sorry, I didn't write it all down :-)
file /mnt/bin/echo
cp /etc/fstab /media/etc/fstab

umount /mnt ; mdconfig -d -u0

After setting up the miniroot on /dev/ada0p2, I rebooted from there and mounted the real filesystems onto /mnt and copied over the files from the miniroot to /mnt.

I then rebooted with the new system and cleared the pkg cache and reinstalled all of my packages.

In the end, it worked fine and is now running in 64-bit mode.

/FreeBSD | Posted at 11:10 | permanent link

Mon, 12 Nov 2018

Setting up my new home NAS with FreeBSD 11.2

FreeBSD's 25th anniversary

So, I've got my new HPE Proliant Microserver Gen10 last summer, but I hadn't had time to set up it yet.

I am setting it up with FreeBSD. (It's a sobering thought that FreeBSD is now 25 years old: I've been running it since the very first version, coming from 386BSD and Microport System V/AT before that.)

I've put the 4 Seagate drives in the bays and inserted a USB key with FreeBSD 11.2 on it in the internal USB port. As reported in the previous blog entry, I had to add a "/boot/loader.conf" file with


in it.

Then, I needed to:

  • Install packages with pkg: perl5, zip/unzip, zile, mutt, rsync, sudo, samba, and smartmontools

  • Copy the user accounts from my old proliant server onto the new datasink server. I haven't decided yet if I will shut down the old server or if I will just let it run on my network.

  • Install the 4 Seagate drives under ZFS... more on this below.

  • Copy the files from my old proliant server to the new one.

  • Activate NFS on the new server. With ZFS, I don't need to start the usual NFS server processes, as ZFS supports NFS sharing directly (see below).

  • Move the large external USB drive that I use for weekly rsync backups onto the new machine.

  • Configure regular backups, monitoring, etc. on the new server.

  • Exchange the names proliant and datasink on the two machines. Verify that the Windows machines and the Macs on my home network can access the new server transparently.

  • And that should be it.

Setting up the 4 Seagate disks with ZFS

Here is how I set up the four 6TB disks on that new server:

  1. Decided to use the 4 drives in a RAIS-5 configuration, which allows me to recover from a single drive failure. If the Microserver had had 5 drives, I would have used a RAID-6 configuration, but with 4 drives, it seemed like an exageration.

  2. Decided to create a single large ZFS pool with all of the drives in it.

  3. Also decided to limit the number of ZFS filesystems I create in my ZFS pool. For the limited usage I make of my little home server, I haven't found much use over the years for splitting the disk space pool into multiple logical filesystems, apart from sharing via NFS, so this time, I'm going with just a few filesystems: a large one called /data, a smaller one for user files called '/homes' that will be exported via NFS, and the usual /var and /usr.

  4. However, I've been running a ZFS snapshot script on my machine for the past few years (as explained here), and I've found it quite useful. So I decided to continue with them. So I must account for enough freespace in the ZFS pool for all of the data from the snapshots.

  5. For other uses, I'll create symbolic links into the /data zpool for /backups and others.

  6. Note: I have used the /dev/diskid/* devices to set up my ZFS pool, rather than the /dev/ada* devices. If I get a drive failure or take a drive out, I find the renumbering of ada devices to be a scary proposition. Similarly, when I use external USB drives, I give them GPT names and use these rather than /dev/da* which can change when you unplug/replug the USB connectors.

So, here are the commands that I've run to initialize the disk space on my new server, conserved here for future reference:

  • Check out which disks we have available:

    ls /dev/diskid

  • Create the ZFS pool (the ashift option specifies the drives have 4KB blocks)

    zpool create -o ashift=12 -m /zfspool zfspool raidz diskid/DISK-ZAD4QZAT diskid/DISK-ZAD4RS61 diskid/DISK-ZAD4V4N3 diskid/DISK-ZAD4V4N9
    (question: why have a mountpoint for a ZFS pool?)

  • Create the filesystems in my ZFS pool:

    zfs create zfspool/data mountpoint=/data
    zfs create zfspool/var mountpoint=legacy
    zfs create zfspool/home mountpoint=legacy
    zfs create zfspool/usr mountpoint=legacy
    zfs create zfspool/tmp mountpoint=legacy

  • Copy the existing stuff onto the new partitions and set the real mountpoints:

    foreach i ( var home usr tmp )
    mount -t zfs zfspool/$i /mnt
    ( cd /$i ; sudo rsync -aHv . /mnt/ )
    umount /mnt
    zfs set mountpoint=/$i zfspool/$i

  • Share the /home dataset:

    zfs set sharenfs=on zfspool/home
    (check that this works... I am not sure)

/FreeBSD | Posted at 07:39 | permanent link

A new HPE Proliant Microserver

Last summer, one of the disks on my Proliant Microserver started generating some errors, so I decided to replace it with a newer generation, and I bought the Gen10 of the HPE Proliant Microserver.


It's a nice piece of hardware. I bought it without any disks inside, and bought 4 Seagate 6 TB NAS drives from Amazon on Prime Day.


So the question was: should I put FreeBSD on that machine, or should I install FreeNAS given that it's mostly used as a file server for my home network?

After some back and forth, I decided to put FreeBSD onto it.

Now, a bit of a nasty surprise awaited me: the HPE Proliant Microserver Gen10 does not boot FreeBSD out of the box. A known issue prevents it from booting the GENERIC kernel as is. The bug is described here, and unfortunately it doesn't look like it's going to be fixed in 11.2, 12.0, or beyond (though it seems like this patch ought to fix the issue).

However, the problem is easy enough to fix: it just needs the FreeBSD system to have a file called /boot/loader.conf that contains the following line: hw.pci.realloc_bars="1"

and then the O/S just boots normally.

I have put the 4 Seagate drives in the enclosure, and added a small USB thumbdrive in the internal USB port to act as the boot device. I will format all the drives as a ZFS RAID-5 configuration and put all of the data and important files onto there.

The configuration of the new fileserver is the topic of the next blog entry.

Question: my experience with USB thumbdrives is so-and-so... after a while they just seem to become corrupted. I see three possibilities to alleviate that:

  1. Have 2 thumbdrives and periodically (daily?) rsync the content of the real live one onto the other. If the first one ever becomes corrupted, just discard it and use the second one, which should be fine.

  2. Use nanoBSD to produce an O/S that will seldom write onto the USB thumbdrive and therefore greatly extend its life.

  3. Ignore the problem and hope the USB thumbdrive never fails (of course, making backups of the USB thumbdrive onto another system so that if it did fail, I could create another one from the backup andi bring my fileserver back to life).

Stay tuned to see what I will decide to do next :-)

/hardware | Posted at 01:05 | permanent link

Sun, 11 Nov 2018

The 11th of November 2018


Today is the 100th anniversary of the signature of the armistice which ended World War One.

I had the opportunity to visit the beaches of Normady in 2011, including the Canadian monument at Vimy and the cemetaries where many of our fellow countrymen are buried having given their life in service to their country to fight for liberty.

On 11/11, we like to remember them and all of the brave soldiers who have given (and are still giving) time and effort to help protect us in war and peace alike.

War is always horrible and politics on a global scale is always complicated. But on this Remembrance Day, let's all find a moment to remember all of those who have fought and are fighting for us.


And on this special day, let's all remember John McCrae's poem, "In Flanders Field":

In Flanders fields the poppies blow
    Between the crosses, row on row,
  That mark our place; and in the sky
  The larks, still bravely singing, fly
Scarce heard amid the guns below.

We are the Dead. Short days ago
We lived, felt dawn, saw sunset glow,
  Loved and were loved, and now we lie
      In Flanders fields.

Take up our quarrel with the foe:
To you from failing hands we throw
  The torch; be yours to hold it high.
  If ye break faith with us who die
We shall not sleep, though poppies grow
      In Flanders fields.

Peace to all.

/misc | Posted at 17:52 | permanent link

Sat, 13 Jan 2018

What crazy weather!

Crazy Weather

OK, so a few days ago, I complained that it was really cold in Montreal over the Christmas holidays. It was regularly around -21 degrees Celcius (or below zero for our Fahrenheit-using friends), and when you add the windchill factor, it actually felt like -40.

Now, for the past couple of days, the temperature has shot up to above the freezing point. Way above. And it's been raining. But winter is coming back and it's freezing today. I don't relish the thought of going outside later on this morning and seeing how all the streets with be covered in ice :-(

I like winter, but I don't like rain in winter.


/misc | Posted at 06:49 | permanent link

Mon, 01 Jan 2018

2018 is here

2018 arrives

...and suddenly 2018 is here. Lots of expectations for that new year.

It started oddly: Sylvie has a big cold, so she stayed under the covers and we stayed at home together. I think it was our first New Year's celebration with just the two of us.

At midnight, I got an SMS from Olivier, and when I tried to reply: poof! Message failed. Tried sending messages for about 45 minutes, and the vast majority just failed.

I am not sure if it's the local base station in my part of downtown Montreal that too busy, or if its the Rogers cellular network that was overwhelmed, or whether it's the whole cellular infrastructure that is knackered, but it is quite annoying.

Of course, in the meantime, Apple's iMessage service worked fine, as did e-mail, Twitter, and a lot of other TCP/IP-based services I'm sure.

I'm quite disappointed at the Rogers' cellular infrastructure, though.

Oh well, let's not be overly critical on this new year's day.

Happy New Year! May 2018 bring health, happiness, and success to you and your loved ones all year long.

Best wishes!

/misc | Posted at 01:18 | permanent link