---
name: "fstab-sync"
section: "8"
platform: "linux"
package: "hal"
version: "0.4.7-3sarge1"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/fstab-sync"
---

# fstab-sync(8)

Update the /etc/fstab file in response to HAL events

## NAME

fstab-sync - Update the **/etc/fstab** file in response to HAL events

## SYNOPSIS

**fstab-sync** \[-cv?\] \[-a\|--add UDI\] \[-r\|--remove UDI\] \[-c\|--clean\]  \[-v\|--verbose\] \[-?\|--help\] \[--usage\]

## DESCRIPTION

This program serves one major purpose: Update the file systems table file **/etc/fstab** and create/remove mount points in **/media** in response to HAL events. This program is usually never run directly from a shell; instead it is invoked as a callout from the **/etc/hal/device.d** directory by the HAL daemon.

Additionally, this program offers an option of removing any trace of its previous actions from the file systems table file. Specifically this happens when invoked by the HAL daemon for the root computer device object which only happens when the HAL daemon is starting up.  Thus, when starting the HAL daemon, the **/etc/fstab** file will be completely sanitized, e.g. all entries previously added by the **fstab-sync** program will be removed. When probing for hardware during the startup of the HAL daemon, the **fstab-sync** program will be invoked several times to add new entries to the **/etc/fstab** file.

All entries added to **/etc/fstab** by **fstab-sync** can be identified by the use of the option **managed** in the options field. This option is a no-op; it is only used to uniquely identify entries added by the **fstab-sync** program.

When the **/etc/fstab** file is written by **fstab-sync,** a comment with a link to this manual page is added to the file.

## CONTROLLING WHAT ENTRIES TO ADD

The **fstab-sync** program relies on properties on the relevant HAL device objects in order to determine if and how an entry to the **/etc/fstab** file should be added. Specifically, entries are added for hal device objects of respectively capability **storage** and **volume** only if appropriate **storage.policy** and **volume.policy** properties are set. Also, the **storage.policy.default** properties on the root computer device object are taken into account. See the HAL specification on **http://freedesktop.org/Software/hal** for more information.

By default, the  **/usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi** file specifies the policy - this file should never be edited by the system administrator as it might get updated by the OS vendor for security updates. Instead, system- or site-specific rules can be put in the **/usr/share/hal/fdi/95userpolicy** directory.

Device information files are processed for every hal device object in the **/usr/share/hal/fdi/** directory in alphabetical order including directories. Hence, files in the **90defaultpolicy** directory are processed before files **95userpolicy** directory,  **95userpolicy/a.fdi** is processed before **95userpolicy/b.fdi** and so on. In addition, directives in specific files are processed in a top-down fashion.

A number of sample policy files for various uses should be available in the  **/usr/share/doc/hal-0.4.7/conf** directory. For example, the policy file **storage-non-fixed.fdi** ensures that only fixed optical and floppy drives gets tagged as mountable which ensures that e.g. hard disk partitions on a fixed disk won't get added to the **/etc/fstab** file. Similarly the **storage-skip-all.fdi** file will ensure no entries are ever added.

## DISABLING FSTAB-SYNC

Automatic updates of the **/etc/fstab** file by the **fstab-sync** program from the HAL daemon can be disabled by changing the **50-fstab-sync.hal** symlink in **/etc/hal/device.d** directory to point to **/bin/false**

## OPTIONS

The following options are supported:

- *--add=UDI*

  Add an entry to the  **/etc/fstab** file by giving a HAL Unique Device Identifier

- *--remove=UDI*

  Remove an entry from fstab by giving a HAL Unique Device Identifier

- *--clean*

  Clean all entries generated by  **fstab-sync** from the  **/etc/fstab** file

- *--verbose*

  Report detailed information about operation progress

- *--usage*

  Display brief usage message

- *--help*

  Show options

## LOCKING

The **fstab-sync** program uses [**flock**(2)](/flock/2.md) for locking the **/etc/fstab** file when adding or removing entries. This happens when the HAL daemon starts up, when there's a media change event or when a storage device is hotplugged.

## SEE ALSO

[**fstab**(5)](/fstab/5.md), **http://freedesktop.org/Software/hal**

## BUGS

One known bug is that the HAL daemon has to be running when cleaning the **/etc/fstab** file.  Please send bug reports to the appropriate distribution bug tracker or the HAL mailing list - see http://freedesktop.org/Software/HalTraces for more information.
