systemd keeps unmounting a removable drive

I have following line in /etc/fstab:

UUID=E0FD-F7F5 /mnt/zeno vfat noauto,utf8,user,rw,uid=1000,gid=1000,fmask=0113,dmask=0002 0 0

The partition is freshly created by gnome-disks under the respective user, and spans the whole card.

Now: Running mount /mnt/zeno as user (1000) succeeds, but right after that I find out that it’s actually not mounted: following umount /mnt/zeno fails with umount: /mnt/zeno: not mounted. When watching journalctl -f, I can see following messages appear when mounting:

[...] kernel: SELinux: initialized (dev mmcblk0p1, type vfat), uses genfs_contexts
[...] systemd[1]: Unit mnt-zeno.mount is bound to inactive service. Stopping, too.
[...] systemd[1]: Unmounting /mnt/zeno...
[...] systemd[1]: Unmounted /mnt/zeno.

So it seems that systemd indeed keeps unmounting the drive, but I can’t find out why. I don’t remember creating any custom “.mount” files. I tried to find something in /etc/systemd and in my home folder but did not find anything.

So what is this “mnt-zeno.mount” file and how can I review it? And most importantly, how can I mount the drive?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

mnt-zeno.mount was created by systemd-fstab-generator. According to Jonathan de Boyne Pollard’s explanation on debian-user mailing list:

[systemd-fstab-generator is] a program that reads /etc/fstab at boot time
and generates units that translate fstab records to the systemd way of
doing things […..]
The systemd way of doing things is mount and device units, per the
systemd.mount(5) and systemd.device(5) manual pages. In the raw systemd
way of doing things, there’s a device unit named “dev-sde1.device” which
is a base requirement for a mount unit named “media-lumixx2dphotos.mount”.

After altering fstab one should either run systemctl daemon-reload (this makes systemd to reparse /etc/fstab and pick up the changes) or reboot.

Method 2

For people who come here via a google search (like me), the developers have known about this problem for almost 5(!) years as of writing this and still nobody tries to fix it. https://github.com/systemd/systemd/issues/1741

Workaround: Often, restarting the systemd daemon via systemctl daemon-reload solves the problem.

Method 3

systemd: Unmounting /boot

One of the Redhat 7 Linux VM running on Azure platform. recently. i have restored the data from old backup with the help of below mentioned URL Azure KB article.

https://docs.microsoft.com/en-us/azure/backup/backup-azure-restore-files-from-vm

Post restoration activity Azure unmounted the disk automatically from the linux VM.

After that i dont see /boot filesystem on the server and it’s unmounted automatically.

below is the error message starting seeing in the /var/log/messages

Dec 14 15:04:00 rhellinuxdbprodserver systemd: Unmounting /boot...
Dec 14 15:04:00 rhellinuxdbprodserver kernel: XFS (sda1): Unmounting Filesystem
Dec 14 15:04:00 rhellinuxdbprodserver systemd: Unmounted /boot.

To fix the issue i just reparse the “systemctl daemon-reload” post that /boot filesystem mounted properly.

Pre-Artifact

[[email protected] boot]# df -Th | grep -v tmpfs
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda2      xfs        64G   51G   14G  79% /
/dev/sdb1      ext4      111G   17G   89G  16% /mnt/resource
[[email protected] boot]# systemctl daemon-reload
[[email protected] boot]# mount -a

Post-Artifact

[[email protected] boot]# df -Th | grep -v tmpfs
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda2      xfs        64G   51G   14G  79% /
/dev/sdb1      ext4      111G   17G   89G  16% /mnt/resource
/dev/sda1      xfs       497M  203M  294M  41% /boot


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x