Mount ISO inside LXC

cmonty14

Well-Known Member
Mar 4, 2014
343
5
58
Hello!

I want to access an ISO located in /var/lib/vz/template/iso/ from inside a LXC container running Debian 8.
However, I failed to run a loop mount command inside the container after mounting NFS share on host.

I found some statements that loop mount inside LXC is not recommended.

Then I found this thread here in the forum, but the command
pct set 106 --mp0 local:iso/siduction-15.1.0-paintitblack-gnome-amd64-01601162124.iso.iso,mp=/mnt/iso
fails with this error:
thomas@pc4-svp:~$ sudo pct set 106 --mp0 local:iso/siduction-15.1.0-paintitblack-gnome-amd64-201601162124.iso.iso,mp=/mnt/iso
storage 'local' does not allow content type 'rootdir' (Container)


Question:
How can I mount an ISO inside LXC?

THX
 
Sorry, still a dummy here.

What would be "/<path>/<to>/<container>/mnt". Can you please give an example?
 
Sorry, still a dummy here.

What would be "/<path>/<to>/<container>/mnt". Can you please give an example?

Sure,

Code:
mount -o loop,ro /zpool/templates/template/iso/debian-9.3.0-amd64-netinst.iso /zpool/customer-10000/subvol-10001-disk-1/mnt
 
Still a bit lost.

What would the equivalent of your "/zpool/customer-10000/subvol-10001-disk-1/mnt" in a standard setup with the default storage (local & local-lvm) for a container?
 
What would the equivalent of your "/zpool/customer-10000/subvol-10001-disk-1/mnt" in a standard setup with the default storage (local & local-lvm) for a container?

You have to find out where the container is mounted and then use this mount point. If you'd use ZFS, it would be as simple as my example: /rpool/proxmox/subvol-100-disk-1/mnt

FYI: IMHO best storage type for containers is ZFS :-D
 
This blog post describes how to make a directory on the Proxmox node visible inside a container:
blog.felixbrucker.com/2015/10/01/how-to-mount-host-directories-inside-a-proxmox-lxc-container/

The key is to edit the container's configuration file in /etc/pve/lxc/<CONTAINER_ID>.conf and add a new line describing the mount point.
mp0:/path/on/proxmox/node,mp=/path/on/container

Note: You will need to restart the container to see the mounted data.

You can mount an ISO file on the Proxmox node then mount that directory in the container.

This example will mount an ISO named data_disk.iso on the Proxmox node in /mnt and make it available in the container in /mnt:
mount -o loop,ro /tmp/data_disk.iso /mnt

echo mp0:/mnt,mp=/mnt >> /etc/pve/lxc/101.conf
 

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!