summaryrefslogtreecommitdiffstats
path: root/Documentation/user/automount.rst
blob: 1fdeffc66336077396e9be7508cad5395d974447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
.. _automount:

Automount
=========

barebox supports automatically mounting filesystems when a path is first
accessed. This is handled with the :ref:`command_automount` command. With automounting
it is possible to separate the configuration of a board from actually using
filesystems. The filesystems (and the devices they are on) are only probed
when necessary, so barebox does not lose time probing unused devices.

Typical usage is for accessing the TFTP server. To set up an automount for a
TFTP server, the following is required:

.. code-block:: sh

  mkdir -p /mnt/tftp
  automount /mnt/tftp 'ifup -a && mount -t tftp $global.net.server /mnt/tftp'

This creates an automountpoint on ``/mnt/tftp``. Whenever this directory is accessed,
the command ``ifup eth0 && mount -t tftp $eth0.serverip /mnt/tftp`` is executed.
It will bring up the network device using :ref:`command_ifup` and mount a TFTP filesystem
using :ref:`command_mount`.

Usually the above automount command is executed from an init script in ``/env/init/automount``.
With the above, files on the TFTP server can be accessed without configuration:

.. code-block:: sh

  cp /mnt/tftp/linuximage /image

This automatically detects a USB mass storage device and mounts the first
partition to ``/mnt/fat``:

.. code-block:: sh

  mkdir -p /mnt/fat
  automount -d /mnt/fat 'usb && [ -e /dev/disk0.0 ] && mount /dev/disk0.0 /mnt/fat'

To see a list of currently registered automountpoints use ``automount -l``.