MOUNT.CONF(5)
π MOUNT.CONF(5) π
okay so bestie, this is the manual page for mount.conf(5) β yes the 5 means "file formats" section, we love a file format moment π. It's literally the root file system mount configuration file and it's kind of the main character of your boot process, no cap.
β¨ SYNOPSIS β¨
/.mount.conf
that's it. that's the file. it lives at the root of your root fs and it's giving "tiny file, huge responsibilities" π
πΈ DESCRIPTION πΈ
So during the bootup process, the FreeBSD kernel is gonna try to mount the root file system using the logic in the vfs_mountroot() function in src/sys/kern/vfs_mountroot.c. Like, that's the whole vibe. And the root mount logic goes a little something like this:
- The kernel will synthesize in memory a config file with default directives for mounting the root file system. The logic for this is in
vfs_mountroot_conf0(). yes bestie, it's making a little config file out of thin air, iconic. - The kernel will first mount
devfs(4)as the root file system. - Next, the kernel will parse the in-memory config file created in step 1 and try to mount the actual root file system. See "FILE FORMAT" for the format of the config file.
- When the actual root file system is mounted,
devfs(4)will be re-mounted on the/devdirectory. - If a
/.mount.conffile does not exist in the root file system which was just mounted, the root mount logic stops here. that's it, we're done, go home. - If a
/.mount.conffile exists in the root file system which was just mounted, this file will be parsed, and the kernel will use this new config file to try to re-mount the root file system. See "FILE FORMAT" for the format of the config file. - If the new root file system has a
/.mountdirectory, the old root file system will be re-mounted on/.mount. - The root mount logic will go back to step 4. yes, it loops. it's recursive. it's giving "we will keep doing this until one of us gives up" π
The root mount logic is recursive, and step 8 will be repeated as long as each new root file system which is mounted has a /.mount.conf file. so likeβ¦ it can go forever if you let it. be normal about it π«Ά
π¦ FILE FORMAT π¦
The kernel parses each line in .mount.conf and then tries to perform the action specified on that line as soon as it is parsed. no buffering, no waiting, it's immediate, it's eager, it's a Leo.
#β a line beginning with a#is a comment and is ignored. we love a silent supporter.{FS}:{MOUNTPOINT} {OPTIONS}β the kernel will try to mount this in an operation equivalent to:
mount -t {FS} -o {OPTIONS} {MOUNTPOINT} /
If this is successfully mounted, further lines in .mount.conf are ignored. If all lines in .mount.conf have been processed and no root file system has been successfully mounted, then the action specified by .onfail is performed. so like, first success wins, and if nobody winsβ¦ .onfail gets the aux cord π
.askβ when the kernel processes this line, amountroot>command-line prompt is displayed. At this prompt, the operator can enter the root mount. it's giving "we tried everything, you try, bestie" π.md fileβ create a memory backedmd(4)virtual disk, using file as the backing store. yes, a whole disk, in memory, out of a file. slay..onfail [panic|reboot|retry|continue]β if after parsing all the lines in.mount.confthe kernel is unable to mount a root file system, the.onfaildirective tells the kernel what action to perform. pick your fighter:panic,reboot,retry, orcontinueπ.timeout Nβ before trying to mount a root file system, if the root mount device does not exist, wait at most N seconds for the device to appear before trying to mount it. If.timeoutis not specified, the default timeout is3seconds. so yeah, it'll wait, but only 3 seconds by default. it has boundaries.
π EXAMPLES π
mkay so the following example .mount.conf will direct the kernel to try mounting the root file system first as an ISO CD9660 file system on /dev/cd0, then if that does not work, as an ISO CD9660 file system on /dev/cd1, and then if that does not work, as a UFS file system on /dev/ada0s1a. If that does not work, a mountroot> command-line prompt will be displayed where the operator can manually enter the root file system to mount. Finally if that does not work, the kernel will panic. dramatic? yes. correct? also yes.
.onfail panic
.timeout 3
cd9660:/dev/cd0 ro
.timeout 0
cd9660:/dev/cd1 ro
.timeout 3
ufs:/dev/ada0s1a
.ask
The following example .mount.conf will direct the kernel to create a md(4) memory disk attached to the file /data/OS-1.0.iso and then mount the ISO CD9660 file system on the md device which was just created. The last line is a comment which is ignored. look at her, doing a little comment at the end, we stan.
.timeout 3
.md /data/OS-1.0.iso
cd9600:/dev/md# ro
# Can also use cd9660:/dev/md0 ro
The following example .mount.conf will direct the kernel to create a md(4) memory disk attached to the file /data/base.ufs.uzip and then mount the UFS file system on the md uzip device which was just created by the geom_uzip(4) driver. compressed root fs moment, so valid.
.md /data/base.ufs.uzip
ufs:/dev/md#.uzip ro
# Can also use ufs:/dev/md0.uzip ro
The following example .mount.conf will direct the kernel to do a unionfs mount on a directory /jail/freebsd-8-stable which has a chroot(2) environment. jail vibes β¨
.timeout 3
unionfs:/jail/freebsd-8-stable
β NOTES β
For each root file system which is mounted, a/devdirectory must exist so that the root mount logic can properly re-mountdevfs(4). If this directory does not exist, the system may hang during the bootup process. so likeβ¦ make the directory. please. i am begging. a hang is not cute π
π SEE ALSO π
nmount(2), md(4), boot.config(5), fstab(5), boot(8), loader(8), mount(8) β go read those too, they're the supporting cast and they ate π
π HISTORY π
The mount.conf file first appeared in FreeBSD 9.0. she's a 9.0 girlie, we love a debut π
π«Ά AUTHORS π«Ά
The root mount logic in the FreeBSD kernel which parses /.mount.conf was written by Marcel Moolenaar <marcel@FreeBSD.org>. This man page was written by Craig Rodrigues <rodrigc@FreeBSD.org>. thank you both, genuinely, for your service π«‘
and that's the whole page bestie β¨ this lovely little MOUNT.CONF(5) number is from the Debian file formats manual, dated October 17, 2013 β so old but still iconic, and it's gonna live in your terminal rent free, fr fr π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2013 Marcel Moolenaar
- Copyright (c) 2013 Craig Rodrigues
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms