Synology NAS hard drives often fail to mount in Ubuntu due to mismatched file system drivers, incorrect SMB/CIFS credentials, or network configuration errors. This guide resolves these issues by verifying network connectivity, installing necessary kernel modules like
cifs-utils, and configuring the
/etc/fstab file with the correct authentication parameters for seamless integration.
Verifying Network Connectivity and Discovery
Before attempting to mount the drive, you must ensure that your Ubuntu machine can communicate with the Synology NAS over the network. A common cause of mounting failures is simply a broken connection or the NAS being unreachable. Start by pinging the NAS IP address from your terminal. Open a terminal window and type:
ping -c 4 [NAS_IP_ADDRESS]
If the ping fails, check your physical Ethernet connections or Wi-Fi settings. Ensure that both devices are on the same subnet. If they are on different subnets, verify that your router’s routing table allows traffic between them. Once connectivity is confirmed, use the
nmap tool to scan for open ports, specifically port 445 for SMB and port 873 for NFS, depending on your preferred protocol. This step confirms that the NAS services are actively listening and accessible from your client machine.
Installing Required File System Utilities
Ubuntu does not always include the necessary utilities for mounting Windows or Synology shared folders out of the box. The most common protocol used by Synology NAS devices for file sharing is SMB/CIFS. To support this, you need to install the
cifs-utils package. Run the following command to update your package list and install the required tools:
sudo apt update
sudo apt install cifs-utils
For users preferring the NFS protocol, which is often more efficient for Linux-to-Linux communication, ensure that the
nfs-common package is installed as well:
sudo apt install nfs-common
Without these packages, the
mount command will return errors such as "unknown filesystem type 'cifs'" or "unknown filesystem type 'nfs'". After installation, verify that the utilities are present by checking their versions. For example, running
smbclient --version should return a version number if the installation was successful.
Configuring Mount Points and Permissions
You need a designated directory in your Ubuntu file system where the NAS drive will be attached. Create a mount point using the
mkdir command. It is best practice to place this in the
/mnt directory for system-wide access or in your home directory for user-specific access.
sudo mkdir -p /mnt/synology_share
Set appropriate permissions so that your user account can read and write to this directory. Using
chown ensures that you do not need to use
sudo every time you interact with the mounted drive. Replace
your_username with your actual Ubuntu username:
sudo chown your_username:your_username /mnt/synology_share
This step is crucial because many applications will fail to write data if the mount point has restrictive root-only permissions. Ensure that the directory exists and is empty before proceeding to the actual mount command.
Manual Mounting and Testing
Before making the mount persistent, test it manually to identify any immediate errors. For SMB shares, use the
mount command with the
cifs file system type. You will need the username and password for a valid user on the Synology NAS.
sudo mount -t cifs //NAS_IP_ADDRESS/ShareName /mnt/synology_share -o username=your_nas_user,password=your_nas_password
If this command executes without error, verify the mount by listing the contents of the directory:
ls -l /mnt/synology_share
If you see the files from your NAS, the connection is working. If you encounter permission denied errors, double-check the credentials and ensure that the user account on the Synology NAS has read/write privileges for the specific shared folder. For NFS, the command is simpler:
sudo mount -t nfs NAS_IP_ADDRESS:/volume1/ShareName /mnt/synology_share
Making the Mount Persistent with fstab
To ensure the drive mounts automatically upon reboot, add an entry to the
/etc/fstab file. Edit this file using a text editor like
nano:
sudo nano /etc/fstab
Add the following line at the end of the file, replacing placeholders with your actual details. For security, it is recommended to store credentials in a separate file rather than plain text within
fstab. Create a file named
.smbcredentials in your home directory containing:
username=your_nas_user
password=your_nas_password
Set secure permissions for this credential file:
chmod 600 ~/.smbcredentials
Then, add this line to
/etc/fstab:
//NAS_IP_ADDRESS/ShareName /mnt/synology_share cifs credentials=/home/your_username/.smbcredentials,uid=your_username,gid=your_username,vers=3.0 0 0
The
vers=3.0 option ensures compatibility with modern SMB protocols. Save the file and test the configuration by running
sudo mount -a. This command attempts to mount all entries in
fstab that are not already mounted, allowing you to catch syntax errors without rebooting.
Diagnosing Common Errors
If the mount still fails, check the system logs for detailed error messages. Use the
dmesg command to view recent kernel ring buffer messages:
dmesg | tail -n 20
Look for lines related to
CIFS or
NFS. Common issues include DNS resolution failures (use IP addresses instead of hostnames), firewall blocking ports, or incorrect share names. If you suspect a firewall issue, ensure that Ubuntu’s UFW or iptables rules allow outbound traffic to ports 445 (SMB) or 2049 (NFS). Additionally, verify that the Synology NAS has the correct shared folder permissions enabled via its web interface.
Frequently Asked Questions
Why does my Synology NAS show up in Nautilus but won't mount?
This usually indicates a network discovery success but a protocol failure during the actual data transfer. Check your firewall settings on both the Ubuntu host and the NAS to ensure ports 445 and 139 are open. Also, verify that the SMB protocol version supported by the NAS matches what Ubuntu is attempting to negotiate.
How can I fix "Permission Denied" errors when writing to the mounted drive?
Ensure that the
uid and
gid options in your
fstab entry match your Ubuntu user's ID and group ID. You can find these by running
id in the terminal. Mismatched IDs cause the OS to treat the mounted files as belonging to another user, preventing write access.
Is NFS faster than SMB for Synology NAS on Ubuntu?
Generally, yes. NFS is native to Unix-like systems and has less overhead than SMB, which was designed for Windows. However, NFS requires more complex permission mapping between the server and client. For simple file transfers, NFS offers better performance and lower CPU usage.
What should I do if the mount disappears after a reboot?
Check if the
/etc/fstab entry is correctly formatted and saved. Verify that the network service starts before the mount attempt by adding the
x-systemd.automount option to the
fstab line. This delays the mount until the network is fully established, preventing early boot failures.
Can I use a hostname instead of an IP address in the mount command?
Yes, but only if DNS resolution is reliable. Using an IP address is more robust because it bypasses potential DNS lookup delays or failures during boot. If you prefer hostnames, ensure that
nss-mdns is installed and configured correctly on Ubuntu for mDNS resolution.