Mount a simple local folder to a VM

Xo Zeus

New Member
Aug 7, 2014
6
1
1
Hi,

I searched across this forum and the web but I can't find a simple solution to my needs.
I have 2 hard disks on my proxmox host. The first one is hosted the VMs hard disks images in qcow2 format.
I want to use the second one to store data like my downloads.

So my second disk is containing a folder called "Downloads" and I simply want to mount it in a CentOS VM to enable read/write access to that folder. So my CentOS VM will be able to download files directly in that folder.

Is it possible to do it without complicated or overhead solution?
 
Hi,

I searched across this forum and the web but I can't find a simple solution to my needs.
I have 2 hard disks on my proxmox host. The first one is hosted the VMs hard disks images in qcow2 format.
I want to use the second one to store data like my downloads.

So my second disk is containing a folder called "Downloads" and I simply want to mount it in a CentOS VM to enable read/write access to that folder. So my CentOS VM will be able to download files directly in that folder.

Is it possible to do it without complicated or overhead solution?

Think about:
1. NFS (just standard simple network filesystem)
2. GlusterFS (You will get NFS, SMB and fault tolerant shared and replicated storage in one). Works over local eg. ext4 filesystem and install is as simple as running one command.
3. ??
 
.Re: Mount a simple local folder to a VM

Think about:
1. NFS (just standard simple network filesystem)
2. GlusterFS (You will get NFS, SMB and fault tolerant shared and replicated storage in one). Works over local eg. ext4 filesystem and install is as simple as running one command.
3. ??

1. It's a network based solution. In my needs, I just want to mount an existing local hard disk.
2. I really don't need fault tolerance or neither replication, look at my first post !

So network file access is the only way to access a local drive in r/w?
 
Re: .Re: Mount a simple local folder to a VM

Hello Xo Zeus

I just want to mount an existing local hard disk.

See http://forum.proxmox.com/threads/3589-Using-local-harddisk-with-existing-data-as-storage?p=20133#3


Note: with this you don´t mount an existing folder but define a complete virtual disk. If you want to have a physical disk "as it is" the partition number is omitted, e.g.

Code:
qm set 101 -ide1 /dev/sda


Be careful! It is possible to mount it then in VM and host at the same time - but dangerous: in case of writing from both, no synchronize mechanism exists!

Another option would be IOMMU, but works only if both CPU and BIOS/Motherboard support VT-d.

Kind regards

Mr.Holmes
 
Last edited:
Re: .Re: Mount a simple local folder to a VM

1. It's a network based solution. In my needs, I just want to mount an existing local hard disk.
2. I really don't need fault tolerance or neither replication, look at my first post !

So network file access is the only way to access a local drive in r/w?


Sorry my not careful reading I just rush to help.

For KVM/QEMU there is another way to mount local folder using 9p. Example in guest:
Code:
  [COLOR=#93A1A1][FONT=Menlo]guest# mount -t 9p -o trans=virtio,version=9p2000.L,rw share /mnt [/FONT][/COLOR]

It might be still not implemented. Please see related forum topic:
http://forum.proxmox.com/threads/10849-virtio-9p-pci-(virtfs)-is-not-implemented-!!

More information here:
http://wiki.qemu.org/Documentation/9psetup
http://troglobit.com/blog/2013/07/05/file-system-pass-through-in-kvm-slash-qemu-slash-libvirt/
 
Re: .Re: Mount a simple local folder to a VM

Hi guys,

I've red the links you've posted and I will summarize (correct me if I'm wrong) :

- 9p solution is not implemented in Proxmox. It requires libvirt (which is not present in Proxmox node) and a kernel > 2.6.36.
- the command "qm set 101 -ide1 /dev/sda" will help to mount a disk or a partition but not a simple folder. Solution too dangerous for me.
- NFS seems the only remaining solution in my case.

Do you have another suggestion? My goal is to set up a VM with rtorrent and let it download files in a folder located (host path) in /media/disk2/Downloads.

Thank you all for your help
 
Re: .Re: Mount a simple local folder to a VM

Do you have another suggestion? My goal is to set up a VM with rtorrent and let it download files in a folder located (host path) in /media/disk2/Downloads.

I think that the solution is very easy:

1- As the second hard disk is in the same host, create a partition in that disk, and apply format in ext3 for get better speed.
2- Restart your PVE host to apply the changes.
3- In your fstab file add this second disk (and logically where will be mounted), so when your PVE host will be restarting, you don't have problems for use this disk.
4- Add in the PVE GUI (storage tag) a directory where the second disk was mounted, the target is that PVE accept create images of disks of VMs in this second disk.
5- Add in the PVE GUI a virtual hard disk for your VM, with the capacity that you want, but this second virtual hard disk must be in the second physical disk.
6- Power off the VM (not apply restart), after, start it up for apply the changes.
7- Within of this VM, you should apply again a new partition, a new format (maybe ext3), and a edition of a fstab file for that this VM can use this second hard disk for always.
8- Within of this VM configure your programs as you want for that to use this new second disk
9- Enjoy of your new virtual hard disk that be in the second physical disk.

Best regards
Cesar
 
Last edited:
Re: .Re: Mount a simple local folder to a VM

I think that the solution is very easy:

1- As the second hard disk is in the same host, create a partition in that disk, and apply format in ext3 for get better speed.
2- Restart your PVE host to apply the changes.
3- In your fstab file add this second disk (and logically where will be mounted), so when your PVE host will be restarting, you don't have problems for use this disk.
4- Add in the PVE GUI (storage tag) a directory where the second disk was mounted, the target is that PVE accept create images of disks of VMs in this second disk.
5- Add in the PVE GUI a virtual hard disk for your VM, with the capacity that you want, but this second virtual hard disk must be in the second physical disk.
6- Power off the VM (not apply restart), after, start it up for apply the changes.
7- Within of this VM, you should apply again a new partition, a new format (maybe ext3), and a edition of a fstab file for that this VM can use this second hard disk for always.
8- Within of this VM configure your programs as you want for that to use this new second disk
9- Enjoy of your new virtual hard disk that be in the second physical disk.

Best regards
Cesar

Thanks Cesar for your interest!
This is not what I need...

I would like to have access of a directory from one or more VM and from the host...
So my Downloads dir is accessible from my VM and from my host. I don't need a second virtual disk in this second hard disk... I just want to mount it !!

In fact, I'm testing oVirt which is very powerful but less user-friendly. Maybe I will switch to it because AFAIK, Proxmox is like a "draft". It's an hybrid solution with a redhat kernel based, Debian based, no Libvirt, no Virt-manager, limited possibility... We are just stuck with the functionalities already developed or in development...
 
  • Like
Reactions: pepex7
Re: .Re: Mount a simple local folder to a VM

Thanks Cesar for your interest!
This is not what I need...

I would like to have access of a directory from one or more VM and from the host...
So my Downloads dir is accessible from my VM and from my host. I don't need a second virtual disk in this second hard disk... I just want to mount it !!

In fact, I'm testing oVirt which is very powerful but less user-friendly. Maybe I will switch to it because AFAIK, Proxmox is like a "draft". It's an hybrid solution with a redhat kernel based, Debian based, no Libvirt, no Virt-manager, limited possibility... We are just stuck with the functionalities already developed or in development...

Oh, now I understand what you want, my suggestion is that PVE will be sharing by NFS the directory. Of this mode, any VM and any host can get the simultaneous access to this shared directory, maybe it will be the best option (Windows systems inclusive can get access to a resource NFS shared).

As in any OS in the world, if you want share a directory with one or more PCs or hosts, always must be by a network (inevitable rule), and NFS will be the way more easy for do it. NFS in Linux is a equivalent to SMB/CIFS in Windows systems (SMB/CIFS is the protocol used by Windows for share directories in a network).
 
Last edited:
Re: .Re: Mount a simple local folder to a VM

Thanks Cesar for your interest!
This is not what I need...

I would like to have access of a directory from one or more VM and from the host...
So my Downloads dir is accessible from my VM and from my host. I don't need a second virtual disk in this second hard disk... I just want to mount it !!

In fact, I'm testing oVirt which is very powerful but less user-friendly. Maybe I will switch to it because AFAIK, Proxmox is like a "draft". It's an hybrid solution with a redhat kernel based, Debian based, no Libvirt, no Virt-manager, limited possibility... We are just stuck with the functionalities already developed or in development...
Here is my $1.
What you are trying to do is above and beyond what "Virtual Environment" suppose to do. I dont believe that you have successfully setup what you are proposing using oVirt. Forgive me if i am wrong. Even if you have been successful, it is just a disaster waiting to happen. Giving multiple VMs direct access to HDD is not viable combination.

Did you mean Proxmox is like "draft" as in "half cooked" product? In that case you would be wrong for obvious reason. Proxmox is building empire so to speak with its current maturity. You are trying something that should not be tried. Creating a separate storage to store your downloads or creating different Virtual Disk stored locally on separate hard disk are two logical choices. Both of which already has been suggested to you.
 
The best thing is to install nfs-server in proxmox and export it to the VM. I already tried and it works perfectly.
 
It is easily feasible with LXC, but your best shoot via a VM is to make a NAS with something like OMV and dedicate your drives to your VM by adding them
Code:
qm set 101 -ide1 /dev/sda

Then sharing those drives thought the network and using NFS or SMB to mount them on your proxmox.

If it's for backup purpose, be sure to exclude that VM and theses drives from your backup routine ;)

For better performance I make a virtual network (loopback network) where only proxmox and the VM have access
1637633916601.png
 
I would like to have access of a directory from one or more VM and from the host...
So my Downloads dir is accessible from my VM and from my host. I don't need a second virtual disk in this second hard disk... I just want to mount it !!
Hi, I use the same approach.

1. Just add second HDD to Proxmox Storage
2. Add second disk to VM and mount it
3. Done

IMHO, above is the simple solution, so you can backup your VM in one shoot. You don't need any tools and/or Network FS. In short you put a "virtual disk" to "virtual machine", that's how Virtual Environment should be :)
 
Re: .Re: Mount a simple local folder to a VM



Thanks Cesar for your interest!
This is not what I need...

I would like to have access of a directory from one or more VM and from the host...
So my Downloads dir is accessible from my VM and from my host. I don't need a second virtual disk in this second hard disk... I just want to mount it !!

In fact, I'm testing oVirt which is very powerful but less user-friendly. Maybe I will switch to it because AFAIK, Proxmox is like a "draft". It's an hybrid solution with a redhat kernel based, Debian based, no Libvirt, no Virt-manager, limited possibility... We are just stuck with the functionalities already developed or in development...
how did you do it?
 

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!