Add storage to a container that will be used as fileserver

didinside

New Member
Feb 20, 2024
2
0
1
Hi,

I've created a container that I would like to use as Fileserver for my personal network and other VMs.
On this container (Debian based), I've installed cockpit and 45 drives addons (to manager samba/nfs) shares. And I would like to add my 2 HDDs as main storage to that container.

My issue/question : how to add these 2 HDD drives to that container ?

I found a way but don't know if this is the good one.
- proxmox instance > "Disks" > create Directory
=> if I understood correctly it mount the HDD in the proxmox host
then container > Resources > Add mountoint, I can mount this drive inside the container.
The thing that annoys me is the "Disk size (GiB)" in the Create Mount point.
I have to give a size but if I put 2000 for my 2TB, I've the impression that he creates or reserve a bigger space. I just want to use the full space from my HDD. Not more, not less.

Is there another way, a better way ? I have found quite some articles or videos but they always uses ZFS.
I don't really want to use ZFS as I don't have a lof of memory on my server and I've several VM already running and demanding quite some memory.

My setup :
- Microserver HP Gen 9 (quite old) with proxmox 8.1.4
- SSD 256GB (used by proxmox)
- HDD 2TB (for personal document, dev, applications, backup, etc...)
- HDD 3TB (multimedia)

Thanks,
Did
 
=> if I understood correctly it mount the HDD in the proxmox host
then container > Resources > Add mountoint, I can mount this drive inside the container.
almost. you have two options here, but both involve the same preparation, which is to create a partition and filesystem on each of your disks. I'd suggest using lvm here, but filesystem on block works too. filesystem can be anything your container supports natively- ext4 is a good choice here.
how you go from here depends on whether you want the host or any other guests to have access to the filesystems. If you want access from outside, put the filesystems in the host's fstab, and pass the mounted directories as mountpoint to you container, eg:

pct set ctid -mp0 volume=/path/to/host/directory,mp=/container/directory

bear in mind that using this method may have UID/GID mapping implications depending on whether your container is privileged or not.

the other way is to not mount the volume, and instead pass the block device to the container, like so:

pct set ctid -mp0 volume=/dev/mapper/yourgv-yourlv,mp=/container/directory
 
Many thanks for your reply.

Why would you suggest LVM?

Otherwise, I think I'll try the second option (pass the block device). Access will be done by Samba/NFS only, So if only the container has direct access to these drives, it's fine for me. All others will access it via shared services.