Montar volúmenes con unidades .mount y .automount de systemd
Alternativa a /etc/fstab: unidades de montaje bajo demanda, nombres escapados y comprobaciones paso a paso.
Rango C, Básico. Rango C · Básico 6 min de lectura
1. Identificamos el volumen
lsblk -f
blkid
user@debian:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sr0
vda
├─vda1
│
├─vda2
│ ext4 1.0 e30acc4a-4429-474b-b9de-d278cc73e23d 719,7M 17% /boot
└─vda3
│ LVM2_m LVM2 9WhIO1-wXEQ-lYGL-FsZX-3ROC-U98Y-tv76Cz
├─vg0-swap
│ swap 1 d6df43f7-d9fa-4885-bcff-45fcc1b81133 [SWAP]
├─vg0-root
│ ext4 1.0 a37cf808-2734-4b1e-8dfa-c45d75504fdc 1G 80% /
└─vg0-home
ext4 1.0 9cd0111e-e8b4-4c08-9862-2b5ecd872acc 3,2G 2% /home
user@debian:~$ sudo blkid
/dev/mapper/vg0-root: UUID="a37cf808-2734-4b1e-8dfa-c45d75504fdc" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg0-home: UUID="9cd0111e-e8b4-4c08-9862-2b5ecd872acc" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg0-swap: UUID="d6df43f7-d9fa-4885-bcff-45fcc1b81133" TYPE="swap"
/dev/vda2: UUID="e30acc4a-4429-474b-b9de-d278cc73e23d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="8c50fd5d-54e8-41c1-aa45-0563b7498d57"
/dev/vda3: UUID="9WhIO1-wXEQ-lYGL-FsZX-3ROC-U98Y-tv76Cz" TYPE="LVM2_member" PARTUUID="27fafd30-1daf-4bea-be24-4ddf869ab8be"
/dev/vda1: PARTUUID="c6eebc3f-9862-416e-84ae-9d83a0b60a8a"
2. Creamos el punto de montaje
user@debian:~$ sudo mkdir -p /montaje
3. Obtenemos el nombre correcto de las unidades
En systemd, el nombre de la unidad debe corresponder a la ruta del punto de montaje: las / se convierten en - y se elimina la primera. Para /montaje los ficheros serán montaje.mount y montaje.automount. Si el nombre no coincide con la ruta, systemd rechaza la unida.
4. Creamos la unidad .mount
sudo nano /etc/systemd/system/montaje.mount
user@debian:~$ sudo cat /etc/systemd/system/montaje.mount
[Unit]
Description=Volumen de datos en /montaje
[Mount]
What=/dev/disk/by-uuid/9cd0111e-e8b4-4c08-9862-2b5ecd872acc
Where=/montaje
Type=ext4
Options=defaults
5. Creamos la unidad .automount
sudo nano /etc/systemd/system/montaje.automount
user@debian:~$ sudo cat /etc/systemd/system/montaje.automount
[Unit]
Description=Automontaje de /montaje
[Automount]
Where=/montaje
TimeoutIdleSec=60
[Install]
WantedBy=multi-user.target
6. Recargamos systemd
sudo systemctl daemon-reload
7. Habilitamos e iniciar solo el automount
Habilitamos e iniciamos solo el automount
sudo systemctl enable --now montaje.automount
No habilitamos ni iniciamos montaje.mount. Es el automount quien lo activa bajo demanda
user@debian:~$ sudo systemctl enable --now montaje.automount
Created symlink '/etc/systemd/system/multi-user.target.wants/montaje.automount' → '/etc/systemd/system/montaje.automount'.
8. Verificamos el funcionamiento
- El automount está activo (“waiting”) y el mount aún no
systemctl status montaje.automount
systemctl status montaje.mount
sudo systemctl status montaje.automount
user@debian:~$ systemctl status montaje.automount
● montaje.automount - Automontaje de /montaje
Loaded: loaded (/etc/systemd/system/montaje.automount; enabled; preset: enabled)
Active: active (waiting) since Tue 2026-11-10 09:05:37 CET; 1min 31s ago
Invocation: b0191b4495cc4185ba49a738fde35fc7
Triggers: ● montaje.mount
Where: /montaje
user@debian:~$ systemctl status montaje.mount
○ montaje.mount - Volumen de datos en /montaje
Loaded: loaded (/etc/systemd/system/montaje.mount; static)
Active: inactive (dead)
TriggeredBy: ● montaje.automount
Where: /montaje
What: /dev/disk/by-uuid/9cd0111e-e8b4-4c08-9862-2b5ecd872acc
user@debian:~$ sudo systemctl status montaje.automount
● montaje.automount - Automontaje de /montaje
Loaded: loaded (/etc/systemd/system/montaje.automount; enabled; preset: enabled)
Active: active (waiting) since Tue 2026-11-10 09:05:37 CET; 1min 39s ago
Invocation: b0191b4495cc4185ba49a738fde35fc7
Triggers: ● montaje.mount
Where: /montaje
nov 10 09:05:37 debian systemd[1]: Set up automount montaje.automount - Automontaje de /montaje.
sudo findmnt /montaje
user@debian:~$ sudo findmnt /montaje
TARGET SOURCE FSTYPE OPTIONS
/montaje
systemd-1
autofs rw,relatime,fd=72,pgrp=1,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=19
- Provocar actividad: systemd monta el volumen en ese momento
ls /montaje
systemctl status montaje.mount # ahora "active (mounted)"
ls /montaje/
lost+found
sudo systemctl status montaje.mount
user@debian:~$ sudo systemctl status montaje.mount
● montaje.mount - Volumen de datos en /montaje
Loaded: loaded (/etc/systemd/system/montaje.mount; static)
Active: active (mounted) since Tue 2026-11-10 09:10:17 CET; 31s ago
Invocation: 68f7ef6e7e264fe3a142329a05ca9e45
TriggeredBy: ● montaje.automount
Where: /montaje
What: /dev/mapper/vg0-home
Tasks: 0 (limit: 2277)
Memory: 12K (peak: 1.8M)
CPU: 15ms
CGroup: /system.slice/montaje.mount
nov 10 09:10:17 debian systemd[1]: Mounting montaje.mount - Volumen de datos en /montaje...
nov 10 09:10:17 debian systemd[1]: Mounted montaje.mount - Volumen de datos en /montaje.
- Esperar ~1 minuto sin tocar /montaje
sleep 70
systemctl status montaje.mount # "inactive (dead)": desmontado
user@debian:~$ sleep 70
systemctl status montaje.mount # "inactive (dead)": desmontado
user@debian:~$ systemctl status montaje.mount # "inactive (dead)": desmontado
○ montaje.mount - Volumen de datos en /montaje
Loaded: loaded (/etc/systemd/system/montaje.mount; static)
Active: inactive (dead) since Tue 2026-11-10 09:11:38 CET; 1min 18s ago
Duration: 1min 21.012s
Invocation: 68f7ef6e7e264fe3a142329a05ca9e45
TriggeredBy: ● montaje.automount
Where: /montaje
What: /dev/disk/by-uuid/9cd0111e-e8b4-4c08-9862-2b5ecd872acc
Mem peak: 1.8M
CPU: 33ms
Estado de /etc/fstab con systemd
Fichero /etc/fstab
cat /etc/fstab
user@debian:~$ cat /etc/fstab
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/vg0-root / ext4 errors=remount-ro 0 1
# /boot was on /dev/vda2 during installation
UUID=e30acc4a-4429-474b-b9de-d278cc73e23d /boot ext4 defaults 0 2
/dev/mapper/vg0-home /home ext4 defaults 0 2
/dev/mapper/vg0-swap none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
ls -l /run/systemd/generator/
user@debian:~$ ls -l /run/systemd/generator/
total 24
-rw-r--r-- 1 root root 541 nov 10 09:05 boot.mount
-rw-r--r-- 1 root root 231 nov 10 09:05 'dev-mapper-vg0\x2dswap.swap'
-rw-r--r-- 1 root root 369 nov 10 09:05 home.mount
drwxr-xr-x 2 root root 100 nov 10 09:05 local-fs.target.requires
drwxr-xr-x 2 root root 80 nov 10 09:05 local-fs.target.wants
-rw-r--r-- 1 root root 274 nov 10 09:05 media-cdrom0.mount
-rw-r--r-- 1 root root 288 nov 10 09:05 -.mount
drwxr-xr-x 2 root root 60 nov 10 09:05 sockets.target.wants
lrwxrwxrwx 1 root root 37 nov 10 09:05 sshd-unix-local@.service -> /usr/lib/systemd/system/sshd@.service
-rw-r--r-- 1 root root 279 nov 10 09:05 sshd-unix-local.socket
drwxr-xr-x 2 root root 60 nov 10 09:05 swap.target.requires
sudo systemctl status boot.mount
user@debian:~$ sudo systemctl status boot.mount
● boot.mount - /boot
Loaded: loaded (/etc/fstab; generated)
Active: active (mounted) since Tue 2026-11-10 08:48:55 CET; 27min ago
Invocation: d74413d529bd430e924a5922fc86af62
Where: /boot
What: /dev/vda2
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Tasks: 0 (limit: 2277)
Memory: 288K (peak: 1.7M)
CPU: 8ms
CGroup: /system.slice/boot.mount
sudo systemctl cat boot.mount
user@debian:~$ sudo systemctl cat boot.mount
# /run/systemd/generator/boot.mount
# Automatically generated by systemd-fstab-generator
[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
Requires=systemd-fsck@dev-disk-by\x2duuid-e30acc4a\x2d4429\x2d474b\x2db9de\x2dd278cc73e23d.service
After=systemd-fsck@dev-disk-by\x2duuid-e30acc4a\x2d4429\x2d474b\x2db9de\x2dd278cc73e23d.service
After=blockdev@dev-disk-by\x2duuid-e30acc4a\x2d4429\x2d474b\x2db9de\x2dd278cc73e23d.target
[Mount]
What=/dev/disk/by-uuid/e30acc4a-4429-474b-b9de-d278cc73e23d
Where=/boot
Type=ext4
ESCOD
# Automatically generated by systemd-fstab-generator
[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
Requires=systemd-fsck@dev-disk-by\x2duuid-e30acc4a\x2d4429\x2d474b\x2db9de\x2dd278cc73e23d.service
After=systemd-fsck@dev-disk-by\x2duuid-e30acc4a\x2d4429\x2d474b\x2db9de\x2dd278cc73e23d.service
After=blockdev@dev-disk-by\x2duuid-e30acc4a\x2d4429\x2d474b\x2db9de\x2dd278cc73e23d.target
[Mount]
What=/dev/disk/by-uuid/e30acc4a-4429-474b-b9de-d278cc73e23d
Where=/boot
Type=ext4