Overview

Installation notes for personal FreeBSD server. Very incomplete.

Basic System

Networking

SCSI Tape Library

Recipe: Identify tape library devices

Use camcontrol to identify the drive(sa), changer(ch) and CAM(pass) devices.

root@talisker:/usr/local/etc/bacula # camcontrol devlist
<HP Ultrium 4-SCSI B63Z>           at scbus0 target 5 lun 0 (sa0,pass0)
<QUANTUM UHDL 0086>                at scbus0 target 5 lun 1 (pass1,ch0)
<HP MB2000FAMYV HPD7>              at scbus1 target 0 lun 0 (pass2,da0)
<HP MB2000FAMYV HPD7>              at scbus1 target 1 lun 0 (pass3,da1)
<HP MB2000FBUCL HPD3>              at scbus1 target 2 lun 0 (pass4,da2)
<INTEL SSDSC2CT240A3 300i>         at scbus2 target 0 lun 0 (ada0,pass5)
<WDC WD30EFRX-68EUZN0 80.00A80>    at scbus2 target 1 lun 0 (ada1,pass6)
<WDC WD30EFRX-68EUZN0 80.00A80>    at scbus3 target 0 lun 0 (ada2,pass7)
<WDC WD30EFRX-68EUZN0 80.00A80>    at scbus3 target 1 lun 0 (ada3,pass8)

Recipe: Probe SCSI bus

If the tape library isn’t powered up and finished with startup routines by the time you turn on the server, it won’t be detected properly. You must reprobe the SCSI bus with the following steps, where “X” is the SCSI bus number.

camcontrol devlist -v
camcontrol reset X
camcontrol rescan X

Recipe: Manipulate changer

Install misc/mtx from ports. Slots marked “Full” without a VolumeTag are non-barcoded tapes. The load and transfer commands can be used to move tapes within the library.

root@talisker:~ # mtx -f /dev/pass1 status
  Storage Changer /dev/pass1:1 Drives, 8 Slots ( 0 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded)
      Storage Element 1:Empty
      Storage Element 2:Full 
      Storage Element 3:Full 
      Storage Element 4:Full 
      Storage Element 5:Full 
      Storage Element 6:Empty
      Storage Element 7:Empty
      Storage Element 8:Full :VolumeTag=000106L3

ZFS

Recipe: Create new ZFS filesystem

There is effectively no overhead to compression, so enable it on all root ZFS filesystems and allow it to be inherited.

zfs create zfs_stripe_0/software
zfs set compression=lz4 zfs_stripe_0/software

Recipe: Replacing a failed disk

At the OS level, a failing disk may manifest like this:

root@talisker:~ # dmesg
...
(da0:mpt1:0:1:0): READ(10). CDB: 28 00 e8 e0 88 ae 00 00 01 00
(da0:mpt1:0:1:0): CAM status: SCSI Status Error
(da0:mpt1:0:1:0): SCSI status: Check Condition
(da0:mpt1:0:1:0): SCSI sense: RECOVERED ERROR asc:5d,14 (Hardware impending failure too many block reassigns)
(da0:mpt1:0:1:0): Field Replaceable Unit: 5
...

Once the disk has fully failed ZFS reports it like this:

root@talisker:~ # zpool status
  pool: zfs_mirror_0
 state: DEGRADED
status: One or more devices has been removed by the administrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
  scan: scrub repaired 128K in 15h33m with 0 errors on Fri Aug 31 22:08:42 2018
config:

        NAME                      STATE     READ WRITE CKSUM
        zfs_mirror_0              DEGRADED     0     0     0
          mirror-0                DEGRADED     0     0     0
            16848908995976332824  REMOVED      0     0     0  was /dev/da0
            da0                   ONLINE       0     0     0
            da1                   ONLINE       0     0     0

errors: No known data errors

Replacing the disk is a single command:

root@talisker:~ # zpool replace zfs_mirror_0 16848908995976332824 da2

Monitor the resilvering process until complete.

root@talisker:~ # zpool status
  pool: zfs_mirror_0
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Wed Sep 12 20:20:39 2018
        4.82M scanned out of 682G at 617K/s, 322h2m to go
        4.62M resilvered, 0.00% done
config:

        NAME                        STATE     READ WRITE CKSUM
        zfs_mirror_0                DEGRADED     0     0     0
          mirror-0                  DEGRADED     0     0     0
            replacing-0             REMOVED      0     0     0
              16848908995976332824  REMOVED      0     0     0  was /dev/da0
              da2                   ONLINE       0     0     0  (resilvering)
            da0                     ONLINE       0     0     0
            da1                     ONLINE       0     0     0

errors: No known data errors

Fluxbox

Change Fluxbox clock format in ~/.fluxbox/init.

session.screen0.strftimeFormat: %d %b, %a %H:%M:%S

Misc Software

Install from ports: ntp, gimp, pidgin, geeqie, deluge, kicad[-devel], wget, bind-tools, irssi, vim (and with GTK support)

Daemons

Samba

Bacula

Install sysutils/bacula-server from ports.

PostgreSQL

MySQL

Install databases/mysql56-client and databases/mysql56-server from ports.

Add mysql_enable="YES" to /etc/rc.conf.

Set passwords for root and create unprivileged users for relevant databases.

Apache (with Python CGI and MySQL capabilities)

Install www/apache24 and databases/py-MySQLdb from ports.

Add apache24_enable="YES" to /etc/rc.conf.

Add an entry for this host to /etc/hosts and ensure file based authentication is enabled in /etc/nsswitch.conf.

Edit /usr/local/etc/apache24/httpd.conf, setting ServerName and ServerAdmin, and uncommenting the cgi-bin module.

Install cgi-bin script, setting shebang, execute permissions, etc.

Recipes

List of installed ports

pkg query --all '%o %n-%v %R'

Show options port was built with

cd $portsdir
make showconfig

Reset terminal environment

exec su - <username>

Start separate X session

xinit /usr/local/bin/xterm -- :2