Difference between revisions of "FUSE"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(ve to container)
(Mounting filesystem I attempted to defeat the linkification, but it doesn't work)
Line 75: Line 75:
 
<pre>
 
<pre>
 
# vzctl enter 100
 
# vzctl enter 100
# sshfs root@foo.org:/root /mnt/foo.org.root
+
# sshfs <nowiki>root@foo.org</nowiki>:/root /mnt/foo.org.root
 
</pre>
 
</pre>
  

Revision as of 11:12, 4 January 2009

This page describes how to setup FUSE (filesystem in userspace) inside a container.

FUSE is a filesystem in which data and metadata are provided by an ordinary userspace process. The filesystem can be accessed normally through the kernel interface.

Preparations

To use FUSE you need the following:

  1. OpenVZ kernel version 028test005 or higher
  2. Fuse lib
  3. Any FUSE-based filesystem

In the examples below sshfs is used.

Setup

Kernel

Download appropriate kernel from openvz.org or compile kernel with CONFIG_FUSE_FS option set

Userspace

You have to fuse libraries and some fuse filesystem modules (here we use sshfs as an example).

The best way to have it installed is to use the packages from your distro vendor. An alternative is compiling the stuff from source.

Gentoo

# emerge sys-fs/sshfs-fuse

Fedora

# yum install fuse-sshfs

Debian/Ubuntu

# apt-get install sshfs

Compiling from source

If there are no packages provided for you distribution, you have to compile from source.

First, compile libfuse in a container without kernel module

# vzctl enter 100
# tar xzf fuse-2.6.0.tar.gz
# cd fuse-2.6.0
# ./configure --disable-kernel-module
...
# make
...
# make install
Yellowpin.svg Note: Sometimes libfuse.so.X is unseen by your programs. Usually this file is installed in /usr/local/lib directory so don't forget to add this directory into your /etc/ld.so.conf and then run ldconfig.

Next, download and compile filesystem.

# vzctl enter 100
# tar xzf sshfs-fuse-1.7.tar.gz
# cd sshfs-fuse-1.7
# ./configure
...
# make
...
# make install

Container tuning

You need to make a character device named /dev/fuse and grant your container permissions to it

# vzctl set 100 --devices c:10:229:rw --save
...
# vzctl exec 100 mknod /dev/fuse c 10 229
...

Mounting filesystem

After this you may try to mount FUSE in a container.

# vzctl enter 100
# sshfs root@foo.org:/root /mnt/foo.org.root

Unmounting filesystem

In case of sshfs after umounting an appropriate daemon must be killed. This may be done by the following command:

# fusermount -u moutpoint

Using fusectl filesystem

Fusectl is a helper filesystem for FUSE. You may mount it in a container as well.

# vzctl enter 100
# mount -t fusectl none /fuse_ctl

External links