Recording Not Working To NFS

Home » Asterisk Users » Recording Not Working To NFS
Asterisk Users 7 Comments

I have an NFS mount and I am trying to record to it. The mount works fine, I create a directory and it shows on the server, I delete it and it gets deleted at the server, but Asterisk 16-latest is always recording to the local drive, it ignores the NFS mount. Once I unmount the directory, the recordings show up in the drive. Is this by design?

7 thoughts on - Recording Not Working To NFS

  • If unmounting makes your files appear on the NFS mount, then there may be some caching going on, or files not being closed (by Asterisk). Unmounting will force files to close and could make them appear.

    Try restarting Asterisk (with NFS still mounted). Do the files then appear?

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of cio-alves@playerschool.edu Sent: Wednesday, October 13, 2021 1:37 PM
    To: asterisk-users@lists.digium.com Subject: [asterisk-users] recording not working to NFS

    I have an NFS mount and I am trying to record to it. The mount works fine, I create a directory and it shows on the server, I delete it and it gets deleted at the server, but Asterisk 16-latest is always recording to the local drive, it ignores the NFS mount. Once I unmount the directory, the recordings show up in the drive. Is this by design?

  • I did not explain myself well, for this I apologize. The files never appear on the NFS mount, only in the local drive. Restarting Asterisk with the mount on does not fix it. Asterisk simply ignores the mount and writes to the local drive. But the mount is fine, I can create a dir and it appears on the other side, so NFS is fine. Any idea?

  • If Asterisk is writing files into the local directory that is the mount point for a remote NFS connection, then this is not an asterisk problem. It’s a local config/network issue.

    No application should be able to write to the local disk dir used as a mount point . So if that is what’s happening, your NFS mount is not active. Are you using automount?

    You need to dig deeper into NFS mount…it’s not working the way you think it is.

    —–Original Message—–
    From: cio-alves@playerschool.edu [mailto:cio-alves@playerschool.edu]
    Sent: Friday, October 15, 2021 4:18 PM
    To: Asterisk Users Mailing List – Non-Commercial Discussion

    Cc: Telium Technical Support
    Subject: Re: [asterisk-users] recording not working to NFS

    I did not explain myself well, for this I apologize. The files never appear on the NFS mount, only in the local drive. Restarting Asterisk with the mount on does not fix it. Asterisk simply ignores the mount and writes to the local drive. But the mount is fine, I can create a dir and it appears on the other side, so NFS is fine. Any idea?

  • That’s a bit bizarre.  I had first though that this might be a problem if you were to start Asterisk before mounting the share… Asterisk might have opened the message directory when it started, and then doing directory-relative file creation and moves.  But, you say that restarting Asterisk doesn’t change the behavior.

    On your system, are you using containers, or namespaces, or etc.?  You might be accidentally setting up an environment in which the NFS mount isn’t being “seen” by the environment in which Asterisk is running.

    It might also be worth checking if you can manually create files in the shared location when running as the same user-ID/group-ID as Asterisk is configured to use.  You might be seeing some sort of odd permissions-based problem.

  • Just adding my 2c….

    I don’t think permissions which cause one process to see the mounted file system and another to see the directory underneath. I think using automount could cause this but there is still some other factor contributing to the problem.

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Dave Platt Sent: Saturday, October 16, 2021 1:35 PM
    To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] recording not working to NFS

    That’s a bit bizarre. I had first though that this might be a problem if you were to start Asterisk before mounting the share… Asterisk might have opened the message directory when it started, and then doing directory-relative file creation and moves. But, you say that restarting Asterisk doesn’t change the behavior.

    On your system, are you using containers, or namespaces, or etc.? You might be accidentally setting up an environment in which the NFS mount isn’t being “seen” by the environment in which Asterisk is running.

    It might also be worth checking if you can manually create files in the shared location when running as the same user-ID/group-ID as Asterisk is configured to use. You might be seeing some sort of odd permissions-based problem.

  • I did test manually and the NFS mount works fine. I do create a directory and it shows at the server. I am using containers, indeed. How can it be affecting Asterisk that I
    am using LXC containers?

  • I’m by no means an expert in containers, but from reading a few sites on the net and reading between the lines, here’s how I understand it.

    Containers are, fundamentally, a way of isolating an app environment from other things.  With LXC one must apparently explicitly grant the container access to resources such as filesystems.  Apparently, if you expose a filesystem to a container, that exposure applies only to that filesystem – and not to other filesystems mounted within it.

    In order to allow a container access to an NFS resource, one must apparently do several things:

    1. The host mounts the NFS share somewhere (e.g. /mnt/nfs/server5/spool).
    2. The host must create a directory (e.g. /var/mounts/voicemail).
    3. The host must do a loopback mount of the NFS share mount-point onto
    the second directory (e.g. “mount -o loop /mnt/nfs/server5/spool
    /var/mounts/voicemail”)
    4. The host must give the container access to the loopback mount point
    (separately from any other accesses)… in effect treating this as a
    separate disk or filesystem for the container.

    Once that’s done, an app in the container (e.g. Asterisk) can access
    /var/mounts/voicemail and it’ll be accessing the NFS share.

    At least, that’s how I read what I read.  I may be mistaken.  I’d suggest checking the LXC documentation for the details.