Problem mounting Nas (NFS) with systemd

It’s not my ip, i’m sure of that (my provider assigned me an ip).
If i understand what you said, i must not use a mount point in home folder.
For example, i can use /run/media/marc/download/syno instead?

All my disks are “under” run/media.

[marc@marc-pc ~]$ systemd-escape -p --suffix=mount "//run/media/marc/download/"
run-media-marc-download.mount
[marc@marc-pc ~]$ sudo nano /etc/systemd/system/run-media-marc-download.mount
[sudo] Mot de passe de marc : 
[marc@marc-pc ~]$ sudo systemctl daemon-reload
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value run-media-marc-download.mount
active
mounted
[marc@marc-pc ~]$ sudo systemctl start run-media-marc-download.mount
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value run-media-marc-download.mount
active
mounted
[marc@marc-pc ~]$

The folder /run is a volatile structure that is created when the system starts.

The IP I am referring to - which must be setup when exporting NFS shares - is your client IP - you can verify then check the relevant network interface

ip a

If the IP of your network interface is not matching the export, you will not be allowed to mount.

1 Like

I read in your topic not to use /run so i must change it for the disk i use here; i will seek how to do that.

This is the command:

[marc@marc-pc ~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 4c:cc:6a:0b:71:f8 brd ff:ff:ff:ff:ff:ff
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 68:05:ca:5a:c7:60 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.13/24 brd 192.168.1.255 scope global dynamic noprefixroute enp3s0
       valid_lft 77968sec preferred_lft 77968sec
    inet6 2001:861:5301:4800:e6d7:9e48:35f7:96aa/64 scope global dynamic noprefixroute 
       valid_lft 85951sec preferred_lft 13951sec
    inet6 fe80::bc01:9382:cf8f:f48d/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
[marc@marc-pc ~]$

But only physically connected disks - not network drives.

Have a look at your screenshot.
The exported folder - the one you can then mount - is:
/volume1/Films

1 Like

It’s true but i thought we speak about the mount point which is on an internal disk?

I come back to my qnap nas because it’s the one i want to mount and it’s ok now with this:

[Unit]
Description=Mount NAS Video share using NFS

[Mount]
What=192.168.1.10:/data/
Where=run/media/marc/download
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

sudo nano /etc/systemd/system/run-media-marc-download.mount
sudo systemctl daemon-reload
systemctl show -p ActiveState -p SubState --value run-media-marc-download.mount
sudo systemctl start run-media-marc-download.mount
systemctl show -p ActiveState -p SubState --value run-media-marc-download.mount

And all commands in the console are ok too (as with the syno i test).

At this point I have lost track of what the problem is. :man_shrugging:

Where=run/media/marc/download

is not even a PATH - you are missing the / at the beginning, before “run”

You shouldn’t use /run/media... as a mount point but do as you wish.

1 Like

Ooops, you’re right… :melting_face:

At this point, it seems there is no problem anymore despite my error on the path i’ve just corrected it…
But i still use /run and it’s not recommended.

[marc@marc-pc ~]$ sudo nano /etc/systemd/system/run-media-marc-download.mount
[sudo] Mot de passe de marc : 
[marc@marc-pc ~]$ sudo systemctl daemon-reload
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value run-media-marc-download.mount
active
mounted
[marc@marc-pc ~]$ sudo systemctl start run-media-marc-download.mount
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value run-media-marc-download.mount
active
mounted
[marc@marc-pc ~]$ 

[Unit]
Description=Mount NAS Video share using NFS

[Mount]
What=192.168.1.10:/data/
Where=/run/media/marc/download
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

When i shutdown the pc, i saw a message “failed mount nas” (see systemctl status):

[marc@marc-pc ~]$ systemctl status run-media-marc-download.mount
● run-media-marc-download.mount - Mount NAS Video share using NFS
    Loaded: loaded (/proc/self/mountinfo; disabled; preset: disabled)
    Active: active (mounted) since Sun 2024-12-15 12:27:56 CET; 57s ago
Invocation: 146ea2be55c744da9db3e70e415cc0f8
     Where: /run/media/marc/download
      What: /dev/sdb2
[marc@marc-pc ~]$ 

And i still have to enter the password of the nas in dolphin, i thought, it became unnecessary after mounting the nas…

I confirm, that’s not working

And that is understandable - the folder does not exist as it is removed when you restart your system. The /run tree is recreated on system start.

Please see my comment in a similar topic

Troubleshooting path

  • check your mount unit
    • test the mount unit manually
    • sudo systemctl start <mount-path.mount>
    • when manual start populates the mount path - stop the unit
    • sudo systemctl stop <mount-path.mount>
  • verify your automount unit
    • test the mount unit manually
    • sudo systemctl start <mount-path.automount>
    • list the content of the mount path
    • ls </mount/path>
    • when the mount path is populated you can enable the automount unit
    • sudo systemctl enable --now <mount-path.automount>
1 Like

Ok, last (i hope) question: i have 4 HDD in my pc and there are all under run/media. How can i change 1 of them to use another path?

Don’t use /run/media at all. :man_shrugging:

Create dedicated directories, like this, for example:

sudo mkdir /MyNAS
sudo mkdir /MyNAS/first_HDD
sudo mkdir /MyNAS/second_HDD
sudo mkdir /MyNAS/third_HDD
sudo mkdir /MyNAS/fourth_HDD

and mount each one to one of these directories

1 Like

New error:

[Unit]

Description=Mount NAS Video share using NFS

[Mount]

What=192.168.1.10:/data/

Where=/MyNas/first_HDD

Type=nfs

Options=_netdev,auto

[Install]

WantedBy=multi-user.target

[marc@marc-pc /]$ systemd-escape -p --suffix=mount "/MyNas/first_HDD"
MyNas-first_HDD.mount
[marc@marc-pc /]$ sudo nano /etc/systemd/system/MyNas-first_HDD.mount
[sudo] Mot de passe de marc : 
[marc@marc-pc /]$ sudo systemctl daemon-reload
[marc@marc-pc /]$ systemctl show -p ActiveState -p SubState --value MyNas-first_HDD.mount
inactive
dead
[marc@marc-pc /]$ sudo systemctl start MyNas-first_HDD.mount
Job failed. See "journalctl -xe" for details.
[marc@marc-pc /]$ journalctl -xe
déc. 17 11:18:55 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:18:56 marc-pc localsearch-3[35100]: (localsearch-extractor-3:35100): Tracker-CRITICAL **: 11:18:56.641: Cou>
déc. 17 11:18:56 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:18:57 marc-pc localsearch-3[35105]: (localsearch-extractor-3:35105): Tracker-CRITICAL **: 11:18:57.626: Cou>
déc. 17 11:18:57 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:18:58 marc-pc localsearch-3[35110]: (localsearch-extractor-3:35110): Tracker-CRITICAL **: 11:18:58.608: Cou>
déc. 17 11:18:58 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:18:59 marc-pc localsearch-3[35115]: (localsearch-extractor-3:35115): Tracker-CRITICAL **: 11:18:59.601: Cou>
déc. 17 11:18:59 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:00 marc-pc localsearch-3[35120]: (localsearch-extractor-3:35120): Tracker-CRITICAL **: 11:19:00.588: Cou>
déc. 17 11:19:00 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:01 marc-pc localsearch-3[35125]: (localsearch-extractor-3:35125): Tracker-CRITICAL **: 11:19:01.588: Cou>
déc. 17 11:19:01 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:02 marc-pc localsearch-3[35153]: (localsearch-extractor-3:35153): Tracker-CRITICAL **: 11:19:02.642: Cou>
déc. 17 11:19:02 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:03 marc-pc localsearch-3[35158]: (localsearch-extractor-3:35158): Tracker-CRITICAL **: 11:19:03.593: Cou>
déc. 17 11:19:03 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:04 marc-pc localsearch-3[35163]: (localsearch-extractor-3:35163): Tracker-CRITICAL **: 11:19:04.650: Cou>
déc. 17 11:19:04 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:05 marc-pc localsearch-3[35168]: (localsearch-extractor-3:35168): Tracker-CRITICAL **: 11:19:05.671: Cou>
déc. 17 11:19:05 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:06 marc-pc localsearch-3[35173]: (localsearch-extractor-3:35173): Tracker-CRITICAL **: 11:19:06.584: Cou>
déc. 17 11:19:06 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:07 marc-pc localsearch-3[35179]: (localsearch-extractor-3:35179): Tracker-CRITICAL **: 11:19:07.596: Cou>
déc. 17 11:19:07 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:08 marc-pc localsearch-3[35185]: (localsearch-extractor-3:35185): Tracker-CRITICAL **: 11:19:08.592: Cou>
déc. 17 11:19:08 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:09 marc-pc localsearch-3[35190]: (localsearch-extractor-3:35190): Tracker-CRITICAL **: 11:19:09.585: Cou>
déc. 17 11:19:09 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:10 marc-pc localsearch-3[35195]: (localsearch-extractor-3:35195): Tracker-CRITICAL **: 11:19:10.592: Cou>
déc. 17 11:19:10 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:11 marc-pc localsearch-3[35200]: (localsearch-extractor-3:35200): Tracker-CRITICAL **: 11:19:11.589: Cou>
déc. 17 11:19:11 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:12 marc-pc localsearch-3[35205]: (localsearch-extractor-3:35205): Tracker-CRITICAL **: 11:19:12.591: Cou>
déc. 17 11:19:12 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:13 marc-pc localsearch-3[35210]: (localsearch-extractor-3:35210): Tracker-CRITICAL **: 11:19:13.585: Cou>
déc. 17 11:19:13 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
déc. 17 11:19:14 marc-pc localsearch-3[35215]: (localsearch-extractor-3:35215): Tracker-CRITICAL **: 11:19:14.589: Cou>
déc. 17 11:19:14 marc-pc localsearch-3[8065]: Extractor subprocess died unexpectedly: Le processus fils s’est terminé >
lines 498-536/536 (END)

Try it by hand first.

sudo mount -t nfs 192.168.1.10:/data/ /MyNas/first_HDD

Are you sure? (or: make sure) that you have exported that Path on your NAS:
/data
You need to export the Path - which you then can mount on your machine.
Only what is exported is available to mount.

1 Like

mount.nfs: access denied by server while mounting 192.168.1.10:/data/

There is a high probability that you simply didn’t export that folder.
This has to be done on the NAS through whatever GUI this has got.

1 Like

Please verify in your NAS nfs confguration

  • share path
    • the share path may not be /data but e.g. /volume1/data
  • permissions for your client’s IP address
    • it is possible to use wildcard e.g. 192.168.1.*
    • if using wildcard - it is recommended to use read-only
    • if using wildcard - limit write access to select client IPs

To be able to mount an exported NFS share - your client’s IP address must not change, it needs to be static - otherwise you will get access denied by server.

If you are unable to locate the exported path - I find it hard to believe the info not being available - you may be able to see how it is configured if you ssh into your NAS and print the content of the /etc/exports file

cat /etc/exports
2 Likes

That’s ok!

cat/ etc/exports for fun :wink:

"/share/CACHEDEV3_DATA/2025" *(sec=sys,ro,async,wdelay,insecure,no_subtree_check,no_root_squash,fsid=6df85fabd2d2e22f1c0a11db77c70c54) 
"/share/NFSv=4" *(no_subtree_check,no_root_squash,insecure,fsid=0)
"/share/NFSv=4/2025" *(sec=sys,ro,async,wdelay,insecure,nohide,no_subtree_check,no_root_squash,fsid=695f34686a1ad4d50954d85e39fd87de) 
"/share/CACHEDEV2_DATA/data" *(sec=sys,ro,async,wdelay,insecure,no_subtree_check,no_root_squash,fsid=0cb39b8b317885e5d00391102ed08814) 
"/share/NFSv=4/data" *(sec=sys,ro,async,wdelay,insecure,nohide,no_subtree_check,no_root_squash,fsid=585029da10f92b9451591c81d602a879) 
"/share/CACHEDEV1_DATA/Multimedia" *(sec=sys,ro,async,wdelay,insecure,no_subtree_check,no_root_squash,fsid=33172f1e47c9173a0e9d13ed82b65885) 
"/share/NFSv=4/Multimedia" *(sec=sys,ro,async,wdelay,insecure,nohide,no_subtree_check,no_root_squash,fsid=5cf5da4a710f9ba0617d9972518432f3) 


It works.

Thanks a lot mainly to linux-aarhus and Nachlese (and sorry for the headache) :innocent:

1 Like

Hi,
Last question:

I think i have permission’s problem: i cannot delete or create a file in /MyNAS/2025 and others.
In Nautilus, i have this:

A cross on each folder ans when i make a search (and only when i make a search), the files appeared with a cross too.

I check this from https://forum.manjaro.org/t/root-tip-how-to-use-systemd-to-mount-any-device/1185:

5. Check permissions


If this is a newly formatted device or a reused device - it is wise to check the permissions. If you get issues with the device being mounted read-only - depending on filesystem - it may be due to the permissions stored on the device.

If the device is using a Linux file system you can change permissions when it is mounted. To change the permissions on your games partition mounted at /data/games

sudo chmod ugo+rw /data/games -R

If your device is a shared device dual booting Windows and Linux and formatted using NTFS and it mounts read-only - reboot your system into Windows and disable features like Fastboot, hibernation, sleep and hybrid sleep as these will taint the filesystem and cause Linux to mount it read-only.

So, i did this sudo chmod ugo+rw /MyNAS/Multimedia -R

But files are read only…

What am i doing wrong?

Thanks.