[Fix] Failed to mount /mnt/share
Solution
Our fix to the problem is to remove /mnt/share
entirely and mount something else in its place.
This is the portion of the startup process which showed the error:
[FAILED] Failed to mount /mnt/share.
See 'systemctl status mnt-share.mount' for details
By the way, this post is for those who followed my last tutorial on using Samba service to mount a shared directory on ArchLinux VM.
Check mount unit status
We’ll start by following the instruction to check the status of the mount unit by running the suggested command:
1 | systemctl status mnt-share.mount |
This will give us more information about the specific error that occurred.
Warning: The unit file, source configuration file or drop-ins of mnt-share.moun>
x mnt-share.mount - /mnt/share
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Thu 2023-04-27 02:45:46 UTC; 40mi>
Where: /mnt/share
What: //localhost/share
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
CPU: 28ms
Apr 27 02:45:46 alarm systemd[1]: Mounting /mnt/share...
Apr 27 02:45:46 alarm mount[379]: mount error(111): could not connect to ::1mou>
Apr 27 02:45:46 alarm systemd[1]: mnt-share.mount: Mount process exited, code=e>
Apr 27 02:45:46 alarm systemd[1]: mnt-share.mount: Failed with result 'exit-cod>
Apr 27 02:45:46 alarm systemd[1]: Failed to mount /mnt/share.
Side Content
Check file system properties
Since we’ve decided to remove the mount /mnt/share
instead of trying to fix it, we shall proceed to learn a little about how to mount a disk. For instance, if we want to mount an NTFS file system and ensure that the file system is accessible and error-free, we can use the following command to check it for errors:
1 | sudo pacman -S ntfs-3g |
If the virtual hard disk has multiple partitions, we’ll need to determine which partition contains the NTFS file system we want to mount. Oftentimes we use the lsblk
command to list the available storage devices and their partitions, and the blkid
command to list the UUIDs of the partitions.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 1024M 0 rom
vda 253:0 0 9.8G 0 disk
|-vda1 253:1 0 200M 0 part /boot
`-vda2 253:2 0 9.6G 0 part /
In my case, the virtual machine has a single virtual hard disk, which is identified as /dev/vda
. This virtual hard disk has two partitions, /dev/vda1
and /dev/vda2
, which are mounted at /boot
and /
, respectively.
/dev/vda1
is a 200MB partition formatted as a Linux file system such as ext4
or xfs
, and contains the kernel and other boot files.
/dev/vda2
is a 9.6GB partition also formatted as a Linux file system, and contains the root file system for the Arch Linux operating system.
Mount NTFS file system
If we want to mount an additional NTFS file system on our virtual machine, we can create a new directory to use as the mount point, such as /mnt/ntfs
, and then add an entry to the /etc/fstab
file to mount the NTFS file system at that mount point.
For example, if the NTFS file system is located on /dev/vda3
, we can add the following line to the /etc/fstab
file:
1 | /dev/vda3 /mnt/ntfs ntfs-3g defaults 0 0 |
Or if you’ve run blkid
and looked up the UUID of the file system you wanted to mount, you can also swap the line above for the following one:
1 | UUID=12345678-1234-1234-1234-1234567890ab /mnt/ntfs ntfs-3g defaults 0 0 |
After adding the entry to the /etc/fstab
file, we need to run sudo mount -a
. This should mount the NTFS file system at the specified mount point, and the mount point should be automatically mounted at boot time.
Remove Samba entries
Edit Samba’s configuration file /etc/samba/smb.conf
and remove everything in the [mnt]
field.
Then, navigate to /etc/fstab
and comment out anything associated with /mnt/share
:
# share /mnt/share 9p trans=virtio,nofail 0 0
# //localhost/share /mnt/share cifs user=mccranky,password=Rogue12 0 0
Since we’ve already removed Samba service on our machine, we have no need of checking whether if the mount options specified in the mount unit are correct. But if you haven’t removed it yet, feel free to edit the mount unit file located at /etc/systemd/system/mnt-share.mount
and modify the mount options.
Remove the mount unit for /mnt/share
:
1 | sudo rm /etc/systemd/system/mnt-share.mount |
Reload the systemd daemon to ensure that the changes take effect:
1 | sudo systemctl daemon-reload |
When we check the status of mnt-share.mount
, we should get:
$ sudo systemctl status mnt-share.mount
x mnt-share.mount
Loaded: not-found (Reason: Unit mnt-share.mount not found.)
Active: failed (Result: exit-code) since Thu 2023-04-27 02:45:46 UTC; 1h 5>
CPU: 28ms
Apr 27 02:45:46 alarm systemd[1]: Mounting /mnt/share...
Apr 27 02:45:46 alarm mount[379]: mount error(111): could not connect to ::1mou>
Apr 27 02:45:46 alarm systemd[1]: mnt-share.mount: Mount process exited, code=e>
Apr 27 02:45:46 alarm systemd[1]: mnt-share.mount: Failed with result 'exit-cod>
Apr 27 02:45:46 alarm systemd[1]: Failed to mount /mnt/share.
Last we can finally run sudo rm -r /mnt/share
to remove /mnt/share
from our machine.
Perfect! Now when we reboot
again we should receive no errors.