User Tools

Site Tools


Fstab Configuration

The Fstab, or file systems table, is a central configuration that defines how file systems (usually on block devices) should be mounted if requested (such as on booting the device or connecting it physically). This way, you don’t have to manually mount your devices when you want to access them. The mounting configuration can consist of static file systems but also swap partitions.
The fstab UCI subsystem is where all the options for all devices and file systems to be mounted are defined, the actual file is located at /etc/config/fstab.
By default this subsystem and its configuration file do not exist, as for the average LEDE usecase (network devices) it's not needed.
So if you need to configure this, you must first create it.

Since the tool dealing with mounts in LEDE is block, all current options can be found in its source code.

Creating fstab

You should use the block utility. Install the package block-mount:

root@lede:~# opkg update && opkg install block-mount

Call block detect to get a sample fstab UCI subsystem configuration file.

root@lede:~# block detect > /etc/config/fstab

Now there is a UCI subsystem, you can use UCI command line to change it or just edit the file itself.

It is possible to set / on other devices, but the process is a bit more involved, see HOWTO extroot for details.
Also see this guide: OpenWrt techref for technical details of the mounting process and scripts involved.

Enable fstab at Boot

To enable the usage of this new UCI subsystem, so that mount points are correctly mounted at boot, write

root@lede:~# service fstab enable


The configuration file consists of a global section defining defaults, mount sections defining file systems to be mounted and swap sections defining partitions to be activated. Whenever you change your fstab configuration, run this command to mount everything in the new way:

root@lede:~# block umount && block mount

The Global section

Name Type RequiredDefaultDescription
anon_swap booleanno 0 mount swap devices that don’t have their own config section
anon_mountbooleanno 0 mount block devices that don’t have their own config section
auto_swap booleanno 1 automatically mount swap devices when they appear
auto_mountbooleanno 1 automatically mount block devices when they appear
delay_rootintegerno 0 wait X seconds before trying to mount root devices on boot
check_fs booleanno 0 run e2fsck on device prior to a mount

The Swap sections

Name Type RequiredDefaultDescription
devicestringno - The swap partition’s device node (e.g. sda1)
uuid stringno - The swap partition’s UUID
label stringno - The swap partition’s label (e.g. mkswap -L label /dev/sdb2)

The Mount sections

Name Type RequiredDefaultDescription
devicestringno - The data partition’s device node (e.g. sda1)
uuid stringno - The data partition’s UUID
targetstringno - The data partition’s mount point. Some values have special meanings, see the Extroot section below.

The right amount of SWAP

If you ask people or search the net, you will find as a general rule of thumb double RAM for machines with 512MiB of RAM or less than, and same amount as RAM for machines with more. This very rough estimate does apply for your embedded device.
Be aware that access time of swap is absymal if compared to real RAM, so having swap may not help much in your specific case.
A CUPS spooling server will run just fine when only SWAP is available, whereas some applications may perform very poorly when their data it stored on the SWAP rather then being kept in the “real” RAM.
The decision which data is kept in the RAM and which is stored on the SWAP is made by the system. In contrast to other operating systems, Linux makes ample use of memory, so that your system runs smoother and more efficiently. If memory is then needed by an application, the system will unload stuff again, and make memory available.

docs/guide-user/storage/fstab.txt · Last modified: 2018/03/03 20:55 by bobafetthotmail