Mounting USB NTFS drive on host at start up, and sharing it with VMs

jaytee129

Member
Jun 16, 2022
132
10
18
I was able to mount an external USB drive (NTFS formatted) on proxmox host using:

mount -t ntfs-3g /dev/sdb1 /mnt/pve/USBDrive (after installing ntfs-3g, looking up drive name, and creating mount point)

I could then go into Data Centre -> Storage -> Add -> Directory and point to /mnt/dev/USBDrive then create a Backup that uses that directory/drive

Question 1: drive disappears when I reboot and I can't find the right commands and location for them to have it remounted at startup (using ntfs-3g)

Question 2: how to expose it (the directory, I guess, not the drive) for use by multiple VM's (or even 1 if multiple is not possible) without causing it to unmount from host so backups can still use it. Is that possible?

Question 3: if I were to remove the USB drive to move the data elsewhere or replace it with another USB drive, will everything just work, or will I have to start over when I put drive back in or new one? Is there anything I need/can do for things to 'just work'?

Any info would be appreciated.
 
Last edited:
hi,

Question 1: drive disappears when I reboot and I can't find the right commands and location for them to have it remounted at startup (using ntfs-3g)
you can add it into your /etc/fstab file if you want to mount it automatically at boot.

Question 2: how to expose it (the directory, I guess, not the drive) for use by multiple VM's (or even 1 if multiple is not possible) without causing it to unmount from host so backups can still use it. Is that possible?
within a container it would be easier to share the directory from the host (by using a bind mount point [0])

with VMs it's a little more work, you might have to create a NFS/SMB share for your VMs and mount it inside there like that.
otherwise you can do a drive passthrough (but you said you don't wish to do that)

Question 3: if I were to remove the USB drive to move the data elsewhere or replace it with another USB drive, will everything just work, or will I have to start over when I put drive back in or new one? Is there anything I need/can do for things to 'just work'?
depends on exactly how you write your fstab entry. if you use /dev/sdb1 as the identifier,then another drive can also work (provided that it's also detected as /dev/sdb and has a partition inside). if you use the disk uuid then it will onyl with your current one.

but my question is why do you want to use NTFS formatted USB? isn't it easier to use FAT format?

[0]: https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points
 
Last edited:
but my question is why do you want to use NTFS formatted USB? isn't it easier to use FAT format?

[0]: https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points
I might be able to use FAT32 for this but it would limit me to 2TB. I had a 7TB NTFS drive so that's why I took the NTFS path.

Why is FAT format easier? I followed the link you provided to do this in a Linux Container but I'm trying to do it from the host for use by WIndows VM. Will following those instruction work for what I want to do? And will it mount whatever I connect to the same USB port (whether same or different USB drive)?
 
Why is FAT format easier?
since it can be mounted on linux machines without extra modules like ntfs-3g.

followed the link you provided to do this in a Linux Container but I'm trying to do it from the host for use by WIndows VM. Will following those instruction work for what I want to do?
yes, the linked instructions are for linux containers (since you wanted to passthrough the directory and not the whole disk) since it's easier to pass a directory from the host.
you didn't mention you wanted to do it for a windows VM, though i also explained how you could go about doing that for a VM, in my last post:
with VMs it's a little more work, you might have to create a NFS/SMB share for your VMs and mount it inside there like that.
otherwise you can do a drive passthrough (but you said you don't wish to do that)

And will it mount whatever I connect to the same USB port (whether same or different USB drive)?
if you want to do a simple usb passthrough you can also add a usb disk to your VM.
go in the "Hardware" section of your VM and select "Add" -> "USB Device".
from there you can select if you want to pass a single device (by using the vendor/device IDs) or a whole USB port.
with the latter option you would be able to use different USB drives in the VM as long as you plug it to the same physical port.

hope that this explains some things better!
 
just to clarify/narrow down what I'd like to do/have:
1. ability to use my whole 7TB external hard drive (I believe that means NTFS but if there's other option I'm all ears)
2. ability to access drive from proxmox to do backups, copy files to/from my NAS (that isn't accessible if/when my Sophos VM is off. So, no, I can't just use that)
3. ability to access drive from Windows VM

I can't add the drive as a USB device to VM because I lose access to it from proxmox, and I don't see and option to add NFS/SMB share to a VM. Where would I find that? Or would I need to create a new/separate linux container that then exposes the drive as an NFS share? Will proxmox be able to see it too? If this is what's needed the problem is that the container needs to be up so I can't do a backup with it stopped, which is why I wanted proxmox to be able to see the drive without anything running.

If I can't have my cake and eat it too (both 2 and 3), that's fine. Was just hoping I could.
 
I see 3 ways you could do this:

1.) You could mount the whole disk on your PVE host. setup the SMB server directly on your PVE host andashare some folders via SMB to xour Win VM. Benefit would be that both the host for backups and the WinVM could make use of the whole 7TB HDD. Downside would be that SMB isn't as fast as a passthroughed disk, that its harder if you ever need to reinstall PVE because you would need to setup the SMB server again and that you would need to setup your shares without any GUI so you should now what your are doing to prevent security problems.

2.) You partition your HDD in two partitions. Lets say one 4TB partition for backups and a 3TB partition for your Win VM. You then could mount that 4TB partition to your PVE host and set it up as a directory storage to store backups. And you could use disk passthrough to passthrough just the 3TB partition into your VM. Downside ofcause would be that PVE host and WinVM can't share the same folders/files and that you are probably wasting space because you then got two partitions that need always same free space to not run out of space. And thin provisioning wouldn't be possible.

3.) You create one big 7TB partition, format it with a linux filesystem of your choice (ext4/xfs/...) and mount it to yoour PVE host. You can then store your backup there and also virtual disks as qcow2 image files. You could then create virtual disk, add it to your WinVM and format that virtual disk with NTFS. Benefit would be that this would allow thin provisioning so the WinVM is only consuming that much space as your store data to it from within your WinVM. Downside would be that qcow2 and the additional filesystem add onerhead.
 

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!