Klaus Zimmermann's Corner

FreeBSD mounting of external drives for the Linux user

Just another quick note for Linux users switching to BSD: the mounting behavior is a little different. You might have beem OK in a modern Linux distribution oriented for the desktop by simply mounting the drive and watching it automagically in your file manager, much like Windows. Not so fast in FreeBSD.

Not only automounting is disabled by default, the very mount command itself behaves differently: unlike in Linux where the filesystem type is guessed from the information available in the disk, FreeBSD will by default attempt to mount it as one of its own UFS type unless instructed otherwise with the flag -t. The available filesystem types also are not very intuitive from a Linux background as the options are: cd9660, mfs, msdosfs, nfs, nullfs, smbfs, udf, and unionfs. I would not have guessed what was the name for FAT32 there before looking at mount(8).

Finally, device files also have a different naming convention. UFS in FreeBSD takes an additional step in Linux's division of disks in drives and partitions, and also adds the concept of slices on top. So a root partition on an install disk like /dev/sda1 in Linux may look like this in FreeBSD:

/dev/ada0p2
     ^^^|||-> disk
        ^^|-> partition
          ^-> slice

So how does a single partition USB drive like /dev/sdb look like? In my case: /dev/da0. And that's what you'd need to mount with the combined knowledge of the previous paragraphs.

So this is an example of a sequence of commands I'd use to mount a single-partition FAT32-formatted USB drive:

sudo dmesg | tail -20 # find the name of the connected drive in messages
sudo mkdir /media/extdrive # let's create a convenient mountpoint

# optional step, makes the mounted drive writable for your user:
sudo chown $USER:$USER /media/extdrive
sudo chmod 750 /media/extdrive

# actually mount your drive (watch for the actual name)
sudo mount -t msdosfs /dev/da0 /media/extdrive

# You can now browse and write to the drive via your file manager.

# unmount after done:
sudo umount /media/extdrive

And this is it! A little learning here and there and making yourself comfortable with as many OSes as possible goes a long way!