Mount ISO image in a OpenVZ container

From vpsget wiki
Jump to: navigation, search

This page describes how to mount ISO image inside a container.

Original page can be found here: http://openvz.org/Mount_ISO_image_in_a_container

Check/install the fuse module on server node:

lsmod | grep fuse
modprobe fuse

You may add to load module on node reboot Create /etc/sysconfig/modules/custom.modules and insert/add:

modprobe fuse


You need to install fuseiso and fuse or fuse-utils into container.

Run on a node:

vzctl set <CT_ID> --devnodes fuse:rw --save

OR alternative you can run the next commands on node:

vzctl set <CT_ID> --devices c:10:229:rw --save
vzctl exec <CT_ID> mknod /dev/fuse c 10 229

To mount an ISO image, do next command inside container: Run inside VPS

fuseiso image.iso /mnt/disk

If you are using Centos inside container this should be quite easy and everything should work now. But if you are on Debian 8 or faced any issues continue to read.

________

NOTE that depending on OS inside container some things may be differ: for Debian and Ubuntu, install fuseiso and fuse-utils packages (available in repository) for RHEL/CentOS 3/4/5, use DAG's packages fuse-iso and fuse

For example for Debian 8 it's also necessary to run the next command inside container before install fuse:

mknod /dev/fuse c 10 229

It may not work if run on the node using vzctl exec in some cases. SO just keep in mind this and better to run this command inside container. Also check the permissions:

# ls -la /dev/fuse 
crw-rw-rw- 1 root root 10, 229 Nov 18 13:16 /dev/fuse

If you see any other permission fix it with chmod +x /dev/fuse or chmod +x /dev/fuse - depend on your case.

Install fuse and fuseiso:

apt-get install fuse fuseiso

Most likely that you'll not be able to install fuseiso with some error. Make apt-get update && apt-get upgrade for any case.\ Edit /etc/apt/sources.list like specified . We've added few repos:

deb http://ftp.debian.org/debian jessie main contrib non-free 
deb http://ftp.debian.org/debian jessie-updates main contrib non-free
deb http://security.debian.org jessie/updates main contrib non-free 
deb http://httpredir.debian.org/debian jessie-backports main
#deb-src http://http.us.debian.org/debian/ unstable main contrib non-free 
deb-src http://httpredir.debian.org/debian jessie main contrib non-free
deb-src http://httpredir.debian.org/debian jessie-updates main contrib non-free 
deb-src http://security.debian.org/ jessie/updates main contrib non-free
#deb-src http://ftp.nl.debian.org/debian/dists/jessie/contrib/source/ unstable main contrib non-free  


Now let's try to build fuse

mkdir /home/fuse
cd /home/fuse
apt-get install build-essential

Now build fuse, note that sometimes this may fail or complete with errors , whatever just try to go ahead.

apt-get -b source fuseiso 

Try to reboot container and run fuseiso . If you see the fuseiso help go ahead and try to mount some iso!

otherwise

dpkg -i <package> #and resolve any unmet dependencies manually.