Renaming USB device

Polytropon freebsd at
Wed Nov 11 00:22:33 UTC 2009

On Tue, 10 Nov 2009 17:47:38 -0600, Peter Steele <psteele at> wrote:
> I have a bootable FreeBSD image on a USB stick that clones
> itself on the target system's hard drive, creating partitions
> and other configuration as defined in the cloning logic. 
> The /etc/fstab on the USB image is hard coded to mount 
> root (/) from /dev/da0s1a. However, other systems where
> the hard drives use the same prefix as the USB stick,
> the fstab on the stick is incorrect (it would need to be
> /dev/da4s1a on systems with four SCSI drives since those
> disks would be names da0-da3).
> So what we really want is a way to solve this problem--
> Have a generic bootable USB drive that doesn't need to
> have a custom fstab for different kinds of systems.

In this case, labelling the USB stick would be a good
chioce. The /etc/fstab entries then refer to those labels
instead of device names (that could change). You can
use generic labels as well as UFS labels here; even a
reference to the UFSID would be possible, as well as
independant from da detection order.

For the target hard disk, which sometimes is ad (ATA disks),
sometimes da (SCSI and SATA disks), a conditional based upon
dmesg could be a good way to automate the process of finding
out where to install to.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list