Plex + NAS: When Mounting Goes Wrong
Plex server on one machine. Media on a NAS. Mounted via CIFS/SMB. Simple, right?
I’ve hit two separate issues with this setup. Both were infuriating. Both had surprisingly simple fixes buried in /etc/fstab.
Problem 1: Plex Can’t See Files
The library scan returns zero items. The files exist. I can browse them over SMB. I can ls the mounted directory. But Plex finds nothing.
The Symptom
Scanning Movies...
Found 0 items
The media was there. The paths were correct. Plex just… couldn’t see it.
The Setup
- Plex running in Docker on a Proxmox VM
- Media on Synology NAS
- NAS shares mounted via CIFS to
/mnt/media - Plex container volume:
/mnt/media:/media
Debugging
Step 1: Check the mount on the host
ls -la /mnt/media
drwxr-xr-x 2 root root 4096 Nov 29 10:00 .
drwxr-xr-x 5 root root 4096 Nov 29 10:00 Movies
drwxr-xr-x 5 root root 4096 Nov 29 10:00 TV
Files exist. But owned by root.
Step 2: Check inside the container
docker exec -it plex /bin/bash
ls -la /media
drwxr-xr-x 2 nobody nogroup 4096 Nov 29 10:00 .
drwxr-xr-x 5 nobody nogroup 4096 Nov 29 10:00 Movies
drwxr-xr-x 5 nobody nogroup 4096 Nov 29 10:00 TV
From the container’s perspective: nobody:nogroup. The Plex process runs as a specific user (usually UID 1000). If the files are owned by nobody, and Plex can’t read them, the library stays empty.
The Root Cause
CIFS mounts don’t preserve Unix permissions properly. By default, everything mounts as root:root on the host, which becomes nobody:nogroup inside containers.
Plex needs read access. The files need to be readable by Plex’s UID.
The Fix: Mount Options
Updated /etc/fstab:
//192.168.20.8/Media /mnt/media cifs \
credentials=/etc/samba/credentials,\
uid=1000,\
gid=1000,\
file_mode=0755,\
dir_mode=0755 0 0
Key additions:
uid=1000- Files appear owned by UID 1000gid=1000- Files appear owned by GID 1000file_mode=0755- Files are readable by everyonedir_mode=0755- Directories are traversable
Remount:
umount /mnt/media
mount /mnt/media
Step 3: Fix the container too
Plex container also needs to know which UID to run as. In docker-compose:
services:
plex:
image: linuxserver/plex
environment:
- PUID=1000
- PGID=1000
volumes:
- /mnt/media:/media
The PUID and PGID environment variables tell the LinuxServer container to run the internal Plex process as that user.
Now the mount is UID 1000, and Plex runs as UID 1000. Permissions match.
The Result
Scanning Movies...
Found 847 items
Scanning TV...
Found 156 series
The library populated. Everything worked.
Problem 2: The 1-Second Stutter
Different issue. Different year. Same setup.
Plex was working fine, then Christmas Eve, movie night, and… micro-stuttering. Every second or two, a tiny hitch. Not long enough to fully pause, but enough to ruin the experience.
The Investigation
Checked resource usage: fine. Network latency: fine. Transcoding: not happening (direct play).
Then I looked at the mount options:
mount | grep Content
//192.168.20.8/Content on /mnt/Content type cifs (
rw,relatime,
vers=3.0,
cache=strict,
actimeo=1,
...
)
There it was. actimeo=1.
The attribute cache timeout was set to one second.
What actimeo Does
Every single second, the kernel threw away its cached knowledge of file sizes, timestamps, and directory contents. Every second, it asked the NAS: “Hey, did anything change?”
The NAS replied. The cache refreshed. And during that round-trip? Micro-stutter.
The math:
- Individual cache revalidation: ~0.5ms
- Frequency: Once per second
- Over a minute: 0.5ms × 60 = 30ms of accumulated latency
- Over an hour: 0.5ms × 3600 = 1.8 seconds of jitter
That doesn’t sound like much. But when each revalidation happens mid-frame, the video player hiccups.
The Fix: Relaxing the Cache
Updated /etc/fstab:
//192.168.20.8/Content /mnt/Content cifs \
vers=3.0,\
cache=loose,\
actimeo=30,\
ro,\
noatime,\
hard,\
_netdev
What each change does:
cache=strict → cache=loose
strict validates with the server on every read. Safe for files that might change. Terrible for media files that haven’t changed in months.
loose caches aggressively. Perfect for read-only media directories.
actimeo=1 → actimeo=30
Instead of refreshing the cache every 1 second, now it refreshes every 30 seconds. That’s 30x fewer round-trips to the NAS.
soft → hard
soft mounts can timeout and fail. If the NAS is slow to respond, the mount gives up and returns an error.
hard mounts wait indefinitely. For media streaming, reliability beats speed.
The Result
Hit play. No buffer. No stutter. Smooth.
Why Defaults Are Wrong for Media
Linux CIFS defaults prioritize safety over performance:
| Default | Why It Exists | Why It’s Wrong for Media |
|---|---|---|
cache=strict | Files might change | Movies don’t change |
actimeo=1 | Fresh metadata | Media metadata is static |
soft | Quick failure | Streaming needs reliability |
uid/gid=root | Security | Containers need access |
These defaults make sense for a corporate file server where documents change hourly. For a media library? They’re actively harmful.
The Complete fstab Template
Here’s what works for Plex + NAS:
# For read-only media shares
//nas-ip/Media /mnt/media cifs \
credentials=/etc/samba/credentials,\
uid=1000,\
gid=1000,\
file_mode=0755,\
dir_mode=0755,\
vers=3.0,\
cache=loose,\
actimeo=30,\
ro,\
noatime,\
hard,\
_netdev 0 0
Troubleshooting Checklist
Plex can’t find files:
- Check file ownership on the host (
ls -la /mnt/media) - Check ownership inside the container (
docker exec -it plex ls -la /media) - Add
uid=andgid=to mount options - Set
PUID/PGIDin container environment
Plex stutters during playback:
- Check
actimeovalue (mount | grep actimeo) - Check
cachesetting (should beloosefor media) - Increase
actimeoto 30 or higher - Use
hardmount for reliability
Both problems at once:
- Fix permissions first (you can’t test stuttering if files are invisible)
- Then tune cache settings
Two problems. Same root cause: bad mount options. Fix the fstab, fix the streaming.