I’m going to talk about setting up a laptop computer to boot and run FreeBSD from an external USB 2.0 attached hard drive. So far, this is working pretty nicely.

The office laptop hard drive broke down, so I’ve been doing a bunch of re-installation of stuff. For the office crew, it’s a given that we will be running Microsoft Windows XP as the operating system. But while I was waiting for the replacement drive to show up, I looked up “FreeBSD” and the laptop model via Google, and found a handy page listing the various drivers that FreeBSD would need to make use of the laptop resources. So I gave that a try using one of the 2.5″ IDE drives that we have stored from laptop upgrades past. Except for the Broadcom-based onboard WiFi device, everything worked nicely.

Then the replacement drive showed up, so it was time to do the XP re-install on that. One of the things I had noticed, though, was that the BIOS boot menu had an option for booting from a USB device. Hmmm.

So I moved my laptop hard disk into a 2.5″ external USB 2.o drive enclosure, the sort that draws its power from the USB port itself. I put in the FreeBSD 6.1-RELEASE install CD-ROM, and booted the laptop to CD. This gave me the option of installing FreeBSD to either the onboard hard disk or the USB hard disk. I selected the USB disk and proceeded with a express install for the “User with kernel sources” distribution.

My hard drive is about 40GB in size. I chose to use 15GB for the FreeBSD installation, leaving about 23GB for a FAT32 partition. I can mount a FAT32 partition read/write from either FreeBSD or Windows, so if I keep my data files on that partition, then I have the functionality of a decent-sized external disk for that purpose. This is where I will put documents, saved web pages, PowerPoint presentations, and so forth. But for the OS, once I allocated space for the root, “var”, “tmp”, and swap partitions, I had about 11GB of space for the “usr”, the one where applications get installed. I’ve amended the “fstab” file so that the FAT32 partition gets mounted at system startup.

I did something a bit different from my usual installation after the base system was installed. I used the FreeBSD “packages” system, which loads on pre-compiled binaries of selected applications. I usually use the “ports” system, but I didn’t feel like I had room to store the various downloaded sources for the applications. This is a bit of an experiment.

As I mentioned, I hadn’t been able to get the onboard WiFi to work on the previous try. I had no better luck with it this time, even with direct access to the Windows driver and using the “NDISulate” procedure. In looking for information, I discovered that FreeBSD 6.x has builtin support for Atheros-based WiFi cards, so I looked around and found a DWL-G630 card that wasn’t in use. I inserted it in the PCMCIA slot, typed in “ifconfig ath0″ at the prompt, and immediately the card was recognized. I visited “sysinstall” to set up the interface to use DHCP. It found my wireless router with no trouble. I was now free of the CAT-5 network cable, which was a nice advance.

I had the “xorg.conf” configuration file from the previous install, so I put that in place and tried “startx”. It trundled, then said that there were no available screens. Huh? Then I remembered that there was another step the previous time: install the video driver. After that, X11 came right up, displaying the usual ugly checkerboard in the background. Another visit to the “packages” got me the Fluxbox window manager, a nice lightweight window management system. I put an “xterm” and “fluxbox” into my .xinitrc file, and “startx” brought up Fluxbox fine that time.

Right now, I have a slew of packages tagged for installation, including “Gaim” for instant messaging, “OpenOffice 2″ for documents, spreadsheets, and presentations, a variety of file managers for X11, “LaTeX” for document typesetting, “XEmacs 21″ for all sorts of text editing tasks, “Scribus” for desktop publishing, and various programming languages and utilities.

I intend to leave the FreeBSD with a pretty generic kernel and also to have it boot to the regular console interface. The idea will be that this disk will be my usual interface to the office laptop, and can also go with me anywhere. Whenever I need to use some other machine, though, I can boot FreeBSD if it has a BIOS option to boot to USB device. This I expect will be useful for diagnosing other machines as well as letting me use a familiar setup in unfamiliar places. I need to check into how tough it is to set up XOrg for other systems. More about this later.

Update: I ran into a bit of a gotcha: just mounting the FAT32 partition as read/write under FreeBSD left it with the default of being owned by root, which meant that my user account could not write files to it. The fix? I changed my /etc/fstab entry for it to read:

/dev/da0s2 /mnt/fat msdos rw,-u=1001,-g=0 2 2

My user account is in the superuser group. If that doesn’t hold for yours, the group number would match the user number.

I’ve also worked out getting the SVGA output on the laptop to work with XOrg and tested it for use with “impress”, the OpenOffice presentation package that parallels Microsoft’s PowerPoint. I can view DVDs, even those with menus, using “ogle”. There’s a reasonable MP3 player in “beep-media-player”. I haven’t located a GUI-based mixer package yet, but “mixer 50″ from a shell prompt sets the sound level to half-volume. Even with the package-install-fest yesterday, I’ve still only used a third of my available space for applications and user data under FreeBSD, and there is still virtually the entire FAT32 partition to use yet.