mirror of
https://github.com/armbian/automount.git
synced 2026-01-06 11:42:57 -08:00
227 lines
4.9 KiB
Groff
227 lines
4.9 KiB
Groff
.\" Automatically generated by Pandoc 3.1.3
|
|
.\"
|
|
.\" Define V font for inline verbatim, using C font in formats
|
|
.\" that render this, and otherwise B font.
|
|
.ie "\f[CB]x\f[]"x" \{\
|
|
. ftr V B
|
|
. ftr VI BI
|
|
. ftr VB B
|
|
. ftr VBI BI
|
|
.\}
|
|
.el \{\
|
|
. ftr V CR
|
|
. ftr VI CI
|
|
. ftr VB CB
|
|
. ftr VBI CBI
|
|
.\}
|
|
.TH "AUTOMOUNT" "7" "January 14, 2025" "" ""
|
|
.hy
|
|
.SH NAME
|
|
.PP
|
|
\f[B]automount\f[R] - auto-mount service for systems with no desktop
|
|
.SH DESCRIPTION
|
|
.PP
|
|
\f[B]Auto-mount\f[R] uses \f[V]udisks\f[R] to monitor and respond to
|
|
block-device related events, such as USB or optical drive
|
|
insertion/removal, partition mounting/unmounting, and more.
|
|
.PP
|
|
Out of the box, \f[B]auto-mount\f[R] will automatically mount any block
|
|
device containing a filesystem, when it appears in the system.
|
|
.SH CONFIGURATION
|
|
.PP
|
|
\f[B]Auto-mount\f[R] actions are controlled by config files, which are
|
|
plain-text INI-style files with \f[V].conf\f[R] extension, consisting of
|
|
section names (enclosed in \f[V][]\f[R]) followed by actions to be
|
|
performed.
|
|
.PP
|
|
Config files are located in the \f[V]/etc/automount/\f[R] directory
|
|
(typically) and are parsed in alphabetical order.
|
|
Actions in the most recent config files override the ones in earlier
|
|
files.
|
|
.PP
|
|
Here is an example of the default config file that comes with
|
|
\f[B]auto-mount\f[R]:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
/etc/automount/10-default.conf:
|
|
|
|
[ID_FS_USAGE=filesystem]
|
|
auto-mount = yes
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
And, here is an example of a file overriding the default action for a
|
|
specific drive:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
/etc/automount/20-override.conf:
|
|
|
|
[ID_FS_UUID=E428-616E]
|
|
auto-mount = no
|
|
\f[R]
|
|
.fi
|
|
.SH SECTIONS AND PROPERTIES
|
|
.PP
|
|
Section names consist of one or more space-delimited match conditions,
|
|
which can have one of the following forms:
|
|
.PP
|
|
\f[V]property=value\f[R], \f[V]!property=value\f[R], \f[V]property\f[R]
|
|
or \f[V]!property\f[R]
|
|
.PP
|
|
The first two forms match on equality and inequality respectively, while
|
|
the last two match on the presence or absence of a certain property.
|
|
.PP
|
|
Values in match conditions can contain wild-card characters, such as:
|
|
.PP
|
|
\f[V]*\f[R], \f[V]?\f[R], \f[V][abc]\f[R] or \f[V][!def]\f[R]
|
|
.PP
|
|
Here is an example of a section that will match optical media containing
|
|
a filesystem:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
20-optical.conf:
|
|
|
|
[ID_FS_USAGE=filesystem ID_CDROM]
|
|
on-unmount = /bin/eject ${DEVNAME}
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
and will eject the media once it\[cq]s unmounted.
|
|
.PP
|
|
Another example of a section, which will cause UDF filesystems on
|
|
non-optical drives to be mounted with different options:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
20-vfat.conf:
|
|
|
|
[ID_FS_TYPE=udf !ID_TYPE=cd]
|
|
mount-options = uid=1000,gid=1000
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
You can obtain a list of all properties for a given block device using
|
|
\f[V]udevadm\f[R]:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
user\[at]linux:\[ti]$ udevadm info -q env /dev/sr0
|
|
\f[R]
|
|
.fi
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/host0/target0:0:0/0:0:0:0/block/sr0
|
|
DEVNAME=/dev/sr0
|
|
DEVTYPE=disk
|
|
MAJOR=11
|
|
MINOR=0
|
|
SUBSYSTEM=block
|
|
\&...
|
|
ID_CDROM=1
|
|
ID_BUS=usb
|
|
ID_MODEL=BD-RE_BU40N
|
|
ID_TYPE=cd
|
|
ID_USB_DRIVER=usb-storage
|
|
\&...
|
|
ID_FS_UUID=d042881731342041
|
|
ID_FS_LABEL=FROM_RUSSIA_WITH_LOVE
|
|
ID_FS_TYPE=udf
|
|
ID_FS_USAGE=filesystem
|
|
\&...
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
or:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
user\[at]linux:\[ti]$ udevadm info -q env /dev/sda1
|
|
\f[R]
|
|
.fi
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
DEVPATH=/devices/pci0000:00/0000:00:0d.0/usb2/2-1/2-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1
|
|
DEVNAME=/dev/sda1
|
|
DEVTYPE=partition
|
|
PARTN=1
|
|
MAJOR=8
|
|
MINOR=1
|
|
SUBSYSTEM=block
|
|
\&...
|
|
ID_BUS=usb
|
|
ID_MODEL=STORAGE_DEVICE
|
|
ID_TYPE=disk
|
|
ID_USB_DRIVER=usb-storage
|
|
\&...
|
|
ID_PART_TABLE_UUID=d526b372
|
|
ID_PART_TABLE_TYPE=dos
|
|
ID_FS_LABEL=TEMP
|
|
ID_FS_UUID=E428-616E
|
|
ID_FS_VERSION=FAT32
|
|
\&...
|
|
ID_FS_TYPE=vfat
|
|
ID_FS_USAGE=filesystem
|
|
\&...
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
When a block-device event occurs, \f[B]auto-mount\f[R] extracts actions
|
|
from all sections with matching conditions, with actions in later
|
|
sections overriding the ones in earlier sections.
|
|
.SH ACTIONS
|
|
.PP
|
|
An action can be any of the following:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
auto-mount = yes|no
|
|
mount-options = ...
|
|
mount-as = [user][:group]
|
|
|
|
on-mount = ...
|
|
on-unmount = ...
|
|
on-add = ...
|
|
on-remove = ...
|
|
on-change = ...
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
where \f[V]...\f[R] represents a command to be executed when the action
|
|
is triggered.
|
|
For example:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
50-spin-down.conf:
|
|
|
|
[ID_TYPE=cd]
|
|
# set spin-down time to 20 minutes
|
|
on-add = /sbin/hdparm -S 240 ${DEVNAME}
|
|
\f[R]
|
|
.fi
|
|
.PP
|
|
Commands support basic variable substitution in the form
|
|
\f[V]${VARIABLE}\f[R], where \f[V]VARIABLE\f[R] can be any of the device
|
|
properties.
|
|
.PP
|
|
Additionally, the \f[V]on-mount\f[R] and \f[V]on-unmount\f[R] actions
|
|
can use the \f[V]${MOUNT_POINT}\f[R] property to determine the current
|
|
mount point.
|
|
.PP
|
|
\f[I]Note: The same block device can be mounted at multiple mount
|
|
points, and the \f[VI]on-mount\f[I] and \f[VI]on-unmount\f[I] actions
|
|
will be executed for each mount point.\f[R]
|
|
.PP
|
|
The \f[V]mount-options\f[R] and \f[V]mount-as\f[R] values are only
|
|
applicable when \f[V]auto-mount = yes\f[R].
|
|
.PP
|
|
Share and enjoy.
|
|
.SH AUTHORS
|
|
.PP
|
|
Written by Dimitry Ishenko.
|