Removable Media

These days, the removable media you’ll most likely deal with are external hard drives, flash drives, and CDs. The CD is the simplest, because you know how to use mount(8) and umount(8), and you know its device node and filesystem type will always be the same. But how do you identify the device name of a removable hard drive?

When you attach a drive to your machine, OpenBSD automatically assigns your drive a device node to your console and prints a message to the console. You can check the console as you attach the drive, or you can watch your messages log by running tail -f /var/log/messages before attaching the drive.

If you frequently use a particular removable disk, you can simplify your routine by making an /etc/fstab entry for it. Here are some sample /etc/fstab entries for a CD and a FAT flash drive.

/dev/cd0c /cdrom cd9660 ro,noauto
/dev/sd3i /mnt msdos rw,noauto

You can’t use DUIDs for removable media, because the actual media might change.

Now you can mount your CD on /cdrom by entering mount /cdrom, and your FAT flash drive on /mnt by entering mount /mnt.

Note that OpenBSD does not create a /cdrom directory by default; you’ll need to create it yourself. You could point both of these at /mnt, but I like having a dedicated CD mount point on my systems, and having two devices share a mount point risks concealing one of the filesystems. (Remember that OpenBSD has stackable mounts, as discussed in Chapter 8.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.18.198