15b2d5e4fSEdward Tomasz Napierala.\" Copyright (c) 2013 Marcel Moolenaar 25b2d5e4fSEdward Tomasz Napierala.\" Copyright (c) 2013 Craig Rodrigues 35b2d5e4fSEdward Tomasz Napierala.\" All rights reserved. 45b2d5e4fSEdward Tomasz Napierala.\" 55b2d5e4fSEdward Tomasz Napierala.\" Redistribution and use in source and binary forms, with or without 65b2d5e4fSEdward Tomasz Napierala.\" modification, are permitted provided that the following conditions 75b2d5e4fSEdward Tomasz Napierala.\" are met: 85b2d5e4fSEdward Tomasz Napierala.\" 1. Redistributions of source code must retain the above copyright 95b2d5e4fSEdward Tomasz Napierala.\" notice, this list of conditions and the following disclaimer. 105b2d5e4fSEdward Tomasz Napierala.\" 2. Redistributions in binary form must reproduce the above copyright 115b2d5e4fSEdward Tomasz Napierala.\" notice, this list of conditions and the following disclaimer in the 125b2d5e4fSEdward Tomasz Napierala.\" documentation and/or other materials provided with the distribution. 135b2d5e4fSEdward Tomasz Napierala.\" 145b2d5e4fSEdward Tomasz Napierala.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 155b2d5e4fSEdward Tomasz Napierala.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 165b2d5e4fSEdward Tomasz Napierala.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 175b2d5e4fSEdward Tomasz Napierala.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 185b2d5e4fSEdward Tomasz Napierala.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 195b2d5e4fSEdward Tomasz Napierala.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 205b2d5e4fSEdward Tomasz Napierala.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 215b2d5e4fSEdward Tomasz Napierala.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 225b2d5e4fSEdward Tomasz Napierala.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 235b2d5e4fSEdward Tomasz Napierala.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 245b2d5e4fSEdward Tomasz Napierala.\" SUCH DAMAGE. 255b2d5e4fSEdward Tomasz Napierala.\" 265b2d5e4fSEdward Tomasz Napierala.\" 275b2d5e4fSEdward Tomasz Napierala.Dd October 17, 2013 285b2d5e4fSEdward Tomasz Napierala.Dt MOUNT.CONF 5 295b2d5e4fSEdward Tomasz Napierala.Os 305b2d5e4fSEdward Tomasz Napierala.Sh NAME 315b2d5e4fSEdward Tomasz Napierala.Nm mount.conf 325b2d5e4fSEdward Tomasz Napierala.Nd root file system mount configuration file 335b2d5e4fSEdward Tomasz Napierala.Sh SYNOPSIS 345b2d5e4fSEdward Tomasz Napierala.Pa /.mount.conf 355b2d5e4fSEdward Tomasz Napierala.Sh DESCRIPTION 365b2d5e4fSEdward Tomasz NapieralaDuring the bootup process, the 375b2d5e4fSEdward Tomasz Napierala.Fx 385b2d5e4fSEdward Tomasz Napieralakernel will try to mount the root file system 395b2d5e4fSEdward Tomasz Napieralausing the logic in the 405b2d5e4fSEdward Tomasz Napierala.Fn vfs_mountroot 415b2d5e4fSEdward Tomasz Napieralafunction in 425b2d5e4fSEdward Tomasz Napierala.Pa src/sys/kern/vfs_mountroot.c . 435b2d5e4fSEdward Tomasz NapieralaThe root mount logic can be described as follows: 445b2d5e4fSEdward Tomasz Napierala.Bl -enum 455b2d5e4fSEdward Tomasz Napierala.It 465b2d5e4fSEdward Tomasz NapieralaThe kernel will synthesize in memory a config file 475b2d5e4fSEdward Tomasz Napieralawith default directives for mounting 485b2d5e4fSEdward Tomasz Napieralathe root file system. 495b2d5e4fSEdward Tomasz NapieralaThe logic for this is in 505b2d5e4fSEdward Tomasz Napierala.Fn vfs_mountroot_conf0 . 515b2d5e4fSEdward Tomasz Napierala.It 525b2d5e4fSEdward Tomasz NapieralaThe kernel will first mount 53*1a720cbeSAlexander Ziaee.Xr devfs 4 545b2d5e4fSEdward Tomasz Napieralaas the root file system. 555b2d5e4fSEdward Tomasz Napierala.It 565b2d5e4fSEdward Tomasz NapieralaNext, the kernel will parse the in-memory config file created in step 1 575b2d5e4fSEdward Tomasz Napieralaand try to mount the actual root file system. 585b2d5e4fSEdward Tomasz NapieralaSee 595b2d5e4fSEdward Tomasz Napierala.Sx FILE FORMAT 605b2d5e4fSEdward Tomasz Napieralafor the format of the config file. 615b2d5e4fSEdward Tomasz Napierala.It 625b2d5e4fSEdward Tomasz NapieralaWhen the actual root file system is mounted, 63*1a720cbeSAlexander Ziaee.Xr devfs 4 645b2d5e4fSEdward Tomasz Napieralawill be re-mounted on the 655b2d5e4fSEdward Tomasz Napierala.Pa /dev 665b2d5e4fSEdward Tomasz Napieraladirectory. 675b2d5e4fSEdward Tomasz Napierala.It 685b2d5e4fSEdward Tomasz NapieralaIf a 695b2d5e4fSEdward Tomasz Napierala.Pa /.mount.conf 705b2d5e4fSEdward Tomasz Napieralafile does not exist in the root file system which was 715b2d5e4fSEdward Tomasz Napieralajust mounted, the root mount logic stops here. 725b2d5e4fSEdward Tomasz Napierala.It 735b2d5e4fSEdward Tomasz NapieralaIf a 745b2d5e4fSEdward Tomasz Napierala.Pa /.mount.conf 755b2d5e4fSEdward Tomasz Napieralafile exists in the root file system which was just mounted, 765b2d5e4fSEdward Tomasz Napieralathis file will be parsed, and the kernel will use this new config 775b2d5e4fSEdward Tomasz Napieralafile to try to re-mount the root file system. 785b2d5e4fSEdward Tomasz NapieralaSee 795b2d5e4fSEdward Tomasz Napierala.Sx FILE FORMAT 805b2d5e4fSEdward Tomasz Napieralafor the format of the config file. 815b2d5e4fSEdward Tomasz Napierala.It 825b2d5e4fSEdward Tomasz NapieralaIf the new root file system has a 835b2d5e4fSEdward Tomasz Napierala.Pa /.mount 845b2d5e4fSEdward Tomasz Napieraladirectory, the old root file system will be re-mounted 855b2d5e4fSEdward Tomasz Napieralaon 865b2d5e4fSEdward Tomasz Napierala.Pa /.mount . 875b2d5e4fSEdward Tomasz Napierala.It 885b2d5e4fSEdward Tomasz NapieralaThe root mount logic will go back to step 4. 895b2d5e4fSEdward Tomasz Napierala.El 905b2d5e4fSEdward Tomasz Napierala.Pp 915b2d5e4fSEdward Tomasz NapieralaThe root mount logic is recursive, and step 8 will 925b2d5e4fSEdward Tomasz Napieralabe repeated as long as each new root file system 935b2d5e4fSEdward Tomasz Napieralawhich is mounted has a 945b2d5e4fSEdward Tomasz Napierala.Pa /.mount.conf 955b2d5e4fSEdward Tomasz Napieralafile. 965b2d5e4fSEdward Tomasz Napierala.Sh FILE FORMAT 975b2d5e4fSEdward Tomasz NapieralaThe kernel parses each line in 985b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 995b2d5e4fSEdward Tomasz Napieralaand then tries to perform the action specified on that line as soon as it is parsed. 1005b2d5e4fSEdward Tomasz Napierala.Bl -tag -width "XXXXXXXXXX" 1015b2d5e4fSEdward Tomasz Napierala.It Ic # 1025b2d5e4fSEdward Tomasz NapieralaA line beginning with a # is a comment and is ignored. 1035b2d5e4fSEdward Tomasz Napierala.It Ic {FS}:{MOUNTPOINT} {OPTIONS} 1045b2d5e4fSEdward Tomasz NapieralaThe kernel will try to mount this in an 1055b2d5e4fSEdward Tomasz Napieralaoperation equivalent to: 1065b2d5e4fSEdward Tomasz Napierala.Bd -literal -offset indent 1075b2d5e4fSEdward Tomasz Napieralamount -t {FS} -o {OPTIONS} {MOUNTPOINT} / 1085b2d5e4fSEdward Tomasz Napierala.Ed 1095b2d5e4fSEdward Tomasz Napierala.Pp 1105b2d5e4fSEdward Tomasz NapieralaIf this is successfully mounted, 1115b2d5e4fSEdward Tomasz Napieralafurther lines in 1125b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 1135b2d5e4fSEdward Tomasz Napieralaare ignored. 1145b2d5e4fSEdward Tomasz NapieralaIf all lines in 1155b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 1165b2d5e4fSEdward Tomasz Napieralahave been processed and no root file system has been successfully 1175b2d5e4fSEdward Tomasz Napieralamounted, then the action specified by 1185b2d5e4fSEdward Tomasz Napierala.Ic .onfail 1195b2d5e4fSEdward Tomasz Napieralais performed. 1205b2d5e4fSEdward Tomasz Napierala.It Ic .ask 1215b2d5e4fSEdward Tomasz NapieralaWhen the kernel processes this line, a 1225b2d5e4fSEdward Tomasz Napierala.Li mountroot> 1235b2d5e4fSEdward Tomasz Napieralacommand-line prompt is displayed. 1245be4c726SGordon BerglingAt this prompt, the operator can enter the root mount. 1255b2d5e4fSEdward Tomasz Napierala.It Ic .md Ar file 1265b2d5e4fSEdward Tomasz NapieralaCreate a memory backed 1275b2d5e4fSEdward Tomasz Napierala.Xr md 4 1285b2d5e4fSEdward Tomasz Napieralavirtual disk, using 1295b2d5e4fSEdward Tomasz Napierala.Ar file 1305b2d5e4fSEdward Tomasz Napieralaas the backing store. 1315b2d5e4fSEdward Tomasz Napierala.It Ic .onfail Ar [panic|reboot|retry|continue] 1325b2d5e4fSEdward Tomasz NapieralaIf after parsing all the lines in 1335b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 1345b2d5e4fSEdward Tomasz Napieralathe kernel is unable to mount a root file system, 1355b2d5e4fSEdward Tomasz Napieralathe 1365b2d5e4fSEdward Tomasz Napierala.Ic .onfail 1375b2d5e4fSEdward Tomasz Napieraladirective tells the kernel what action to perform. 1385b2d5e4fSEdward Tomasz Napierala.It Ic .timeout Ar N 1395b2d5e4fSEdward Tomasz NapieralaBefore trying to mount a root file system, 1405b2d5e4fSEdward Tomasz Napieralaif the root mount device does not exist, wait at most 1415b2d5e4fSEdward Tomasz Napierala.Ar N 1425b2d5e4fSEdward Tomasz Napieralaseconds for the device to appear before trying to mount it. 1435b2d5e4fSEdward Tomasz NapieralaIf 1445b2d5e4fSEdward Tomasz Napierala.Ic .timeout 1455b2d5e4fSEdward Tomasz Napieralais not specified, the default timeout is 3 seconds. 1465b2d5e4fSEdward Tomasz Napierala.El 1475b2d5e4fSEdward Tomasz Napierala.Sh EXAMPLES 1485b2d5e4fSEdward Tomasz NapieralaThe following example 1495b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 1505b2d5e4fSEdward Tomasz Napieralawill direct the kernel to try mounting the root file system 1515b2d5e4fSEdward Tomasz Napieralafirst as an ISO CD9660 file system on 1525b2d5e4fSEdward Tomasz Napierala.Pa /dev/cd0 , 1535b2d5e4fSEdward Tomasz Napieralathen if that does not work, as an ISO CD9660 file system on 1545b2d5e4fSEdward Tomasz Napierala.Pa /dev/cd1 , 1555b2d5e4fSEdward Tomasz Napieralaand then if that does not work, as a UFS file system on 1565b2d5e4fSEdward Tomasz Napierala.Pa /dev/ada0s1a . 1575b2d5e4fSEdward Tomasz NapieralaIf that does not work, a 1585b2d5e4fSEdward Tomasz Napierala.Li mountroot> 1595b2d5e4fSEdward Tomasz Napieralacommand-line prompt will be displayed where the operator 1605b2d5e4fSEdward Tomasz Napieralacan manually enter the root file system to mount. 1615b2d5e4fSEdward Tomasz NapieralaFinally if that does not work, the kernel will panic. 1625b2d5e4fSEdward Tomasz Napierala.Bd -literal -offset indent 1635b2d5e4fSEdward Tomasz Napierala.Li .onfail panic 1645b2d5e4fSEdward Tomasz Napierala.Li .timeout 3 1655b2d5e4fSEdward Tomasz Napieralacd9660:/dev/cd0 ro 1665b2d5e4fSEdward Tomasz Napierala.Li .timeout 0 1675b2d5e4fSEdward Tomasz Napieralacd9660:/dev/cd1 ro 1685b2d5e4fSEdward Tomasz Napierala.Li .timeout 3 1695b2d5e4fSEdward Tomasz Napieralaufs:/dev/ada0s1a 1705b2d5e4fSEdward Tomasz Napierala.Li .ask 1715b2d5e4fSEdward Tomasz Napierala.Ed 1725b2d5e4fSEdward Tomasz Napierala.Pp 1735b2d5e4fSEdward Tomasz NapieralaThe following example 1745b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 1755b2d5e4fSEdward Tomasz Napieralawill direct the kernel to create a 1765b2d5e4fSEdward Tomasz Napierala.Xr md 4 1775b2d5e4fSEdward Tomasz Napieralamemory disk attached to the file 1785b2d5e4fSEdward Tomasz Napierala.Pa /data/OS-1.0.iso 1795b2d5e4fSEdward Tomasz Napieralaand then mount the ISO CD9660 file system 1805b2d5e4fSEdward Tomasz Napieralaon the md device which was just created. 1815b2d5e4fSEdward Tomasz NapieralaThe last line is a comment which is ignored. 1825b2d5e4fSEdward Tomasz Napierala.Bd -literal -offset indent 1835b2d5e4fSEdward Tomasz Napierala.Li .timeout 3 1845b2d5e4fSEdward Tomasz Napierala.Li .md /data/OS-1.0.iso 1855b2d5e4fSEdward Tomasz Napierala.Li cd9600:/dev/md# ro 1865b2d5e4fSEdward Tomasz Napierala.Li # Can also use cd9660:/dev/md0 ro 1875b2d5e4fSEdward Tomasz Napierala.Ed 1885b2d5e4fSEdward Tomasz Napierala.Pp 1895b2d5e4fSEdward Tomasz NapieralaThe following example 1905b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 1915b2d5e4fSEdward Tomasz Napieralawill direct the kernel to create a 1925b2d5e4fSEdward Tomasz Napierala.Xr md 4 1935b2d5e4fSEdward Tomasz Napieralamemory disk attached to the file 1945b2d5e4fSEdward Tomasz Napierala.Pa /data/base.ufs.uzip 1955b2d5e4fSEdward Tomasz Napieralaand then mount the UFS file system 1965b2d5e4fSEdward Tomasz Napieralaon the md uzip device which was just created 1975b2d5e4fSEdward Tomasz Napieralaby the 1985b2d5e4fSEdward Tomasz Napierala.Xr geom_uzip 4 1995b2d5e4fSEdward Tomasz Napieraladriver. 2005b2d5e4fSEdward Tomasz Napierala.Bd -literal -offset indent 2015b2d5e4fSEdward Tomasz Napierala.Li .md /data/base.ufs.uzip 2025b2d5e4fSEdward Tomasz Napierala.Li ufs:/dev/md#.uzip ro 2035b2d5e4fSEdward Tomasz Napierala.Li # Can also use ufs:/dev/md0.uzip ro 2045b2d5e4fSEdward Tomasz Napierala.Ed 2055b2d5e4fSEdward Tomasz Napierala.Pp 2065b2d5e4fSEdward Tomasz NapieralaThe following example 2075b2d5e4fSEdward Tomasz Napierala.Pa .mount.conf 2085b2d5e4fSEdward Tomasz Napieralawill direct the kernel to do a unionfs 2095b2d5e4fSEdward Tomasz Napieralamount on a directory 2105b2d5e4fSEdward Tomasz Napierala.Pa /jail/freebsd-8-stable 2115b2d5e4fSEdward Tomasz Napieralawhich has a 2125b2d5e4fSEdward Tomasz Napierala.Xr chroot 2 2135b2d5e4fSEdward Tomasz Napieralaenvironment. 2145b2d5e4fSEdward Tomasz Napierala.Bd -literal -offset indent 2155b2d5e4fSEdward Tomasz Napierala.Li .timeout 3 2165b2d5e4fSEdward Tomasz Napierala.Li unionfs:/jail/freebsd-8-stable 2175b2d5e4fSEdward Tomasz Napierala.Ed 2185b2d5e4fSEdward Tomasz Napierala.Sh NOTES 2195b2d5e4fSEdward Tomasz NapieralaFor each root file system which is mounted, a 2205b2d5e4fSEdward Tomasz Napierala.Pa /dev 2215b2d5e4fSEdward Tomasz Napieraladirectory 2225b2d5e4fSEdward Tomasz Napierala.Em must 2235b2d5e4fSEdward Tomasz Napieralaexist so that the root mount logic can properly re-mount 224*1a720cbeSAlexander Ziaee.Xr devfs 4 . 2255b2d5e4fSEdward Tomasz NapieralaIf this directory does not exist, the system 2265b2d5e4fSEdward Tomasz Napieralamay hang during the bootup process. 2275b2d5e4fSEdward Tomasz Napierala.Sh SEE ALSO 2285b2d5e4fSEdward Tomasz Napierala.Xr nmount 2 , 2295b2d5e4fSEdward Tomasz Napierala.Xr md 4 , 2305b2d5e4fSEdward Tomasz Napierala.Xr boot.config 5 , 2315b2d5e4fSEdward Tomasz Napierala.Xr fstab 5 , 2325b2d5e4fSEdward Tomasz Napierala.Xr boot 8 , 2335b2d5e4fSEdward Tomasz Napierala.Xr loader 8 , 2345b2d5e4fSEdward Tomasz Napierala.Xr mount 8 2355b2d5e4fSEdward Tomasz Napierala.Sh HISTORY 2365b2d5e4fSEdward Tomasz NapieralaThe 2375b2d5e4fSEdward Tomasz Napierala.Nm 2385b2d5e4fSEdward Tomasz Napieralafile first appeared in 2395b2d5e4fSEdward Tomasz Napierala.Fx 9.0 . 2405b2d5e4fSEdward Tomasz Napierala.Sh AUTHORS 2415b2d5e4fSEdward Tomasz Napierala.An -nosplit 2425b2d5e4fSEdward Tomasz NapieralaThe root mount logic in the 2435b2d5e4fSEdward Tomasz Napierala.Fx 2445b2d5e4fSEdward Tomasz Napieralakernel which parses 2455b2d5e4fSEdward Tomasz Napierala.Pa /.mount.conf 2465b2d5e4fSEdward Tomasz Napieralawas written by 2475b2d5e4fSEdward Tomasz Napierala.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org . 2485b2d5e4fSEdward Tomasz NapieralaThis man page was written by 2495b2d5e4fSEdward Tomasz Napierala.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org . 250