[SOLVED] Help With Setting Up Storage For Access In LXCs and Networked Machines

astarte

New Member
Mar 19, 2021
7
0
1
31
Hi everyone, new to Proxmox and Linux as a whole.

Over the last week or so, I've been trying to setup my storage (among other things). While I've been largely successful at setting up the rest of my server, setting up my storage the way I want has been a huge challenge.

What I want is:
  • All 5 of my internal NTFS HDDs displayed in Proxmox and accessible by my host node, all my LXCs as well as the machines on my local network.
    • I will be reformating these SATA HDDs to ext4 at some point in the future once I get a 6th HDD and am able to move files off them. For now, NTFS.
  • Any USB Drives I plug in, regardless of format (most likely NTFS for compatibility with Windows and other devices) must be 'plug and play'.
  • Time efficiency.

What I did and what worked:
  • Installed ntfs-3g on host node.
    • I checked every LXC with ntfs-3g --version and it looks like its installed on every LXC as well as the host node?
  • Mounted an NTFS USB Flash Drive to my host node.
    • Added the USB Drive to /etc/fstab so that it would auto mount
  • Created a privileged LXC and installed Samba on that LXC.
  • Mounted that USB Drive onto the Samba LXC and created a share for the whole drive.
    • This USB Drive is now visible on my Windows PC from my Proxmox box. Excellent.
  • Created a privileged LXC for Plex Media Server.
    • Enabled "cifs" in LXC features.
  • Installed smbclient and cifs-utils on my Plex LXC.
    • I can see all the shares I created on the smb LXC by typing smbclient -L <ip-of-samba-LXC>
  • Successfully mount the USB Drive share that is mounted on the Samba LXC to the Plex LXC using the following command:
    • mount -t cifs -o username=x,password=x,uid=x,gid=x,vers=3.0,iocharset=utf8 "//192.168.0.x/Josh's USB" /mnt/drives/usb-key/
  • It seems USB Drive is 'plug and play'.
What did not work for me:
  • The mounted share on the Plex LXC disappears after reboot of LXC/server because I do not have an /etc/fstab entry.
    • I was hoping that adding the entry to the Samba LXC /etc/fstab would work, but it does not. Since it doesn't, this makes mounting shares to my LXCs 100x more tedious since I would have to edit /etc/fstab for every LXC and add an entry for every mount I want to share. Unless I'm missing something and the Samba server /etc/fstab really is where you add the entries. The command below is what I entered:
    • "//192.168.0.x/Josh's USB" /mnt/drives/usb2C-key/ cifs _netdev,x-systemd.automount,x-systemd.requires=network-online.target,uid=x,gid=x,username=x,password=x,vers=3.0,iocharset=utf8 0 0
    • Note: I get an error when I enter the command mount -a with the above in my /etc/fstab.
    • The error: mount: /etc/fstab: parse error at line 1 -- ignored
  • I decided to change course and try to add CIFS storage via the Proxmox WebUI.
    • It seems the Proxmox WebUI does not like shares with spaces in their name. The share I created for my USB Drive comes up as "USB" not "Josh's USB".
    • Trying to add that share spits out an error: create storage failed: error during cfs-locked 'file-storage_cfg' operation: storage 'usb-key' is not online (500)
    • However, using the pvesm command works perfectly. Full command below.
    • pvesm add cifs usb-key --server 192.168.0.103 --share "Josh's USB" --username x --password x --smbversion 3.0
    • I do not know where to go from here though. Is this even what I want? Would I still need to edit /etc/fstab endlessly?
  • While I was at it, I tried to add some shares from my Windows machine and it also seems there's weird crap going on there too.
    • Many of my Windows shares are labelled according to the drive that they are on. So my Backup folder on my "Storage 3" drive is named "[S3]Backup". When I shared that on my home network, Windows renames and shares it as "S3 Backup".
    • I have 7 Backup folders (7 drives). Proxmox WebUI detects one as "Backup". I do not know which folder that is, specifically.
    • When I try to add the Backup folder that Proxmox detects, I get an error:
    • create storage failed: error during cfs-locked 'file-storage_cfg' operation: storage 'backup' is not online (500)
    • That error is the same for every share, except for one share that is a folder without spaces or square brackets in the share or actual folder name. That share is detected correctly by Proxmox.
    • Unlike above where pvesm worked, sharing "Josh's USB", I get the same error as with the WebUI.


Conclusion

Wat do? I know I can just bind mount all my drives directly from my host node into every LXC but that's such a huge waste of time and also redundant. So is editing every LXC's /etc/fstab for Samba sharing. Is there no better, cleaner way to do what I want? Also, why aren't my Windows share's being added? Proxmox bug? Or does Linux simply not like square brackets and spaces?
 
Last edited:
First of all, you should get rid of all special characters and blanks/spaces and then try again.
I'd rather not do that for a variety of reasons...

The command mount -t cifs -o username=x "//192.168.0.x/S7 Backup" /mnt/win_shares works perfectly on my Plex LXC (cifs-utils installed). I don't understand why Proxmox WebUI and the pvesm command does not like spaces/square brackets in the way that I described in my original post.

I really don't want to mount all of my Windows shares this way.

Can someone please help me set up my storage in a better way?
 
Here's a screenshot of my host node /etc/fstab that I just setup...Not particularly painful, I'll live. The very annoying part comes when I actually have to mount all these shares in LXCs. I suppose I could use a script to mount everything faster but what I want to know is there a better way to set these shares up that I don't know about? What's the difference between doing this and setting the shares about in the Proxmox WebUI/using pvesm?

(also I know the mount points aren't correct)
 

Attachments

  • fstab.png
    fstab.png
    89.9 KB · Views: 61
Then try to quote the space character, like so:
//192.168.0.113/Josh's\ USB

Without quotation marks. And maybe you have to quote the apostrophe as well. It's a rather silly name for a share, though.
 
An update:

I have solved my storage woes.

But before I get to that,
  • I solved the mount: /etc/fstab: parse error at line 1 -- ignored by replacing the space in "Josh's USB" with "\040". Simply putting quotation marks around the line with a space in it didn't work, even though in other areas it did.
  • I found out that "Datacenter > Storage > Add" is simply to add vm iso/container template etc storage to Proxmox, nothing else. Not exactly clear in the Proxmox UI.
  • WebUI seems a bit rough around the edges when dealing with CIFS IMHO.
This week was a learning week.

I ended up installing OpenMediaVault in a VM and then installing OMV-Extras which gave me access to their MergerFS plugin. Initially I tried to simply have MergerFS inside an LXC but I couldn't figure out how to get it and all my HDDs + all my containers and the host to play along nicely, so I went the OMV VM + MergerFS route. This also allows me to easily hard link everything across multiple HDDs, which is a necessity since I'm using Sonarr/Radarr/Lidarr/Readarr. I have my Merged disk now mounted on my Windows PC. That sorts my storage for my whole server and share from server > Windows PC.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!