Help with setting up NFS for proxmox

shuhdonk

Member
Dec 15, 2020
24
0
6
I am new to proxmox and relatively new to linux as well. I have a proxmox server I am setting up.. It has 4 4tb ssds off an lsi hba card.. all that is working fine. What I am trying to do is add an external usb hard drive directly to the proxmox server.. which I have.. I have zfs on it and partitioned into 4 partitions and setup with raidz1 on the single drive. (reasons: https://youtu.be/-wlbvt9tM-Q?t=244 ) I added a zfs pool (all this I just had to google and watch videos on how to do, as I know nothing about how to do it on my own, so mistakes may of been made, mostly from following linked yt video). So what I ended up with is a drive/nfs that proxmox can see.. I go to datacenter and storage and trying to add NFS drive.. it sees the pool/share when I try to add it but gives me this error when I click add.

create storage failed: error during cfs-locked 'file-storage_cfg' operation: mkdir /mnt/pve/Backup/private: Permission denied at /usr/share/perl5/PVE/Storage/Plugin.pm line 1170. (500)

I am not sure what this means or how to fix it. Ideas how to go about resolving this? thanks!
 
Hey, so if you want more copies of the same data to be able to recover it in case one copy got corrupted, have a look at the "copies" property that a ZFS dataset can have.

So what I ended up with is a drive/nfs that proxmox can see.. I go to datacenter and storage and trying to add NFS drive.. it sees the pool/share when I try to add it but gives me this error when I click add.

create storage failed: error during cfs-locked 'file-storage_cfg' operation: mkdir /mnt/pve/Backup/private: Permission denied at /usr/share/perl5/PVE/Storage/Plugin.pm line 1170. (500)
So if I understand you correctly, you imported the pool directly in the PVE host and now want to create a storage on it? What for? Backups or to store guests on it?
 
Hey, so if you want more copies of the same data to be able to recover it in case one copy got corrupted, have a look at the "copies" property that a ZFS dataset can have.


So if I understand you correctly, you imported the pool directly in the PVE host and now want to create a storage on it? What for? Backups or to store guests on it?

Hello, I want to use the external usb drive for backups and iso's etc
 
Okay, then NFS is not the right choice as it is a Network File System.

What you want then is probably to configure a Directory Storage that points to a directory on the zpool.

Can you please show the output of zfs list and indicate which dataset you want to use for that?
 
I want to use the extbackup1 for backups and isos etc for vms. Thanks for the help!
 

Attachments

  • zfslist.png
    zfslist.png
    11.3 KB · Views: 13
In that case you can create a new Storage of the Type "Directory". Set the path to /extbackup1. Don't forget to set "Content" to the things you like to store there.

Since this is not located on the root file system you will have to tell PVE that this storage is located at a mount point so PVE will only use it if there is another FS mounted at that path. Additionally, it helps to tell PVE to not create the path if it does not exist yet.

To do that you can run the following on the CLI after you created the storage:
Code:
pvesm set <your storage name> --is_mountpoint 1 --mkdir 0

or add the following two lines directly in /etc/pve/storage.cfg for that storage:
Code:
is_mountpoint 1
mkdir 0

Without these two options you could run into a problem if the pool might not be present or takes a bit longer to be imported and mounted. Without these options PVE would just create a directory specified in the path for the storage and that would then be on the root file system.
 
Thank you for the help, I appreciate it. Is the <your storage name> /dev/sdf ? or extbackup1 or the name I put it as in proxmox storage/directoy ui? Also since this is a usb drive will the /dev/sdf ever change? I do not plan on ever removing it or changing usb ports but was not sure if that could cause an issue.
 

Attachments

  • lssci.png
    lssci.png
    12.1 KB · Views: 5
I think a bit more explanation is necessary.

You created a ZFS pool called extbackup1. On this pool you do have datasets. These datasets are presented as file systems (there are other types of datasets possible). Where such a dataset is mounted in the system, so you can access it can be seen in the last column of the zfs list output.


So the root dataset of the pool is mounted at the path /extbackup1.

PVE needs storage definitions on top of the actual storages. You manage these in the GUI in the Datacenter -> Storage panel. You can add a Storage definition of the type ZFS but that is not what you need in your case because with that you can only store VM and container disks.

So since the pool exposes a file system we can create the most basic storage definition of type "Directory" where we point at that path. And since it is not always guaranteed that the ZFS pool will be present (fast enough) you should add the two options mentioned earlier.

The <your storage name> is the name / ID you give it when you create the storage in the Datacenter -> Storage panel.


I hope this helped to clear up how the storage definitions in PVE work :)
 
Okay, I think I understand, thank you. I named it Backup in datacenter - storage.. so is this the correct syntax?

pvesm set Backup --is_mountpoint 1 --mkdir 0

I also should add in storage.cfg ?

is_mountpoint 1
mkdir 0

That the exact syntax?

thank you again!
 
You can do one or the other. If you ran the pvesm command and it did not report and error, these settings should be present in the /etc/pve/storage.cfg already.
 
  • Like
Reactions: shuhdonk