| 1 | # Overview # |
| 2 | |
| 3 | Installation notes for personal FreeBSD server. Very incomplete. |
| 4 | |
| 5 | # Basic System # |
| 6 | |
| 7 | ## Networking ## |
| 8 | |
| 9 | ## SCSI Tape Library ## |
| 10 | |
| 11 | ### Recipe: Identify tape library devices ### |
| 12 | |
| 13 | Use `camcontrol` to identify the drive(`sa`), changer(`ch`) and CAM(`pass`) |
| 14 | devices. |
| 15 | |
| 16 | root@talisker:/usr/local/etc/bacula # camcontrol devlist |
| 17 | <HP Ultrium 4-SCSI B63Z> at scbus0 target 5 lun 0 (sa0,pass0) |
| 18 | <QUANTUM UHDL 0086> at scbus0 target 5 lun 1 (pass1,ch0) |
| 19 | <HP MB2000FAMYV HPD7> at scbus1 target 0 lun 0 (pass2,da0) |
| 20 | <HP MB2000FAMYV HPD7> at scbus1 target 1 lun 0 (pass3,da1) |
| 21 | <HP MB2000FBUCL HPD3> at scbus1 target 2 lun 0 (pass4,da2) |
| 22 | <INTEL SSDSC2CT240A3 300i> at scbus2 target 0 lun 0 (ada0,pass5) |
| 23 | <WDC WD30EFRX-68EUZN0 80.00A80> at scbus2 target 1 lun 0 (ada1,pass6) |
| 24 | <WDC WD30EFRX-68EUZN0 80.00A80> at scbus3 target 0 lun 0 (ada2,pass7) |
| 25 | <WDC WD30EFRX-68EUZN0 80.00A80> at scbus3 target 1 lun 0 (ada3,pass8) |
| 26 | |
| 27 | ### Recipe: Probe SCSI bus ### |
| 28 | |
| 29 | If the tape library isn't powered up and finished with startup routines by the |
| 30 | time you turn on the server, it won't be detected properly. You must reprobe |
| 31 | the SCSI bus with the following steps, where "X" is the SCSI bus number. |
| 32 | |
| 33 | camcontrol devlist -v |
| 34 | camcontrol reset X |
| 35 | camcontrol rescan X |
| 36 | |
| 37 | ### Recipe: Manipulate changer ### |
| 38 | |
| 39 | Install `misc/mtx` from ports. Slots marked "Full" without a VolumeTag are |
| 40 | non-barcoded tapes. The `load` and `transfer` commands can be used to move |
| 41 | tapes within the library. |
| 42 | |
| 43 | root@talisker:~ # mtx -f /dev/pass1 status |
| 44 | Storage Changer /dev/pass1:1 Drives, 8 Slots ( 0 Import/Export ) |
| 45 | Data Transfer Element 0:Full (Storage Element 1 Loaded) |
| 46 | Storage Element 1:Empty |
| 47 | Storage Element 2:Full |
| 48 | Storage Element 3:Full |
| 49 | Storage Element 4:Full |
| 50 | Storage Element 5:Full |
| 51 | Storage Element 6:Empty |
| 52 | Storage Element 7:Empty |
| 53 | Storage Element 8:Full :VolumeTag=000106L3 |
| 54 | |
| 55 | ## ZFS ## |
| 56 | |
| 57 | ### Recipe: Create new ZFS filesystem ### |
| 58 | |
| 59 | There is effectively no overhead to compression, so enable it on all root ZFS |
| 60 | filesystems and allow it to be inherited. |
| 61 | |
| 62 | zfs create zfs_stripe_0/software |
| 63 | zfs set compression=lz4 zfs_stripe_0/software |
| 64 | |
| 65 | ### Recipe: Replacing a failed disk ### |
| 66 | |
| 67 | At the OS level, a failing disk may manifest like this: |
| 68 | |
| 69 | root@talisker:~ # dmesg |
| 70 | ... |
| 71 | (da0:mpt1:0:1:0): READ(10). CDB: 28 00 e8 e0 88 ae 00 00 01 00 |
| 72 | (da0:mpt1:0:1:0): CAM status: SCSI Status Error |
| 73 | (da0:mpt1:0:1:0): SCSI status: Check Condition |
| 74 | (da0:mpt1:0:1:0): SCSI sense: RECOVERED ERROR asc:5d,14 (Hardware impending failure too many block reassigns) |
| 75 | (da0:mpt1:0:1:0): Field Replaceable Unit: 5 |
| 76 | ... |
| 77 | |
| 78 | Once the disk has fully failed ZFS reports it like this: |
| 79 | |
| 80 | root@talisker:~ # zpool status |
| 81 | pool: zfs_mirror_0 |
| 82 | state: DEGRADED |
| 83 | status: One or more devices has been removed by the administrator. |
| 84 | Sufficient replicas exist for the pool to continue functioning in a |
| 85 | degraded state. |
| 86 | action: Online the device using 'zpool online' or replace the device with |
| 87 | 'zpool replace'. |
| 88 | scan: scrub repaired 128K in 15h33m with 0 errors on Fri Aug 31 22:08:42 2018 |
| 89 | config: |
| 90 | |
| 91 | NAME STATE READ WRITE CKSUM |
| 92 | zfs_mirror_0 DEGRADED 0 0 0 |
| 93 | mirror-0 DEGRADED 0 0 0 |
| 94 | 16848908995976332824 REMOVED 0 0 0 was /dev/da0 |
| 95 | da0 ONLINE 0 0 0 |
| 96 | da1 ONLINE 0 0 0 |
| 97 | |
| 98 | errors: No known data errors |
| 99 | |
| 100 | Replacing the disk is a single command: |
| 101 | |
| 102 | root@talisker:~ # zpool replace zfs_mirror_0 16848908995976332824 da2 |
| 103 | |
| 104 | Monitor the resilvering process until complete. |
| 105 | |
| 106 | root@talisker:~ # zpool status |
| 107 | pool: zfs_mirror_0 |
| 108 | state: DEGRADED |
| 109 | status: One or more devices is currently being resilvered. The pool will |
| 110 | continue to function, possibly in a degraded state. |
| 111 | action: Wait for the resilver to complete. |
| 112 | scan: resilver in progress since Wed Sep 12 20:20:39 2018 |
| 113 | 4.82M scanned out of 682G at 617K/s, 322h2m to go |
| 114 | 4.62M resilvered, 0.00% done |
| 115 | config: |
| 116 | |
| 117 | NAME STATE READ WRITE CKSUM |
| 118 | zfs_mirror_0 DEGRADED 0 0 0 |
| 119 | mirror-0 DEGRADED 0 0 0 |
| 120 | replacing-0 REMOVED 0 0 0 |
| 121 | 16848908995976332824 REMOVED 0 0 0 was /dev/da0 |
| 122 | da2 ONLINE 0 0 0 (resilvering) |
| 123 | da0 ONLINE 0 0 0 |
| 124 | da1 ONLINE 0 0 0 |
| 125 | |
| 126 | errors: No known data errors |
| 127 | |
| 128 | ## Fluxbox ## |
| 129 | |
| 130 | Change Fluxbox clock format in `~/.fluxbox/init`. |
| 131 | |
| 132 | session.screen0.strftimeFormat: %d %b, %a %H:%M:%S |
| 133 | |
| 134 | ## Misc Software ## |
| 135 | |
| 136 | Install from ports: `ntp`, `gimp`, `pidgin`, `geeqie`, `deluge`, |
| 137 | `kicad[-devel]`, `wget`, `bind-tools`, `irssi`, `vim` (and with GTK support) |
| 138 | |
| 139 | # Daemons # |
| 140 | |
| 141 | ## Samba ## |
| 142 | |
| 143 | ## Bacula ## |
| 144 | |
| 145 | Install `sysutils/bacula-server` from ports. |
| 146 | |
| 147 | ## PostgreSQL ## |
| 148 | |
| 149 | ## MySQL ## |
| 150 | |
| 151 | Install `databases/mysql56-client` and `databases/mysql56-server` from ports. |
| 152 | |
| 153 | Add `mysql_enable="YES"` to `/etc/rc.conf`. |
| 154 | |
| 155 | Set passwords for root and create unprivileged users for relevant databases. |
| 156 | |
| 157 | ## Apache (with Python CGI and MySQL capabilities) ## |
| 158 | |
| 159 | Install `www/apache24` and `databases/py-MySQLdb` from ports. |
| 160 | |
| 161 | Add `apache24_enable="YES"` to `/etc/rc.conf`. |
| 162 | |
| 163 | Add an entry for this host to `/etc/hosts` and ensure file based authentication is enabled in `/etc/nsswitch.conf`. |
| 164 | |
| 165 | Edit `/usr/local/etc/apache24/httpd.conf`, setting `ServerName` and `ServerAdmin`, and uncommenting the `cgi-bin` module. |
| 166 | |
| 167 | Install cgi-bin script, setting shebang, execute permissions, etc. |
| 168 | |
| 169 | # Recipes # |
| 170 | |
| 171 | ## List of installed ports ## |
| 172 | |
| 173 | pkg query --all '%o %n-%v %R' |
| 174 | |
| 175 | ## Show options port was built with ## |
| 176 | |
| 177 | cd $portsdir |
| 178 | make showconfig |
| 179 | |
| 180 | ## Reset terminal environment ## |
| 181 | |
| 182 | exec su - <username> |
| 183 | |
| 184 | ## Start separate X session ## |
| 185 | |
| 186 | xinit /usr/local/bin/xterm -- :2 |
| 187 | |