The following page makes claims about other software and standards, these are based at .
There is a dedicated tutorial page to explain the concept of mounting, if you need some information on what mounting is in the first place,
goetia allows both mounting drives individually one per service
and mounting by fstab.
A service to run mount -a
is provided for each supported Kernel and named mount-fstab
The source directory is contained in the kernel specific packages:
goetia-linux,
goetia-freebsd,
... .
Symlink the corresponding source directory
if using the /etc/fstab file is desired.
Then, add mount-fstab to the mount bundle.
(See configuration directories)
One still needs to properly write an /etc/fstab file
based on the hardware configuration.
Doing mounting by creating one service for each storage medium to be mounted, as it is highly dependant on the number, setup and type of storage media used. This approach has distinct advantages:
mount
support the -f switch to mount all entrys of /etc/fstab
in parallel, the order of mounting them is undefined.
sdc1 to be mounted at /mnt/temp/subdir
which only exists after sdb1
is mounted at /mnt/temp could randomly fail,
if mount tries to process sdc1
before sdb1.
sdc1
can declare a dependency on sdb1
which allows for all other mounts to be done in parallel,
whilst sdc1 is only mounted after sdb1.
mount -a
is finished.
/etc/fstab makes
it possible to use a simpler implementation of mount
that does not need the code to parse /etc/fstab.
Therefore it is recommended to create one source directory per partition to be mounted. Examples on how to do this follow below.
Once the Kernel starts init,
the root filesystem is already mounted.
This makes sense, since init itself
and the software it uses usually reside there.
The root filesystem is at this point
mounted read-only and needs to be remounted
read-write, to allow making changes.
This is done by the remount-root oneshot.
The source directory is yet again contained in the kernel specific packages:
goetia-linux,
goetia-freebsd,
... .
Symlink it and add it to the mount
bundle.
There are occasions where some initramfs prepares multiple drives. In some cases init as well as other software lives not on the root filesystem. In this case, create a specific remount oneshot for each partition. See the examples below.
mount
Many services that come with goetia
depend on the
bundle
mount.
Make sure this bundle contains the
services that mount the partitions
holding the data related to the service.
This is usually the root partition,
thus, add the service remount-root
to the bundle mount.
To create a service for mounting a partition,
create a
source directory
for a oneshot service
at src/mount/mount-@PART@
in the system configuration directory
with @PART@ being a descriptive name for the partitions purpose.
The dependencies.d directory needs to contain the
mount-dev and mount-proc files,
since those
virtual file systems are used to
mount the partitions.
Dependending on the method used to identify the partition,
mount-sys and udev might be
additional dependencies.
The source directory should look as follows:
mount-@PART@ ├── dependencies.d │ ├── mount-dev │ ├── mount-proc # only on Linux if using the findfs functionallity │ ├── mount-sys # only on Linux if using the findfs functionallity │ └── udev # only on Linux if using the userspace device manager symlink ├── down # see below ├── type # oneshot └── up # see below
You should ony umount in the down script if
you are sure that no programs(apart from those started by services
depending on the mount service) use the partition.
The down script for umounting is always the same:
#!/bin/execlineb -P fdmove -c 2 1 umount /path/to/mountpoint
Now for the up script,
which varys depending on the kernel used.
Choose one of the solutions on identifying the correct
partiton:
In this case a device node, e.g.
/dev/sda1 of a partition is used
to mount said partition.
The up script looks as follows:
#!/bin/execlineb -P fdmove -c 2 1 mount -o defaults /path/to/devicenode # e.g. /dev/sda1 /path/to/mount/point # e.g. /mnt/media
This solution is only possible if either
util-linux
or
busybox
are used as a provider for the system specific tools
(see requirements).
Since only these packages contain the
findfs tool.
The up script looks as follows:
#!/bin/execlineb -P
fdmove -c 2 1
backtick -E NODE { findfs UUID=@UUID@ }
mount
-o defaults
${NODE}
/path/to/mount/point # e.g. /mnt/media
Additionally, mount-sys needs to be added
to the dependencies.d directory.
Userspace device managers
usually create symlinks at
/dev/disk/by-id, /dev/disk/by-label
and some more.
The up script looks as follows:
#!/bin/execlineb -P fdmove -c 2 1 mount -o defaults /dev/disk/by-partuuid/@PARTUUID@ # or /dev/disk/by-uuid/@UUID@ # or /dev/disk/by-... /path/to/mount/point # e.g. /mnt/media
Additionally, the
bundle udev needs to be added
to the dependencies.d directory.
This, using the the symlinks at /dev/disk/by-partuuid,
is the recommended way of mounting, because:
findfs
are required.
/dev/disk/by-partuuid is recommended,
since all partitions reliably have a partition uuid
and
mdevd-conf
has the most reliable support for /dev/disk/by-partuuid.
Similarly to the umount process in the down script,
only the mount point, but not the device node
need to be known for remounting.
Call the source directories
remount-@PART@,
with @PART@ being a descriptive
name for the partition.
Use the following up script:
#!/bin/execlineb -P fdmove -c 2 1 mount -o remount,rw,defaults /path/to/mountpoint
In this case a device node, e.g.
/dev/sda1 of a partition is used
to mount said partition.
The up script looks as follows:
#!/bin/execlineb -P fdmove -c 2 1 mount -o defaults /path/to/devicenode # e.g. /dev/sda1 /path/to/mount/point # e.g. /mnt/media
On FreeBSD id nodes exist at
/dev/diskid and /dev/gptid.
The up script looks as follows:
#!/bin/execlineb -P fdmove -c 2 1 mount -o defaults /dev/diskid/@DISKID@ # or /dev/gptid/@GPTID@ /path/to/mount/point # e.g. /mnt/media
This, using the the symlinks at /dev/diskid,
is the recommended way of mounting,
because it allows reliable identification of the device.
Similarly to the umount process in the down script,
only the mount point, but not the device node
need to be known for remounting.
Call the source directories
remount-@PART@,
with @PART@ being a descriptive
name for the partition.
Use the following up script:
#!/bin/execlineb -P fdmove -c 2 1 mount -uw /path/to/mountpoint