Fedora coreos NFS mount

Is there any example for FCOS mounting fs from remote NFS server?

I think it can be done from a systemd unit doing something like:

mount -t nfs x.y.z.a:/some_dir /mnt

Has anyone done this? Is there a better/different way to do this?

I don’t think we have documentation for that, but ideally it should be done with a mount unit.

You can find some hints in old/unrelated cloud-config examples like this, but you will need to rework those into a working FCCT config.
If you manage to get the setup working in your environment, we would appreciate having your FCCT fragment recorded in https://github.com/coreos/fedora-coreos-docs.

2 Likes

Here’s some systemd code snippets I used

storage:
  directories:
  - path: /data
    mode: 0700

systemd:
  units:
  - name: data.mount
    enabled: true
    contents: |
     [Unit]
     Description=Mount /data
     Wants=basic.target
     After=basic.target network.target

     [Mount]
     What=<my nfs server>:/data
     Where=/data
     Type=nfs

     [Install]
     WantedBy=docker.service

opened Document: How to mount from remote NFS server · Issue #257 · coreos/fedora-coreos-docs · GitHub

Here is an other exemple for “mount on need” :

systemd: 
  units:
    - name: var-home-user-dev.mount
          contents: |
            [Unit]
            Description= dev directory
            Requires=network-online.target
            After=network-online.target

            [Mount]
            What=host:/dev
            Where=/var/home/user/dev
            Type=nfs4
            Options=_netdev

    - name: var-home-user-dev.automount
      enabled: true
      contents: |
        [Unit]
        Description=Automount dev

        [Automount]
        TimeoutIdleSec=20min
        Where=/var/home/user/dev

        [Install]
        WantedBy=multi-user.target