NFSv4 with User-Mode Linux
This page is about how to setup and run the Linux NFSv4 kernel
implementation as a User-Mode Linux process. These steps below worked
for me. (Note: (host) means that the commands should be executed on
the host, while (uml) means that the commands should be executed in
the UML system.)
- (host) Download and install the "UML kit" from
The User-Mode Linux download page.
For example, try
user_mode_linux-2.4.18.36um-0.i386.rpm
if you can deal with RPMs. This package contains a normal kernel, a
set of userspace tools, kernel modules, and documentation.
- (host) Download a root filesystem. I recommend using a root filesystem
which includes a full development environment. For example, try
root_fs.rh-6.2-full.pristine.20020312.bz2. Bunzip2 this file, and make a link called
root_fs
to the file.
- (host) Try to boot the precompiled UML kernel. I use a commandline like this:
/usr/bin/linux single eth0=tuntap,,,192.168.0.140 umid=citiuml
- (uml) Verify that the network works. On my system, I simple do
service network start
, which
brings up the network in the UML system, and creates a tap0 interface
in the host system. Try to ping the UML system from the host, and the
other way around. With the root filsystem
root_fs.rh-6.2-full.pristine.20020312.bz2
, the UML IP
will be 192.168.0.141.
- (host) Create a directory to be shared between the host and UML
system:
mkdir /citiuml
- (uml) Create a mountpoint the for shared directory:
mkdir /citiuml
- (uml) Add this line to the top of /etc/rc.d/rc.sysinit:
mount none /citiuml -t hostfs -o /citiuml
- (uml) Replace
/lib/modules
with a link:
mv /lib/modules /lib/modules.org
ln -s /citiuml/lib/modules /lib/modules
- (host) Compile a v4-enabled kernel. You
should be able to follow the instructions on
http://www.citi.umich.edu/projects/nfsv4/june_2002_rel, under
"Download and install", with the following exceptions:
- Apply a
patch for enabling the Crypto stuff in
User-Mode Linux.
- When configuring, append
ARCH=um
. For example, I use make
menuconfig ARCH=um
.
- Make sure to enable devfs, because the root filsystem
root_fs.rh-6.2-full.pristine.20020312
assumes devfs.
- Make sure to enable support for
hostfs
(do not
compile as a module). For some reason, sometimes the make system fails
to include the hostfs filesystem. I solved this by running
make linux ARCH=um
, then
cp arch/um/fs/hostfs/hostfs.o arch/um/fs/fs.o
, and then
make linux ARCH=um
again. Don't know why this is
happening. Update: This should be solved with UML 2.4.18-43.
- Instead of running
make modules_install
, run
make modules_install INSTALL_MOD_PATH=/citiuml ARCH=um
- (host) Try booting the new v4 kernel:
./linux single eth0=tuntap,,,192.168.0.140 umid=citiuml
- (host) Download the
NFSv4 utilities and the Kerberos dist into
/citiuml
.
- (uml) The root filesystems misses
make, byacc and libtermcap-devel. Install them, for example from
ftp://ftp.funet.fi/pub/Linux/mirrors/redhat/redhat/linux/6.2/en/os/i386/RedHat/RPMS.
- The NFSv4 utilities needs header files from the Linux
kernel. By using hostfs, it's possible to mount the v4 kernel tree
into /usr/src/linux. Add this line to /etc/fstab:
none /usr/src/linux hostfs /path/to/your/v4kernel
Run mount -a
.
- Change arcitecture of your kernel tree by running:
make symlinks
- (uml) Compile Kerberos and the NFSv4 utilities in
/citiuml
, by
following the instructions on
http://www.citi.umich.edu/projects/nfsv4/june_2002_rel.
- (uml) Create an /etc/exports. See
http://www.citi.umich.edu/projects/nfsv4/june_2002_rel/exports.html.
- (uml) Start the network and the v4 server:
service network start
service portmap start
service nfs4 start
Notes
I use single-mode all the time, because the xterm-based virtual
consoles does not work for me.
Make sure the user running "linux" has permissions in /citiuml
.
If you want to re-compile the kernel or the kernel modules, you must
change arcitecture of your kernel tree with:
make menuconfig ARCH=um
Running multiple UML instances
Sometimes it's useful to run multiple UML instances. For example, it's
practical to run one server and one client "machine". This can be done
by using UMLs
copy-on-write (COW) layering capability. Quick setup:
- Rename
root_fs
to root_fs_backing
- Start the first machine with:
./linux single eth0=tuntap,,,192.168.0.140 umid=citiuml1 ubd0=root_fs_1,root_fs_backing
- Start the second machine with:
./linux single eth0=tuntap,,,192.168.0.140 umid=citiuml2 ubd0=root_fs_2,root_fs_backing
(The argument ,root_fs_backing is only required the first time.)
- Change IP adress of one instance.
Links
www.nfsv4.org
NFS Version 4 Open Source Reference Implementation (The Linux v4 implementation)
The User-mode Linux Kernel Home Page
You can reach me via astrand at lysator dot liu dot se
.