Backups and serial console servers
It’s funny what keeps us awake at night. It might be the root beer and popcorn I had about 9 hours ago as I sat and watched a movie. Or it might be that I have two pet projects on the go and they are about to reach a milestone.
The first, and longest running of these projects involves Bacula on FreeBSD. The second is a serial console server.
Bacula – why?
Bacula has been around for a few years. I never heard of it early 2003, when it was mentioned to me on IRC. The FreeBSD port turned up in February, and I started playing in early May. I’ve even submitted two PRs to upgrade Bacula. I quickly came to like Bacula because:
- it was able to backup to disk or tape
- the server ran on various platforms
- the clients ran on Windows as well as the above platforms
- the ability to schedule different jobs at different times/days
- it used a database to record backup information
- it appeared to be well structured and laid out for expansion
As time went on, I learned that Bacula could do a few things that my other backup software (Amanda) could not:
- backup to disk 1
- create backups which span media 2
- put more than one backup on a given volume (i.e. tape), also known as appending 3
1 I have been told that Amanda can dump to disk, but it is not part of
2 They want to change that.
3 This is by design. See their FAQ for detail.
Granted, I had not actually used Amanda, but I had looked at it. I had installed the software and I was getting ready to deploy it. Then I found Bacula.
A few other advantages of Bacula:
- Multiple backup jobs (but not simultaneous)
- Job sequencing using priorities
- Restore of a complete system starting from bare metal
- Autochanger support
- Support for autochanger barcodes
Bacula – coming soonI had been given a DAT drive with a 4-tape changer by Marius Sorteberg (thanks). I immediately started playing with Bacula on that machine. I liked the way Bacula was set up to use a database in conjunction with scheduled jobs. My immediate goal was to create a PostgreSQL port of this tool (it uses MySQL or SQLite at present). I also want to create a web interface for it. Given that the archive information is in a database, Bacula just screams out for a web application.
Let’s walk, then run. First, I wanted to test Bacula on my setup. I knew nothing about my DAT drive, and my tapes were aging. I started backing up large amounts of data and restoring them. I found a problem. If a file spanned two tapes, the restored file was not the same size as the original file.
Kern Sibbald, the author of Bacula, has to be one of the most patient developers I know. Backup software isn’t the most glamorous of applications. You don’t hear people bragging about their latest backup app. Yet Kern has been working away on this application for years. It’s well designed, and has great potential. Kern has been very helpful with the problem I found. We have slowly tracked down the cause of the problem. The bug was difficult to isolate because the problem occurred at the end of the tape and that meant testing was very time consuming. We never thought the problem would be with the pthreads library, but it was.
With assistance from people on the FreeBSD SCSI list, we’ve found a bug in the pthreads library of FreeBSD 4.*. The problem doesn’t exist on 5.* because it does not rely on non-blocking file descriptors. On FreeBSD 5.*, Bacula runs fine, with either libkse or libthr (the two threading libraries available).
Kern and I have been able to isolate the bug, and in conjunction with advice from the freebsd-hackers and freebsd-standards mailing lists, a patch has been created. Preliminary testing has been very promising. We have to do more testing before we are satisfied that it works. Then it’ll go into -CURRENT, and after some testing there, it’ll be merged from current (MFC’d) into -STABLE.
Watch this space. [NOTE: This patch was committed on 29 Sep 2003, and was merged from current into stable on 11 Oct 2003 and therefore will be available in FreeBSD 4.9. For details, pleaes refer to the commit log.]
Serial Console ServersSerial consoles are your friend. They make life easier when your box is not healthy. I was given a Boca 8 port serial card by David Martin. I’m trying to get it running. I’m having no success. It seems that FreeBSD just doesn’t see the card.
The FreeBSD handbook has a small blurb on multi-port serial cards within the Serial Communications section of the FreeBSD FAQ. You also want to read man sio(4). Based upon the above resources, I added the following entries to my kernel configuration file:
options COM_MULTIPORT device sio4 at isa? port 0x100 flags 0xb05 device sio5 at isa? port 0x108 flags 0xb05 device sio6 at isa? port 0x110 flags 0xb05 device sio7 at isa? port 0x118 flags 0xb05 device sio8 at isa? port 0x120 flags 0xb05 device sio9 at isa? port 0x128 flags 0xb05 device sio10 at isa? port 0x130 flags 0xb05 device sio11 at isa? port 0x138 flags 0xb05 irq 10
But dmesg doesn’t show anything for sio4..11. What am I missing?