aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/user/booting_xen.tex
blob: 7ba3d2e64c873c19575b26f4ed8a2f4a6229bef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
\chapter{Booting Xen}

Once Xen is installed and configured as described in the preceding chapter, it
should now be possible to restart the system and use Xen.

Booting the system into Xen will bring you up into the privileged management d
omain, Domain0. At that point you are ready to create guest domains and "boot" t
hem using the xm create command.

\section{Booting Domain0}

After installation and configuration is complete, reboot the system and and ch
oose the new Xen option when the Grub screen appears.

What follows should look much like a conventional Linux boot.  The
first portion of the output comes from Xen itself, supplying low level
information about itself and the underlying hardware.  The last
portion of the output comes from XenLinux.

You may see some errors during the XenLinux boot.  These are not
necessarily anything to worry about --- they may result from kernel
configuration differences between your XenLinux kernel and the one you
usually use.

%% KMSelf Wed Nov 30 18:09:37 PST 2005:  We should specify what these are.

When the boot completes, you should be able to log into your system as
usual.  If you are unable to log in, you should still be able to
reboot with your normal Linux kernel by selecting it at the GRUB prompt.

The first step in creating a new domain is to prepare a root
filesystem for it to boot.  Typically, this might be stored in a normal
partition, an LVM or other volume manager partition, a disk file or on
an NFS server.  A simple way to do this is simply to boot from your
standard OS install CD and install the distribution into another
partition on your hard drive.

To start the \xend\ control daemon, type
\begin{quote}
  \verb!# xend start!
\end{quote}

If you wish the daemon to start automatically, see the instructions in
Section~\ref{s:xend}. Once the daemon is running, you can use the
\path{xm} tool to monitor and maintain the domains running on your
system. This chapter provides only a brief tutorial. We provide full
details of the \path{xm} tool in the next chapter.

% \section{From the web interface}
%
% Boot the Xen machine and start Xensv (see Chapter~\ref{cha:xensv}
% for more details) using the command: \\
% \verb_# xensv start_ \\
% This will also start Xend (see Chapter~\ref{cha:xend} for more
% information).
%
% The domain management interface will then be available at {\tt
%   http://your\_machine:8080/}.  This provides a user friendly wizard
% for starting domains and functions for managing running domains.
%
% \section{From the command line}
\section{Booting Guest Domains}

\subsection{Creating a Domain Configuration File}

Before you can start an additional domain, you must create a
configuration file. We provide two example files which you can use as
a starting point:
\begin{itemize}
\item \path{/etc/xen/xmexample1} is a simple template configuration
  file for describing a single VM\@.
\item \path{/etc/xen/xmexample2} file is a template description that
  is intended to be reused for multiple virtual machines.  Setting the
  value of the \path{vmid} variable on the \path{xm} command line
  fills in parts of this template.
\end{itemize}

Copy one of these files and edit it as appropriate.  Typical values
you may wish to edit include:

\begin{quote}
\begin{description}
\item[kernel] Set this to the path of the kernel you compiled for use
  with Xen (e.g.\ \path{kernel = ``/boot/vmlinuz-2.6-xenU''})
\item[memory] Set this to the size of the domain's memory in megabytes
  (e.g.\ \path{memory = 64})
\item[disk] Set the first entry in this list to calculate the offset
  of the domain's root partition, based on the domain ID\@.  Set the
  second to the location of \path{/usr} if you are sharing it between
  domains (e.g.\ \path{disk = ['phy:your\_hard\_drive\%d,sda1,w' \%
    (base\_partition\_number + vmid),
    'phy:your\_usr\_partition,sda6,r' ]}
\item[dhcp] Uncomment the dhcp variable, so that the domain will
  receive its IP address from a DHCP server (e.g.\ \path{dhcp=``dhcp''})
\end{description}
\end{quote}

You may also want to edit the {\bf vif} variable in order to choose
the MAC address of the virtual ethernet interface yourself.  For
example:

\begin{quote}
\verb_vif = ['mac=00:16:3E:F6:BB:B3']_
\end{quote}
If you do not set this variable, \xend\ will automatically generate a
random MAC address from the range 00:16:3E:xx:xx:xx, assigned by IEEE to
XenSource as an OUI (organizationally unique identifier).  XenSource
Inc. gives permission for anyone to use addresses randomly allocated
from this range for use by their Xen domains.

For a list of IEEE OUI assignments, see \newline
{\tt http://standards.ieee.org/regauth/oui/oui.txt}.


\subsection{Booting the Guest Domain}

The \path{xm} tool provides a variety of commands for managing
domains.  Use the \path{create} command to start new domains. Assuming
you've created a configuration file \path{myvmconf} based around
\path{/etc/xen/xmexample2}, to start a domain with virtual machine
ID~1 you should type:

\begin{quote}
\begin{verbatim}
# xm create -c myvmconf vmid=1
\end{verbatim}
\end{quote}

The \path{-c} switch causes \path{xm} to turn into the domain's
console after creation.  The \path{vmid=1} sets the \path{vmid}
variable used in the \path{myvmconf} file.

You should see the console boot messages from the new domain appearing
in the terminal in which you typed the command, culminating in a login
prompt.

\subsection{Example: ttylinux}

Ttylinux is a very small Linux distribution, designed to require very
few resources.  We will use it as a concrete example of how to start a
Xen domain.  Most users will probably want to install a full-featured
distribution once they have mastered the basics\footnote{ttylinux is
  the distribution's home page: {\tt
    http://www.minimalinux.org/ttylinux/}}.

\begin{enumerate}
\item Download and extract the ttylinux disk image from the Files
  section of the project's SourceForge site (see
  \path{http://sf.net/projects/xen/}).
\item Create a configuration file like the following:
  \begin{quote}
\begin{verbatim}
kernel = "/boot/vmlinuz-2.6-xenU"
memory = 64
name = "ttylinux"
nics = 1
ip = "1.2.3.4"
disk = ['file:/path/to/ttylinux/rootfs,sda1,w']
root = "/dev/sda1 ro"
\end{verbatim}    
  \end{quote}
\item Now start the domain and connect to its console:
  \begin{quote}
\begin{verbatim}
xm create configfile -c
\end{verbatim}
  \end{quote}
\item Login as root, password root.
\end{enumerate}