close
close
mount synolog folder in proxmox to stay afterb reboot

mount synolog folder in proxmox to stay afterb reboot

3 min read 24-01-2025
mount synolog folder in proxmox to stay afterb reboot

This guide explains how to configure a persistent mount of a Synology shared folder within a Proxmox Virtual Environment (Proxmox VE) virtual machine (VM). This ensures your VM always has access to the shared folder, even after reboots. We'll cover several methods, from simple fstab edits to more robust solutions using systemd.

Understanding the Problem: Why Mounts Disappear

When you manually mount a Synology shared folder in your Proxmox VM, that mount is only valid for the current session. A reboot or VM restart will lose the connection. This article provides methods to make the mount persistent.

Method 1: Using /etc/fstab (Simplest Method)

The /etc/fstab file is the most straightforward way to achieve a persistent mount. However, it’s crucial to use the correct syntax and understand the potential risks of incorrect entries.

Steps:

  1. Identify the Synology Share: Determine the IP address or hostname of your Synology NAS and the name of the shared folder you wish to mount. Let's assume your Synology's IP is 192.168.1.100 and the shared folder is named sharedfolder.

  2. Create the Mount Point: Create a directory within your VM where the shared folder will be mounted. For example: sudo mkdir /mnt/synology.

  3. Edit /etc/fstab: Open the /etc/fstab file using a text editor with root privileges: sudo nano /etc/fstab.

  4. Add the Mount Entry: Add a line to the end of the file. The precise line will depend on your Synology's setup (CIFS/SMB or NFS).

    • CIFS/SMB (most common):
    //192.168.1.100/sharedfolder /mnt/synology cifs vers=3.0,credentials=/etc/synology_credentials,iocharset=utf8,file_mode=0660,dir_mode=0770,uid=1000,gid=1000 0 0
    
    • NFS:
    192.168.1.100:/sharedfolder /mnt/synology nfs defaults 0 0
    
  5. Create Credentials File (for CIFS/SMB): Create a file /etc/synology_credentials containing your Synology username and password:

    username=your_synology_username
    password=your_synology_password
    

    Important: Storing passwords directly in /etc/fstab or /etc/synology_credentials is a security risk. Consider using a more secure method if your setup requires high security.

  6. Mount and Verify: Test the mount: sudo mount -a. Check if the shared folder is accessible: cd /mnt/synology.

  7. Reboot and Test Persistence: Reboot your Proxmox VM. After the reboot, verify the shared folder is mounted at /mnt/synology.

Method 2: Using systemd (More Robust Method)

Systemd offers a more robust and manageable way to handle persistent mounts. This method is recommended for better control and error handling.

Steps:

  1. Create a systemd unit file: Create a new file, for example: /etc/systemd/system/synology-mount.service. Add the following content, replacing placeholder values as needed:

    [Unit]
    Description=Mount Synology Share
    After=network-online.target
    
    [Mount]
    What=//192.168.1.100/sharedfolder
    Where=/mnt/synology
    Type=cifs
    Options=vers=3.0,credentials=/etc/synology_credentials,iocharset=utf8,file_mode=0660,dir_mode=0770,uid=1000,gid=1000
    
    [Install]
    WantedBy=multi-user.target
    
  2. Enable and Start the Service:

    sudo systemctl enable synology-mount.service
    sudo systemctl start synology-mount.service
    
  3. Check the Status: Verify the service is running: sudo systemctl status synology-mount.service.

  4. Reboot and Test Persistence: Reboot your Proxmox VM. After the reboot, check if the service is running and the mount is accessible.

Troubleshooting

  • Incorrect Credentials: Double-check your username and password in the credentials file.
  • Network Connectivity: Ensure your Proxmox VM can reach your Synology NAS.
  • Firewall: Make sure your Synology's firewall isn't blocking connections from your VM.
  • Permissions: Verify the user and group ownership of the mount point and the shared folder on Synology.

This guide provides two effective methods for persistently mounting a Synology shared folder within your Proxmox VM. Choose the method that best suits your technical comfort level and security requirements. Remember to always back up your data before making any changes to your system configuration.

Related Posts