Remove docs menu.inc and uci_menu.inc
[web.git] / docs / uci_fstab.txt
1 ---
2 ---
3 Fstab Configuration
4 ===================
5
6 == Fstab Configuration
7
8 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'**.
9
10 == Initial Configuration
11
12 === Package Installation
13
14 ----
15 opkg update
16 opkg install block-mount
17 ----
18
19 === Creating Initial fstab Automatically
20
21 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.
22
23 You can quickly install this standard configuration using:
24
25 ----
26 block detect > /etc/config/fstab
27 ----
28
29 Next, edit your fstab, as per the configuration below:
30
31 ----
32 vi /etc/config/fstab
33 ----
34
35 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.
36
37 === Enable fstab at Boot
38
39 To enable use the following command
40 ----
41 /etc/init.d/fstab enable
42 ----
43
44 Whenever you change your configuration, restart this to make it take effect:
45
46 ----
47 block umount
48 block mount
49 ----
50
51
52 == Configuration
53
54 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.
55
56
57 === The Global section
58
59 [cols="4*1,4",options="header"]
60 |====
61 | Name | Type | Required | Default | Description
62 | 'anon_swap' | boolean | no | 0 | mount swap devices that don't have their own config section
63 | 'anon_mount' | boolean | no | 0 | mount block devices that don't have their own config section
64 | 'auto_swap' | boolean | no | 1 | automatically mount swap devices when they appear
65 | 'auto_mount' | boolean | no | 1 | automatically mount block devices when they appear
66 | 'delay_root' | integer | no | 0 | wait X seconds before trying to mount root devices on boot
67 | 'check_fs' | boolean | no | 0 | run e2fsck on device prior to a mount
68 |====
69
70 === The Swap sections
71
72 [cols="4*1,4",options="header"]
73 |====
74 | Name | Type | Required | Default | Description
75 | 'device' | string | no | - | The swap partition's device node (e.g. sda1)
76 | 'uuid' | string | no | - | The swap partition's UUID
77 | 'label' | string | no | - | The swap partition's label (e.g. mkswap -L label /dev/sdb2)
78 |====
79
80 === The Mount sections
81
82 [cols="4*1,4",options="header"]
83 |====
84 | Name | Type | Required | Default | Description
85 | 'device' | string | no | - | The data partition's device node (e.g. sda1)
86 | 'uuid' | string | no | - | The data partition's UUID
87 | 'target' | string | no | - | The data partition's mount point. Some values have special meanings, see the Extroot section below.
88 |====
89
90
91 == The right amount of SWAP
92
93 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.
94