Configure a datastore via CIFS/SMB
For Proxmox Backup Server v1.0-13
This tutorial is for the Proxmox Backup Server on Debian 10.
Intro
The reason I’m making this article is because from the WebInterface it does not appear to work.
This is because initializing the datastore takes too long.. but it does work.
There is also no way (for now) to select a CIFS location from the webui.
In other words, it takes some work ‘under the hood’ and I’d like to document it for whoever it might help.
1. Requirements
-
Install First, make sure that the installation was smooth.
See if the webinterface is available and it’s all working well. -
CIFS utilities Make sure that the cifs utilities are installed, you need this to mount the CIFS/SMB share.
apt update apt install cifs.utils -y
2. Mount CIFS share
The best way hat I’ve found to do this is via an entry in the /etc/fstab
file.
This entry will contain the type (cifs), path of the share, a local path and then some options so make it work.
One of those options are the credentials for the user you wish to mount the share as.
- Credentials file
I put the credentials in a hidden file that’s only accessible by root, so let’s do this now.
Create file:/root/.backup_sharecreds
username=john.doe password=HorseStaplebattery domain=yourdomain
Here, I named the file
.backup_sharecreds
but you can name it anything you like.
Just make sure you refference the correct file when we add it to the entry in/etc/fstab
. - Create local mount directory
mkdir -p /mnt/cifs/backups
- Finally, add the following to the bottom of
/etc/fstab/
#CIFS Shares //fileserver/sharename /mnt/cifs/backups cifs noperm,vers=3.0,gid=1000,credentials=/root/.backup_sharecreds,iocharset=utf8,sec=ntlmssp,file_mode=0770,dir_mode0770 0 0
Note the
noperm
option, I’ve never used this option before but you need it or you’ll be in permission-agony-city later.
Mount and test the entry withmount -a
or reboot.
3. Initialize the datastore
- Create the datastore
Initialise the datastore with the following command.proxmox-backup-manager datastore create CIFS_REPO /mnt/cifs/backups/ --comment 'Backups directory via cifs'
Here, I used
CIFS_REPO
as a name for the datastore but you can pick whatever you want, same for the comment.
Both will be visible in the webinterface.
It is very normal if this takes a while, get some more coffee or something while you wait.When it’s done, it should appear when you type
proxmox-backup-manager datastore list
or when you look under Repository in the webinterface.
Also, don’t forget to add schedules for GC, verifying backups and all that… - Permissions
-
Create user
We need a user that your Proxmox systems can use to mound the datastore that, idealy, is not the root user. Creating a user is pretty straightforward.
You can just go toConfiguration > Access Control > User Management
and create a new user, name it whatever works for you. -
Permissions
Next, you want to add permissions for that user. To do this, go to
Configuration > Access Control > Permissions
and add the followingPath: /datastore/CIFS_REPO User: the_user_you_just_created Role: DatastoreAdmin Propagate: Yes
-
That should do it on the ProxmoxBackupServer part.
4. Add datastore in Proxmox and start a backup.
We should now be able to mount the datastore as storage for your Proxmox systems.
You can do this via the webinterface of your Proxmox node/datacenter.
When you have Datacenter
selected in the tree view on the left hand side, navigate to Storage
and click Add > Proxmox Backup server
Note: if you do not have this option your version of proxmox may be too old, please update
Then in the popup window, enter the following information.
ID: name eg 'PBS'
Nodes: pick_your_nodes
Server: Hostname or IP of your ProxmoxBackupServer
Enable: check
Username: the username that you created eg backup@pbs
Password: the password of that user
Max Backups: pick a number you want
Datastore: Datastore we created earlier eg CIFS_REPO
Fingerprint: You can find this on the dashboard of your ProxmoxBackupServer webinterface
You may choose to encrypt your backups if you like, make sure to follow the instructions and backup your key!
Click OK
and have fun with your backups.