Mounting existing ext4 filesystem to VM

Jeff_L

Member
May 24, 2019
5
0
6
54
Hi,

Noob question...

I'm looking to move from several physical machines to one big server and several VMs. One of those physical machines is a OMV-based NAS with several ext4 disks full of data.
Can I mount the ext4 filesystems to proxmox and then make them available to a VM (which will be running OMV)?

I really don't want my data in a virtual filesystem sitting in a VM disk container somewhere; I like it on a first-order filesystem where I can pull out the disk and read it in another machine if there's a problem with the server.

Is there a way to achieve this?

Thanks!

Jeff
 
Thanks. I read that, but wasn't clear whether it can allow the VM to directly access files on the host filesystem. I'll give it a test... also read something else on the forum that suggests one can share a whole host FS with a VM, which might be even better for OMV as it expects to manage filesystems.
 
Thanks. I read that, but wasn't clear whether it can allow the VM to directly access files on the host filesystem. I'll give it a test... also read something else on the forum that suggests one can share a whole host FS with a VM, which might be even better for OMV as it expects to manage filesystems.
Hi, I have the same issue like you. Do you success for it ?
 
Yes. Here's the config for passing through three disks to the OMV VM:


#Standard vdisk for boot/root
scsihw: virtio-scsi-pci
scsi0: ssd1_thinpool:vm-108-disk-0,cache=writeback,size=20G
#Pass through data disks whole - these appear in the guest as /dev/vd*
virtio1: /dev/disk/by-label/DATA,backup=0,size=1953513560K
virtio2: /dev/disk/by-label/DATA2,backup=0,size=1000203820544
virtio3: /dev/disk/by-label/BACKUP,backup=0,size=3000591916544

You can't do everything in the guest VM that you can with a real physical disk; SMART and such don't seem to work but they behave close enough to the real thing for most purposes. Screenshot from OMV below.

Capture.JPG
 
Yes. Here's the config for passing through three disks to the OMV VM:


#Standard vdisk for boot/root
scsihw: virtio-scsi-pci
scsi0: ssd1_thinpool:vm-108-disk-0,cache=writeback,size=20G
#Pass through data disks whole - these appear in the guest as /dev/vd*
virtio1: /dev/disk/by-label/DATA,backup=0,size=1953513560K
virtio2: /dev/disk/by-label/DATA2,backup=0,size=1000203820544
virtio3: /dev/disk/by-label/BACKUP,backup=0,size=3000591916544

You can't do everything in the guest VM that you can with a real physical disk; SMART and such don't seem to work but they behave close enough to the real thing for most purposes. Screenshot from OMV below.

View attachment 11450
Hello Jeff,

So, you add "virtio1: /dev/disk/by-label/DATA,backup=0,size=1953513560K " to "/etc/pve/qemu-server/100.conf ", like this ?
 
Yes, but don't use my size value! If I remember correctly, you can leave the size parameter off and let PVE fill it in (it will do that when it loads the VM and might add some other parameters too).
 
Yes, but don't use my size value! If I remember correctly, you can leave the size parameter off and let PVE fill it in (it will do that when it loads the VM and might add some other parameters too).

all right ! my OMV could mount my disk in it. Thank you Jeff !

but I have a new case in the disk : I could list the disk old data in shell by root. But can't read data in smb's shared folder. The permission setting is rw for the folder.
 
Is your OMV configuration on the VM a completely fresh install, or a restore of the config from a previous physical machine?

Is the filesystem mounted, in the place where you expect it to be? I found that OMV behaved slightly differently with virtual disks than with physical ones and the mount points (/media/<long-hex-value>) weren't the same. It mounts vdisks under /srv/<dev-disk-by-label-DISKLABEL>. That may mean that samba's looking in the wrong place.

Check that OMV sees all the disks, filesystems, shared folders properly and has the right permissions on the shares (UID, GID values may have changed too). If that looks all ok, then the first thing I'd do is force OMV to recreate the config files and reboot. Use omv-mkconf on the command line, or change one of the shared folder definitions in some trivial way through the GUI then apply the change; that'll force the samba config to rebuild.

If that doesn't do it, it could be a linux permissions issue and you'll need to go into the command line and do some diagnosis. My storage folders appear all to be owned by root.users and have permissions 770. Samba has its own access control, so OMV has root own everything and the samba service runs as root.

Hope that helps! It's also worth searching the OMV forum; a fair few people there are running it under qemu in some way, either proxmox or directly.
 

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!