Du Jun
2014-Mar-06 07:06 UTC
[libvirt-users] How to enable mount loop device in LXC using libvirt LXC driver
When I try to mount loop device in a linux container, I got the following error message: mount: Could not find any loop device. Maybe this kernel does not know about the loop device? (If so, recompile or `modprobe loop'.) I wonder how to enable mount loop device in LXC using libvirt LXC driver? -- Thanks! Du Jun
Daniel P. Berrange
2014-Mar-06 09:42 UTC
Re: [libvirt-users] How to enable mount loop device in LXC using libvirt LXC driver
On Thu, Mar 06, 2014 at 03:06:29PM +0800, Du Jun wrote:> When I try to mount loop device in a linux container, I got the following > error message: > mount: Could not find any loop device. Maybe this kernel does not know > about the loop device? (If so, recompile or `modprobe loop'.) > > I wonder how to enable mount loop device in LXC using libvirt LXC driver?You don't want to try to setup loop mounts yourself - tell libvirt todo it in the XML eg <filesystem type='file'> <source file='/some/file/image'/> <target dir='/some/mount/point'/> </filesystem> and then libvirt will create a loop device and mount it. If you just want the loop device and not mounted, then use <block type='file'> instead. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|