How can mount work with an empty fstab?

From the Arch Linux installation guide:

The /etc/fstab file contains static filesystem information. It defines how storage devices and partitions are to be mounted and integrated into the overall system. It is read by the mount command to determine which options to use when mounting a specific device or partition.

This is why we need to generate that file as a step of the installation process.

So how is it possible for mount to mount the root partition in /mnt at the very beginning of the installation process, if fstab at that point is still empty, since at that point it hasn't been generated yet?


/etc/fstab defines the default configuration.  It lists default filesystem/mount point/option combinations.  When you mount a filesystem, if you don’t specify complete parameters and options, mount will read the options from your fstab.  For example, you can type

mount /dev/sda1

and mount will know where to put it, and you can type

mount /mnt/sda1

and mount will know where to find it.  But if you want to be peculiar, you can type

mount /dev/sda1 /mnt/sdq17

and mount will do that.  Similarly, you can specify on the command line that a filesystem should be mounted read-only.  Conversely, you can specify in /etc/fstab that a filesystem should be mounted read-only by default, and then override that on the command line.  And you can manually mount filesystems that aren’t in /etc/fstab at all.

Also, /etc/fstab identifies which filesystems are automatically mounted at boot time; they are mounted with their specified default options.

But also, just as you can type mount /dev/sda1 /mnt/sda1, a program can execute mount with a complete argument list, and then (in principle) mount doesn’t need to access /etc/fstab at all.  And the operating system automagically knows where its root partition is, and automatically mounts the root filesystem very early in the boot process.  In fact, if the OS needed /etc/fstab to be accessible before it could do mounts, we’d have a chicken-and-egg problem, since /etc isn’t accessible until the root filesystem has been mounted.  The root partition is included in /etc/fstab for the other reason that /etc/fstab exists — to give fsck a list of things to check.