• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“Failed to start test.mount: Unit is not loaded properly: Invalid argument.” – While mounting a fileystem using systemd

By admin

The Problem

Under /etc/systemd/system the mount unit file was created with name “test.mount”. The mount point directory created is /home/test. Under the mount unit file options in the “Where=” the mount point configured is /home/test. The device where the filesystem will be mounted is /dev/xvdb1 and it was defined under “What=” option. When configuring mount unit file to mount a filesystem, it fails with the following error:

# systemctl start test.mount
Failed to start test.mount: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status test.mount' for details.
# systemctl status test.mount
● test.mount - Test Mount Units
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Where: /home/test
What: /dev/xvdb1

The /var/log/messages file shows the same errors:

Mar 20 15:34:19 [vm_name] systemd: test.mount's Where= setting doesn't match unit name. Refusing.

The Solution

The mount unit under /etc/systemd/system has the incorrect mount unit file name. As per systemd.mount man page:

# man systemd.mount
...
Where=
Takes an absolute path of a directory of the mount point. If the mount point does not exist at the time of mounting, it is created. This string must be reflected in the unit filename. (See above.) This option is mandatory.

Above section in man pages shows – Mount units must be named after the mount point directories they control. Example: the mount point /home/john must be configured in a unit file home-john.mount. Important note the character “/” should change like “-”

Change the name of the mount file unit to correct name from: test.mount to home-test.mount. Test again to mount the mount unit.

# systemctl start home-test.mount
# mount | grep test
/dev/xvdb1 on /home/test type ext4 (rw,relatime,seclabel,data=ordered)

Filed Under: CentOS/RHEL 7, Linux, OEL 7

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to migrate storage (LVM) with pvmove Command
  2. How to Create and Mount Btrfs Snapshots
  3. CentOS / RHEL : How to log all LVM commands
  4. CentOS / RHEL 6,7 : How to use yum history to roll back a yum update
  5. CentOS / RHEL 6 : how to start the services interactively during boot (to disable/abort some services)
  6. How to restrict ssh logins by user and client address on CentOS/RHEL
  7. ‘docker images’ command error – “Permission Denied”
  8. How to extend ASM disk from OS level in CentOS/RHEL
  9. “sudo: /etc/sudoers is world writable” – How to correct the permissions of sudoers file
  10. CentOS / RHEL : How to allow or deny Users to login to VSFTP Server

You May Also Like

Primary Sidebar

Recent Posts

  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • MySQL: Identify what user and thread are holding on to a meta data lock that is preventing other queries from running
  • MySQL: How to kill a Long Running Query using max_execution_time
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary