How to Set Up a CIFS Mount on a Proxmox VM

Introduction

Mounting a CIFS share on a Proxmox VM can streamline your workflow, ensuring that your shared resources are automatically accessible whenever your VM starts up. In this guide, I’ll walk you through setting up a CIFS mount using the fstab file so that your share mounts on boot.


Step 1: Preparing Your Proxmox VM

First, ensure that your Proxmox VM is up and running and that you have access to it via SSH or the Proxmox console.

Prerequisites

  • CIFS-utils installed on your VM. If not installed, you can install it using the following command:
Bash
sudo apt update
sudo apt install cifs-utils
  • The IP address or hostname of your CIFS server.
  • The credentials (username and password) to access the CIFS share.

Step 2: Creating a Local Mount Point

You’ll need a local directory where the CIFS share will be mounted. Create this directory:

Bash
sudo mkdir -p /mnt/your-local-folder

Replace /mnt/your-local-folder with your desired mount point.


Step 3: Editing the fstab File

To automatically mount the CIFS share on boot, you need to edit the fstab file.

  1. Open the fstab file in your preferred text editor:
Bash
sudo nano /etc/fstab
  1. Add the following line at the end of the file:
Bash
//<server-ip-or-hostname>/<share-name> /mnt/your-local-folder cifs username=<your-username>,password=<your-password>,uid=1000,gid=1000,iocharset=utf8,_netdev 0 0

Replace the placeholders:

  • <server-ip-or-hostname>: The IP or hostname of your CIFS server.
  • <share-name>: The name of the CIFS share.
  • /mnt/your-local-folder: The local mount point you created earlier.
  • <your-username> and <your-password>: Your CIFS credentials.

Note: For added security, consider storing your credentials in a separate credentials file rather than directly in fstab.


Step 4: Mounting the CIFS Share

Once the fstab entry is added, you can manually mount all the filesystems listed in fstab by running:

Bash
sudo mount -a

This command will attempt to mount the CIFS share immediately.


Step 5: Verifying the Mount

Finally, confirm that the CIFS share has been successfully mounted by running:

Bash
df -h

You should see your CIFS share listed among the mounted filesystems. You can also check the mount point directory to see if the share’s contents are accessible:

Bash
ls /mnt/your-local-folder

Conclusion

That’s it! Your CIFS share should now be automatically mounted whenever your VM starts up, making it easier to access shared resources without manual intervention.

If you run into any issues, double-check your fstab entry for errors, and make sure that your CIFS server is reachable from the VM.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *