Main Page | Recent changes | Edit this page | Older versions |

Printable version

54.80.120.136 (Talk)
Log in | Help

User Mode Linux

From Wikipedia, the free encyclopedia.

Japanese (日本語)

> Will I be able to run UML (skas or not) on a plain RH 9 machine?

Yes,

uml tools comes with RH9. you can find some in /usr/bin/uml_* . so, you need to get "linux" command (uml kernel) and config file. from: http://kernels.usermodelinux.org/kernels/ I used linux-2.4.20-6um.

some files need to change the mode. RH9 kept them secure.

# chmod u+s /usr/bin/uml_net
# chmod g+rw,o+rw /dev/net/tun

download disk image file from http://user-mode-linux.sourceforge.net/dl-fs-sf.html I got Debian-3.0r0.ext2.bz2 which is Debian 3.0r0 minimum installation.

I explain with this case.

$ bunzip2 Debian-3.0r0.ext2.bz2

... this fs is almost full, to expand fs to 512mb is...

$ dd if=/dev/zero of=Debian-3.0r0.ext2 bs=1 count=0 seek=512MB 
$ resize2fs -p Debian-3.0r0.ext2 

... starting linux

$ linux ubd0=Debian-3.0r0.ext2.diff,Debian-3.0r0.ext2 eth0=tuntap,,,192.168.1.100
192.168.1.100 is any valid and unused IP on your LAN. you can login as root without password.

set hostname

UML# echo debian.mynet >/etc/hostname
UML# /etc/init.d/hostname.sh

set network

edit /etc/network/interfaces and add these lines:
-----
auto lo eth0

iface lo inet loopback

iface eth0 inet static
   address 192.168.1.101
   netmask 255.255.255.0
   gateway 192.168.1.1
---------
192.168.1.101 is any valid and unused IP address of your network. So, this UML setup uses two IP addresses, one for host side, another for guest side.

edit /etc/resolv.conf and add your name servers.

-------
nameserver 192.168.1.3
nameserver 192.168.1.4
-------

now, you can start network.

# /etc/init.d/network start

you can ping anywhere in the world.

you can access files on the host side.

# mount none /mnt -t hostfs
now, /mnt is the / of host OS. you can read/write.

if you want to install something more, use apt-get. for example, to install apache web server:

# apt-get update
--- to get the latest list of package, then

# apt-get install apache

you can see the test page from your host OS by http://192.168.1.101/

# halt
to shutdown Debian...

from 2nd time, you can start UML without real disk image.

$ linux ubd0=Debian-3.0r0.ext2.diff eth0=tuntap,,,192.168.1.100

love and fun
--Setu 19:51 21 Oct 2003 (JST)

Making file partition bigger

This is very simple. You can read article here.

  1. first, stop UML
    halt
  2. make single file from fs file and COW file.
    uml_moo Debian-3.0r0.ext2.diff Debian-3.0r0.4gb.ext2
    • new fs is Debian-3.0r0.4gb.ext2 in above sample
  3. checking new fs
    e2fsck -f filename
  4. making fs for 4GB but it uses around 64MB + "fs system area".
    dd if=/dev/zero of=Debian-3.0r0.4gb.ext2 bs=1 count=0 seek=4gb
    expand file system
    resize2fs -p Debian-3.0r0.4gb.ext2

run it

First time:

linux ubd0=Debian-3.0r0.4gb.ext2.diff,Debian-3.0r0.4gb.ext2 eth0=tuntap,,,192.168.1.100
Second time:
linux ubd0=Debian-3.0r0.4gb.ext2.diff eth0=tuntap,,,192.168.1.100

giving more memory for UML

add option at the command line to start: example: linux mem=64M ubd0=Debian-3.0r0.4gb.ext2.diff eth0=tuntap,,,192.168.1.100

You can read all the command option by "linux --help"

making swap area

Making swap fs, next example is making 128MB swap.

at the host
dd if=/dev/zero of=128mb.swap seek=128 count=1 bs=1M
starting UML with this
linux mem=64M ubd0=Debian-3.0r0.4gb.ext2.diff ubd1=128mb.swap eth0=tuntap,,,192.168.1.100
initialize as swap partition. follows are in UML
mkswap -c /dev/ubd/1
register in /etc/fstab. add next one line:
/dev/ubd/1 swap swap defaults 0 0
try..
swapon -av
checking... with "free" command:
free
total used free shared buffers cached
Mem: 61772 22588 39184 0 708 4920
-/+ buffers/cache: 16960 44812
Swap: 132088 0 132088

[Main Page]
Main Page
Recent changes
Random page
Current events
Edit this page
Discuss this page
Older versions
What links here
Related changes
Special pages
Bug reports