Add yaml front matter to all asciidoc files
[web.git] / docs / uci_fstab.txt
1 ---
2 ---
3 Fstab Configuration
4 ===================
5
6 include::uci_menu.inc[]
7
8 == Fstab Configuration
9
10 The Fstab, or **f**ile **s**ystems **tab**le, 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 configuration file is where all the options for all devices and file systems to be mounted are defined and is located at **'/etc/config/fstab'**.
11
12 == Initial Configuration
13
14 === Package Installation
15
16 ----
17 opkg update
18 opkg install block-mount
19 ----
20
21 === Creating Initial fstab Automatically
22
23 You can use the 'block' utility. Call 'block detect' to get a sample link:uci.html[UCI] configuration file. You can change this to your liking.
24
25 You can quickly install this standard configuration using:
26
27 ----
28 block detect > /etc/config/fstab
29 ----
30
31 Next, edit your fstab, as per the configuration below:
32
33 ----
34 vi /etc/config/fstab
35 ----
36
37 If the mount target is '/' then it will be used as external root upon boot. See https://wiki.openwrt.org/doc/howto/extroot[HOWTO extroot] for more information. Running 'block info' is also valid to get the uuid of different file systems. Also see this guide: https://wiki.openwrt.org/doc/techref/block_mount[OpenWrt techref] for technical details of the mounting process and scripts involved.
38
39 === Enable fstab at Boot
40
41 To enable use the following command
42 ----
43 /etc/init.d/fstab enable
44 ----
45
46 Whenever you change your configuration, restart this to make it take effect:
47
48 ----
49 block umount
50 block mount
51 ----
52
53
54 == Configuration
55
56 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.
57
58
59 === The Global section
60
61 [cols="4*1,4",options="header"]
62 |====
63 | Name | Type | Required | Default | Description
64 | 'anon_swap' | boolean | no | 0 | mount swap devices that don't have their own config section
65 | 'anon_mount' | boolean | no | 0 | mount block devices that don't have their own config section
66 | 'auto_swap' | boolean | no | 1 | automatically mount swap devices when they appear
67 | 'auto_mount' | boolean | no | 1 | automatically mount block devices when they appear
68 | 'delay_root' | integer | no | 0 | wait X seconds before trying to mount root devices on boot
69 | 'check_fs' | boolean | no | 0 | run e2fsck on device prior to a mount
70 |====
71
72 === The Swap sections
73
74 [cols="4*1,4",options="header"]
75 |====
76 | Name | Type | Required | Default | Description
77 | 'device' | string | no | - | The swap partition's device node (e.g. sda1)
78 | 'uuid' | string | no | - | The swap partition's UUID
79 | 'label' | string | no | - | The swap partition's label (e.g. mkswap -L label /dev/sdb2)
80 |====
81
82 === The Mount sections
83
84 [cols="4*1,4",options="header"]
85 |====
86 | Name | Type | Required | Default | Description
87 | 'device' | string | no | - | The data partition's device node (e.g. sda1)
88 | 'uuid' | string | no | - | The data partition's UUID
89 | 'target' | string | no | - | The data partition's mount point. Some values have special meanings, see the Extroot section below.
90 |====
91
92
93 == The right amount of SWAP
94
95 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. But this very rough estimate does apply for your embedded device! Be aware that there are exactly two differences between RAM and SWAP that matter: the **access time** and the **price**. 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.
96