Best Practice: shared scratch disk on Proxmox host

AndyInNYC

New Member
May 26, 2024
11
0
1
I have a machine with Proxmox installed on an NVME and all the VMs (all Ubuntu) are running off that drive.

I'd like to use a 500GB SSD in the same machine as a 'shared scratch disk' accessible by each of the VMs (and the host).

Should I follow 'google's advice' and do something like this:
//server_ip_or_hostname/share_name /mnt/network_share cifs credentials=/home/your_username/.smbcredentials,uid=1000,gid=1000,iocharset=utf8 0 0

in fstab on each machine, or is there a better way for the proxmox hosted VMs?

I'd also like the drive available from a non-proxmox machine on the same network.

Thanks for your answers (and for not laughing).

Andrew
 
I'm having a few problems. I'm starting out simple and then I'll put my security in place.
I mounted the SSD on the host (192.168.40.31) by UUID:

UUID=UUIDUUID-UUID /mnt/SCRATCH ext4 defaults,nofail 0 0
the ownership is server:server and

root@pve:~# ls -ld /mnt/SCRATCH
drwxrwxrwx 6 server server 4096 Sep 18 16:54 /mnt/SCRATCH

I should be allowing read/write access.

I created a SAMBA share on the host with the following:

[SCRATCH]
comment = Root of SCRATCH SSD Drive attached to Proxmox machine
path = /mnt/SCRATCH
available = yes
valid users = server
force user = server
encrypt passwords = true
browseable = yes
security = user
guest ok = no
read only = no
create mask = 0755
directory mask = 0755
writable = yes
write list = server

This works fine to connect and write from Windows using server and its password from Map Network Drive

From a VM (192.168.40.32 - named media) I want to give read/write access, I created a folder /mnt/SCRATCH.

I have an fstab entry that reads:
//192.168.40.31\SCRATCH /mnt/SCRATCH cifs user=server,password=ToughPassword 0 0

I have correct read access, but I can't write.

Curiously, on .32 ownership is 'wrong' on the locally created folder:

server@media:~$ ls -ld /mnt/SCRATCH
drwxr-xr-x 2 root root 0 Sep 19 01:54 /mnt/SCRATCH

If I unmount the folder on .32 (media), comment out the fstab line and reboot, I can change the ownership of /mnt/SCRATCH to server. Once I remount the share on .31 it reverts to root root.

I'm getting 'access' problems from programs trying to write to folders from the VM and I'm pretty sure this is the cause. unless I sudo the command, no users on .32 can write to the mounted folder on .31. If I sudo, they can write.

Any easy fix or pointers to my stupidity? Sorry that everything on both machines is named the same (makes your explanation harder, too).


Andrew
 
Hi @AndyInNYC , I have not had recent experience with Samba. Perhaps someone else will chime in.

One thing is certain - your request is completely unrelated to the topic of this forum "Proxmox VE: Installation and configuration".

You may also reconsider installing Samba service directly on the Hypervisor and instead present the disk to a VM, and then share from there.

Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
I also need to load files to the scratch disk from machines outside Proxmox.
Thats what Samba/CIFS (or NFS) does for you - presents a storage location available for network nodes (NAS - network attached storage).
If you install and configure your CIFS service inside a VM, it should still be available to all machines on your network. Assuming you have your network configured to do so.

I'm also not sure this isn't an installation and configuration issue since the local machine's /mnt/SCRATCH folder's permissions reset themselves
It could be a Linux misconfiguration, a CIFS misconfiguration but certainly not a PVE misconfiguration.

That said, most likely you have a user-mapping issue. My cifs experience is extremely remote at this point, so here is the LLM opinion that makes sense to me.

You need to pass uid and gid (or username) mount options in your fstab entry so that files appear owned by your local server user on the VM.
Example fstab line:
//192.168.40.31/SCRATCH /mnt/SCRATCH cifs username=server,password=ToughPassword,uid=1000,gid=1000,file_mode=0755,dir_mode=0755 0 0

Where:
uid=1000 → replace with the UID of server on the VM (id -u server)
gid=1000 → replace with the GID of server on the VM (id -g server)
file_mode and dir_mode make sure the permissions are consistent

A brief look at man page seems to confirm that the above is likely not a hallucination.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox