Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:user-guide:advanced:fstab_configuration [2018/02/17 16:20] – ↷ Page moved from docs:user-guide:fstab_configuration to docs:user-guide:advanced:fstab_configuration bobafetthotmaildocs:guide-user:storage:fstab [2024/01/05 21:45] (current) – [Creating fstab] exact file reference linus
Line 1: Line 1:
 ====== Fstab Configuration ====== ====== Fstab Configuration ======
- 
 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, 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 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//**.\\ 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.\\+By default this subsystem and its configuration file do not exist, as for the average OpenWrt usecase (network devices) it's not needed.\\
 So if you need to configure this, you must first create it. 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 [[https://git.lede-project.org/?p=project/fstools.git;a=blob;f=block.c;hb=HEAD|source code]].+Since the tool dealing with mounts is **block**, all current options can be found in its [[https://git.openwrt.org/?p=project/fstools.git;a=blob;f=block.c;hb=HEAD|source code]].
  
 +===== Creating fstab =====
 +You should use the //block// utility.
 +Install the package //block-mount//:
  
-==== Creating fstab ==== +<code bash> 
-You should use the //block// utility. Install the package //block-mount//: +opkg update 
-<code>root@lede:~# opkg update && opkg install block-mount+opkg install block-mount
 </code> </code>
-Call //block detect// to get a sample fstab UCI subsystem configuration file.  + 
-<code>root@lede:~# block detect > /etc/config/fstab+If you're dealing with USB storage, install //kmod-usb-storage// as well: 
 +<code bash> 
 +opkg install kmod-usb-storage
 </code> </code>
  
-Now there is a UCI subsystem, you can use UCI command line to change it or just edit the file itself.+Get sample fstab UCI subsystem configuration file. 
  
-It is possible to set ///// on other devices, but the process is a bit more involved, see [[https://wiki.openwrt.org/doc/howto/extroot|HOWTO extroot]] for details.\\  +<code bash> 
-Also see this guide: [[https://wiki.openwrt.org/doc/techref/block_mount|OpenWrt techref]] for technical details of the mounting process and scripts involved.+block detect uci import fstab 
 +</code>
  
-==== Enable fstab at Boot ====+Now there is a UCI subsystem, you can use UCI command line to change it or just edit the file ''/etc/config/fstab'' itself.
  
-To enable the usage of this new UCI subsystemso that mount points are correctly mounted at boot, write +It is possible to set on other devices, but the process is a bit more involvedsee [[docs:guide-user:additional-software:extroot_configuration|Extroot configuration]] for details.\\ 
-<code>root@lede:~# service fstab enable +Also see [[docs:techref:block_mount|Mounting Block Devices]] for technical details of the mounting process and scripts involved.
-</code>+
  
 ===== Configuration ===== ===== Configuration =====
- 
 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. 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: Whenever you change your fstab configuration, run this command to mount everything in the new way:
-<code>root@lede:~# block umount && block mount+ 
 +<code bash> 
 +block umount 
 +block mount
 </code> </code>
  
 ==== The Global section ==== ==== The Global section ====
- 
 ^Name          ^Type   ^Required^Default^Description                                                 ^ ^Name          ^Type   ^Required^Default^Description                                                 ^
 |//anon_swap// |boolean|no      |0      |mount swap devices that don’t have their own config section | |//anon_swap// |boolean|no      |0      |mount swap devices that don’t have their own config section |
Line 46: Line 51:
  
 ==== The Swap sections ==== ==== The Swap sections ====
- +^ Name          ^ Type     ^ Required  ^ Default  ^ Description                                                  ^ 
-^Name      ^Type  ^Required^Default^Description                                                +| //enabled//   | boolean  | no        | 1        | Enables/disables using UCI section                           | 
-|//device//|string|no      |-      |The swap partition’s device node (e.g. sda1)               +| //device//    | string   | no        | -        | The swap partition’s device node (e.g. sda1)                 
-|//uuid//  |string|no      |-      |The swap partition’s UUID                                  +| //uuid//      | string   | no        | -        | The swap partition’s UUID                                    
-|//label// |string|no      |-      |The swap partition’s label (e.g. mkswap -L label /dev/sdb2)|+| //label//     | string   | no        | -        | The swap partition’s label (e.g. mkswap -L label /dev/sdb2)  | 
 +| //priority//  | integer  | no        | -1       | The swap partition’s priority                                |
  
 ==== The Mount sections ==== ==== The Mount sections ====
 +^Name       ^Type   ^Required ^Default^Description                                                                                        ^
 +|//enabled//|boolean|no       |1      |Enables/disables using UCI section                                                                 |
 +|//uuid//   |string |yes (one)|-      |The data partition’s file system UUID (not GPT partition UUIDs, aka PARTUUID)                      |
 +|//label//  |string |:::      |-      |The data partition’s label                                                                         |
 +|//device// |string |:::      |-      |The data partition’s device node (e.g. sda1)                                                       |
 +|//autofs// |boolean|no       |0      |Should autofs (on-demand mounting) be used                                                         |
 +|//target// |string |no       |-      |The data partition’s mount point. Some values have special meanings, see the Extroot section below.|
 +|//options//|string |no       |-      |The data partition's mount options, e.g. noexec,noatime,nodiratim.                                 |
  
-^Name      ^Type  ^Required^Default^Description                                                                                        ^ +<WRAP important> 
-|//device//|string|no      |-      |The data partition’s device node (e.gsda1)                                                       | +Managing //autofs// as well as mount notifications (for procd triggers) is taken care of by ''blockd''Hence ''blockd'' needs to be installed for those features to work
-|//uuid//  |string|no      |-      |The data partition’s UUID                                                                          | +</WRAP>
-|//target//|string|no      |-      |The data partition’s mount point. Some values have special meanings, see the Extroot section below.|+
  
 ===== The right amount of SWAP ===== ===== 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.\\  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.\\  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.\\ 
  • Last modified: 2024/01/05 21:45
  • by linus