Statistics
| Branch: | Tag: | Revision:

root / docs / usage.rst @ c71f38be

History | View | Annotate | Download (14.3 kB)

1 f0b21d37 Nikos Skalkotos
Usage
2 fa77d79a Nikos Skalkotos
^^^^^
3 f0b21d37 Nikos Skalkotos
4 f0b21d37 Nikos Skalkotos
snf-image-creator comes in 2 variants:
5 4197b5a6 Nikos Skalkotos
6 f0b21d37 Nikos Skalkotos
 * snf-image-creator: A non-interactive command line program
7 c8025360 Nikos Skalkotos
 * snf-mkimage: A user-friendly dialog-based program
8 c8025360 Nikos Skalkotos
9 4197b5a6 Nikos Skalkotos
Both expect the input media as first argument. The input media may be a local
10 4197b5a6 Nikos Skalkotos
file, a block device or *"/"* if you want to create an image out of the running
11 4197b5a6 Nikos Skalkotos
system (see `host bundling operation`_).
12 4197b5a6 Nikos Skalkotos
13 c8025360 Nikos Skalkotos
Non-interactive version
14 fa77d79a Nikos Skalkotos
=======================
15 c8025360 Nikos Skalkotos
16 c8025360 Nikos Skalkotos
snf-image-creator receives the following options:
17 c8025360 Nikos Skalkotos
18 c8025360 Nikos Skalkotos
.. code-block:: console
19 c8025360 Nikos Skalkotos
20 b0ddf192 Nikos Skalkotos
   $ snf-image-creator --help
21 b0ddf192 Nikos Skalkotos
   Usage: snf-image-creator [options] <input_media>
22 b0ddf192 Nikos Skalkotos
   
23 b0ddf192 Nikos Skalkotos
   Options:
24 b0ddf192 Nikos Skalkotos
     --version             show program's version number and exit
25 b0ddf192 Nikos Skalkotos
     -h, --help            show this help message and exit
26 b0ddf192 Nikos Skalkotos
     -o FILE, --outfile=FILE
27 b0ddf192 Nikos Skalkotos
                           dump image to FILE
28 b0ddf192 Nikos Skalkotos
     -f, --force           overwrite output files if they exist
29 b0ddf192 Nikos Skalkotos
     -s, --silent          output only errors
30 b0ddf192 Nikos Skalkotos
     -u FILENAME, --upload=FILENAME
31 ffc64d7c Nikos Skalkotos
                           upload the image to the storage service with name FILENAME
32 b0ddf192 Nikos Skalkotos
     -r IMAGENAME, --register=IMAGENAME
33 ffc64d7c Nikos Skalkotos
                           register the image with the compute service as IMAGENAME
34 b0ddf192 Nikos Skalkotos
     -m KEY=VALUE, --metadata=KEY=VALUE
35 b0ddf192 Nikos Skalkotos
                           add custom KEY=VALUE metadata to the image
36 b0ddf192 Nikos Skalkotos
     -t TOKEN, --token=TOKEN
37 b0ddf192 Nikos Skalkotos
                           use this authentication token when
38 b0ddf192 Nikos Skalkotos
                           uploading/registering images
39 b0ddf192 Nikos Skalkotos
     -a URL, --authentication-url=URL
40 b0ddf192 Nikos Skalkotos
                           use this authentication URL when uploading/registering
41 b0ddf192 Nikos Skalkotos
                           images
42 b0ddf192 Nikos Skalkotos
     -c CLOUD, --cloud=CLOUD
43 b0ddf192 Nikos Skalkotos
                           use this saved cloud account to authenticate against a
44 b0ddf192 Nikos Skalkotos
                           cloud when uploading/registering images
45 b0ddf192 Nikos Skalkotos
     --print-sysprep       print the enabled and disabled system preparation
46 b0ddf192 Nikos Skalkotos
                           operations for this input media
47 b0ddf192 Nikos Skalkotos
     --enable-sysprep=SYSPREP
48 b0ddf192 Nikos Skalkotos
                           run SYSPREP operation on the input media
49 b0ddf192 Nikos Skalkotos
     --disable-sysprep=SYSPREP
50 b0ddf192 Nikos Skalkotos
                           prevent SYSPREP operation from running on the input
51 b0ddf192 Nikos Skalkotos
                           media
52 b0ddf192 Nikos Skalkotos
     --no-sysprep          don't perform any system preparation operation
53 b0ddf192 Nikos Skalkotos
     --no-shrink           don't shrink any partition
54 ffc64d7c Nikos Skalkotos
     --public              register image with the compute service as public
55 b0ddf192 Nikos Skalkotos
     --tmpdir=DIR          create large temporary image files under DIR
56 4197b5a6 Nikos Skalkotos
57 4197b5a6 Nikos Skalkotos
Most input options are self-describing. If you want to save a local copy of
58 8c7d7b90 Nikos Skalkotos
the image you create, provide a filename using the *-o* option. To upload the
59 ffc64d7c Nikos Skalkotos
image to the storage service of a cloud, provide valid cloud API access info
60 ffc64d7c Nikos Skalkotos
(by either using a token and a URL with *-t* and *-a* respectively, or a cloud
61 ffc64d7c Nikos Skalkotos
name with *-c*) and a remote filename using *-u*. If you also want to register
62 ffc64d7c Nikos Skalkotos
the image with the compute service of the cloud, in addition to *-u* provide a
63 ffc64d7c Nikos Skalkotos
registration name using *-r*. All images are
64 ccb6b943 Nikos Skalkotos
registered as *private*. Only the user that registers the image can create
65 ccb6b943 Nikos Skalkotos
VM's out of it. If you want the image to be visible by other user too, use the
66 ccb6b943 Nikos Skalkotos
*--public* option.
67 8c7d7b90 Nikos Skalkotos
68 8c7d7b90 Nikos Skalkotos
By default, before extracting the image, snf-image-creator will perform a
69 8c7d7b90 Nikos Skalkotos
number of system preparation operations on the snapshot of the media and will
70 8c7d7b90 Nikos Skalkotos
shrink the last partition found. Both actions can be disabled by specifying
71 fa77d79a Nikos Skalkotos
*--no-sysprep* and *--no-shrink* respectively.
72 c8025360 Nikos Skalkotos
73 4197b5a6 Nikos Skalkotos
If *--print-sysprep* is defined, the program will exit after printing a
74 8a40ba3c Alex Pyrgiotis
list of enabled and disabled system preparation operation applicable to this
75 8c7d7b90 Nikos Skalkotos
input media. The user can enable or disable specific *syspreps*, using
76 8c7d7b90 Nikos Skalkotos
*-{enable,disable}-sysprep* options. The user may specify those options
77 8c7d7b90 Nikos Skalkotos
multiple times.
78 c8025360 Nikos Skalkotos
79 c8025360 Nikos Skalkotos
Running *snf-image-creator* with *--print-sysprep* on a raw file that hosts a
80 4197b5a6 Nikos Skalkotos
debian system, we print the following output:
81 c8025360 Nikos Skalkotos
82 9de17202 Alex Pyrgiotis
.. _sysprep:
83 9de17202 Alex Pyrgiotis
84 c8025360 Nikos Skalkotos
.. code-block:: console
85 c8025360 Nikos Skalkotos
86 b0ddf192 Nikos Skalkotos
   $ snf-image-creator --print-sysprep ubuntu.raw
87 b0ddf192 Nikos Skalkotos
   snf-image-creator 0.3
88 c8025360 Nikos Skalkotos
   =====================
89 b0ddf192 Nikos Skalkotos
   Examining source media `ubuntu_hd.raw' ... looks like an image file
90 b0ddf192 Nikos Skalkotos
   Snapshotting media source ... done
91 c8025360 Nikos Skalkotos
   Enabling recovery proc
92 b0ddf192 Nikos Skalkotos
   Launching helper VM (may take a while) ... done
93 b0ddf192 Nikos Skalkotos
   Inspecting Operating System ... ubuntu
94 b0ddf192 Nikos Skalkotos
   Mounting the media read-only ... done
95 b0ddf192 Nikos Skalkotos
   Collecting image metadata ... done
96 b0ddf192 Nikos Skalkotos
   Umounting the media ... done
97 b0ddf192 Nikos Skalkotos
   
98 c8025360 Nikos Skalkotos
   Enabled system preparation operations:
99 c8025360 Nikos Skalkotos
       cleanup-cache:
100 b0ddf192 Nikos Skalkotos
           Remove all regular files under /var/cache
101 b0ddf192 Nikos Skalkotos
   
102 c8025360 Nikos Skalkotos
       cleanup-log:
103 b0ddf192 Nikos Skalkotos
           Empty all files under /var/log
104 b0ddf192 Nikos Skalkotos
   
105 c8025360 Nikos Skalkotos
       cleanup-passwords:
106 b0ddf192 Nikos Skalkotos
           Remove all passwords and lock all user accounts
107 b0ddf192 Nikos Skalkotos
   
108 c8025360 Nikos Skalkotos
       cleanup-tmp:
109 b0ddf192 Nikos Skalkotos
           Remove all files under /tmp and /var/tmp
110 b0ddf192 Nikos Skalkotos
   
111 c8025360 Nikos Skalkotos
       cleanup-userdata:
112 b0ddf192 Nikos Skalkotos
           Delete sensitive userdata
113 b0ddf192 Nikos Skalkotos
   
114 c8025360 Nikos Skalkotos
       fix-acpid:
115 b0ddf192 Nikos Skalkotos
           Replace acpid powerdown action scripts to immediately shutdown the
116 b0ddf192 Nikos Skalkotos
           system without checking if a GUI is running.
117 b0ddf192 Nikos Skalkotos
   
118 c8025360 Nikos Skalkotos
       remove-persistent-net-rules:
119 b0ddf192 Nikos Skalkotos
           Remove udev rules that will keep network interface names persistent
120 b0ddf192 Nikos Skalkotos
           after hardware changes and reboots. Those rules will be created again
121 b0ddf192 Nikos Skalkotos
           the next time the image runs.
122 b0ddf192 Nikos Skalkotos
   
123 c8025360 Nikos Skalkotos
       remove-swap-entry:
124 b0ddf192 Nikos Skalkotos
           Remove swap entry from /etc/fstab. If swap is the last partition
125 b0ddf192 Nikos Skalkotos
           then the partition will be removed when shrinking is performed. If the
126 b0ddf192 Nikos Skalkotos
           swap partition is not the last partition in the disk or if you are not
127 b0ddf192 Nikos Skalkotos
           going to shrink the image you should probably disable this.
128 b0ddf192 Nikos Skalkotos
   
129 c8025360 Nikos Skalkotos
       use-persistent-block-device-names:
130 b0ddf192 Nikos Skalkotos
           Scan fstab & grub configuration files and replace all non-persistent
131 b0ddf192 Nikos Skalkotos
           device references with UUIDs.
132 b0ddf192 Nikos Skalkotos
   
133 c8025360 Nikos Skalkotos
   Disabled system preparation operations:
134 c8025360 Nikos Skalkotos
       cleanup-mail:
135 b0ddf192 Nikos Skalkotos
           Remove all files under /var/mail and /var/spool/mail
136 b0ddf192 Nikos Skalkotos
   
137 c8025360 Nikos Skalkotos
       remove-user-accounts:
138 b0ddf192 Nikos Skalkotos
           Remove all user accounts with id greater than 1000
139 b0ddf192 Nikos Skalkotos
   
140 b0ddf192 Nikos Skalkotos
   
141 b0ddf192 Nikos Skalkotos
   cleaning up ...
142 c8025360 Nikos Skalkotos
143 4197b5a6 Nikos Skalkotos
If you want the image to have all normal user accounts and all mail files
144 4197b5a6 Nikos Skalkotos
removed, you should use *--enable-sysprep* option like this:
145 c8025360 Nikos Skalkotos
146 c8025360 Nikos Skalkotos
.. code-block:: console
147 c8025360 Nikos Skalkotos
148 3f4e2409 Nikos Skalkotos
   $ snf-image-creator --enable-sysprep cleanup-mail --enable-sysprep remove-user-accounts ...
149 c8025360 Nikos Skalkotos
150 c8025360 Nikos Skalkotos
Dialog-based version
151 fa77d79a Nikos Skalkotos
====================
152 c8025360 Nikos Skalkotos
153 fa77d79a Nikos Skalkotos
*snf-mkimage* receives the following options:
154 fa77d79a Nikos Skalkotos
155 fa77d79a Nikos Skalkotos
.. code-block:: console
156 fa77d79a Nikos Skalkotos
157 4197b5a6 Nikos Skalkotos
 $ snf-mkimage --help
158 4197b5a6 Nikos Skalkotos
 Usage: snf-mkimage [options] [<input_media>]
159 fa77d79a Nikos Skalkotos
160 4197b5a6 Nikos Skalkotos
 Options:
161 4197b5a6 Nikos Skalkotos
   --version             show program's version number and exit
162 4197b5a6 Nikos Skalkotos
   -h, --help            show this help message and exit
163 4197b5a6 Nikos Skalkotos
   -l FILE, --logfile=FILE
164 4197b5a6 Nikos Skalkotos
                         log all messages to FILE
165 4197b5a6 Nikos Skalkotos
   --tmpdir=DIR          create large temporary image files under DIR
166 fa77d79a Nikos Skalkotos
167 3f4e2409 Nikos Skalkotos
If the input media is not specified in the command line, in the first dialog
168 4197b5a6 Nikos Skalkotos
box the user will be asked to specify it:
169 4197b5a6 Nikos Skalkotos
170 4197b5a6 Nikos Skalkotos
.. image:: /snapshots/select_media.png
171 4197b5a6 Nikos Skalkotos
172 4197b5a6 Nikos Skalkotos
The user can select a file (regular or block device) or use the *Bundle Host*
173 4197b5a6 Nikos Skalkotos
button to create an image out of the running system (see
174 4197b5a6 Nikos Skalkotos
`Host bundling operation`_).
175 4197b5a6 Nikos Skalkotos
176 4197b5a6 Nikos Skalkotos
After the input media is examined and the program is initialized, the user will
177 4197b5a6 Nikos Skalkotos
be given the choice to run *snf-mkimage* in *wizard* or *expert* mode.
178 fa77d79a Nikos Skalkotos
179 fa77d79a Nikos Skalkotos
Wizard mode
180 fa77d79a Nikos Skalkotos
-----------
181 fa77d79a Nikos Skalkotos
182 fa77d79a Nikos Skalkotos
When *snf-mkimage* runs in *wizard* mode, the user is just asked to provide the
183 fa77d79a Nikos Skalkotos
following basic information:
184 fa77d79a Nikos Skalkotos
185 b0ddf192 Nikos Skalkotos
 * Cloud: The cloud account to use to upload and register the resulting image
186 b28209d9 Alex Pyrgiotis
 * Name: A short name for the image (ex. "Slackware")
187 4197b5a6 Nikos Skalkotos
 * Description: An one-line description for the image
188 4197b5a6 Nikos Skalkotos
   (ex. "Slackware Linux 14.0 with KDE")
189 ccb6b943 Nikos Skalkotos
 * Registration Type: Private or Public
190 fa77d79a Nikos Skalkotos
191 ffc64d7c Nikos Skalkotos
After confirming, the image will be extracted, uploaded to the storage service
192 ffc64d7c Nikos Skalkotos
and registered with the compute service of the selected cloud. The user will
193 ffc64d7c Nikos Skalkotos
also be given the choice to keep a local copy of it.
194 4197b5a6 Nikos Skalkotos
195 4197b5a6 Nikos Skalkotos
For most users the functionality this mode provides should be sufficient.
196 fa77d79a Nikos Skalkotos
197 fa77d79a Nikos Skalkotos
Expert mode
198 fa77d79a Nikos Skalkotos
-----------
199 fa77d79a Nikos Skalkotos
200 fa77d79a Nikos Skalkotos
Expert mode allows the user to have better control on the image creation
201 8c7d7b90 Nikos Skalkotos
process. The main menu can be seen in the picture below:
202 fa77d79a Nikos Skalkotos
203 fa77d79a Nikos Skalkotos
.. image:: /snapshots/main_menu.png
204 fa77d79a Nikos Skalkotos
205 3f4e2409 Nikos Skalkotos
In the *Customize* sub-menu the user can control:
206 fa77d79a Nikos Skalkotos
207 3f4e2409 Nikos Skalkotos
 * The system preparation operations that will be applied on the media
208 fa77d79a Nikos Skalkotos
 * Whether the image will be shrunk or not
209 fa77d79a Nikos Skalkotos
 * The properties associated with the image
210 3f4e2409 Nikos Skalkotos
 * The configuration tasks that will run during image deployment
211 fa77d79a Nikos Skalkotos
212 3f4e2409 Nikos Skalkotos
In the *Register* sub-menu the user can provide:
213 fa77d79a Nikos Skalkotos
214 b0ddf192 Nikos Skalkotos
 * Which cloud account to use
215 ffc64d7c Nikos Skalkotos
 * A filename for the uploaded *diskdump* image
216 ffc64d7c Nikos Skalkotos
 * A name for the image to use when registering it with the storage service of
217 ffc64d7c Nikos Skalkotos
   the cloud, as well as the registration type (*private* or *public*)
218 fa77d79a Nikos Skalkotos
219 4197b5a6 Nikos Skalkotos
By choosing the *Extract* menu entry, the user can dump the image to the local
220 4197b5a6 Nikos Skalkotos
file system. Finally, if the user selects *Reset*, the system will ignore
221 fa77d79a Nikos Skalkotos
all changes made so far and will start the image creation process again.
222 9de17202 Alex Pyrgiotis
223 4197b5a6 Nikos Skalkotos
Host bundling operation
224 4197b5a6 Nikos Skalkotos
=======================
225 4197b5a6 Nikos Skalkotos
226 4197b5a6 Nikos Skalkotos
As a new feature in *v0.2*, snf-image-creator can create images out of the host
227 4197b5a6 Nikos Skalkotos
system that runs the program. This is done either by specifying / as input
228 4197b5a6 Nikos Skalkotos
media or by using the *Bundle Host* button in the media selection dialog of
229 4197b5a6 Nikos Skalkotos
snf-mkimage. During this operation, the files of the disk are copied into a
230 4197b5a6 Nikos Skalkotos
temporary image file, which means that the file system that will host the
231 5aa25240 Nikos Skalkotos
temporary image needs to have a lot of free space (see `large temporary files`_
232 4197b5a6 Nikos Skalkotos
for more information).
233 4197b5a6 Nikos Skalkotos
234 1e72da95 Alex Pyrgiotis
Creating a new image
235 1e72da95 Alex Pyrgiotis
====================
236 9de17202 Alex Pyrgiotis
237 1e72da95 Alex Pyrgiotis
Suppose you want to create a new Ubuntu server image. Download the installation
238 1e72da95 Alex Pyrgiotis
disk from the Internet:
239 9de17202 Alex Pyrgiotis
240 1e72da95 Alex Pyrgiotis
.. code-block:: console
241 9de17202 Alex Pyrgiotis
242 ccb6b943 Nikos Skalkotos
   $ wget http://ubuntureleases.tsl.gr/12.04.2/ubuntu-12.04.2-server-amd64.iso
243 9de17202 Alex Pyrgiotis
244 1e72da95 Alex Pyrgiotis
Verify that it has been downloaded correctly:
245 9de17202 Alex Pyrgiotis
246 1e72da95 Alex Pyrgiotis
.. code-block:: console
247 9de17202 Alex Pyrgiotis
248 ccb6b943 Nikos Skalkotos
   $ echo 'a8c667e871f48f3a662f3fbf1c3ddb17  ubuntu-12.04.2-server-amd64.iso' > check.md5
249 9de17202 Alex Pyrgiotis
   $ md5sum -c check.md5
250 9de17202 Alex Pyrgiotis
251 b39357a8 Alex Pyrgiotis
Create a 2G sparse file to host the new system:
252 9de17202 Alex Pyrgiotis
253 1e72da95 Alex Pyrgiotis
.. code-block:: console
254 9de17202 Alex Pyrgiotis
255 b0ddf192 Nikos Skalkotos
   $ truncate -s 2G ubuntu.raw
256 9de17202 Alex Pyrgiotis
257 1e72da95 Alex Pyrgiotis
And install the Ubuntu system on this file:
258 9de17202 Alex Pyrgiotis
259 1e72da95 Alex Pyrgiotis
.. code-block:: console
260 9de17202 Alex Pyrgiotis
261 b0ddf192 Nikos Skalkotos
   $ sudo kvm -boot d -drive file=ubuntu.raw,format=raw,cache=none,if=virtio \
262 ccb6b943 Nikos Skalkotos
     -m 1G -cdrom ubuntu-12.04.2-server-amd64.iso
263 9de17202 Alex Pyrgiotis
264 4197b5a6 Nikos Skalkotos
.. warning::
265 9de17202 Alex Pyrgiotis
266 4197b5a6 Nikos Skalkotos
   During the installation, you will be asked about the partition scheme. Don't 
267 4197b5a6 Nikos Skalkotos
   use LVM partitions. They are not supported by snf-image-creator.
268 9de17202 Alex Pyrgiotis
269 8c7d7b90 Nikos Skalkotos
You will be able to boot your installed OS and make any changes you want
270 1e72da95 Alex Pyrgiotis
(e.g. install openssh-server) using the following command::
271 9de17202 Alex Pyrgiotis
272 b0ddf192 Nikos Skalkotos
   $ sudo kvm -m 1G -boot c -drive file=ubuntu.raw,format=raw,cache=none,if=virtio
273 9de17202 Alex Pyrgiotis
274 4197b5a6 Nikos Skalkotos
After you're done, you may use *snf-mkimage* as root to create and upload the
275 1e72da95 Alex Pyrgiotis
image:
276 9de17202 Alex Pyrgiotis
277 1e72da95 Alex Pyrgiotis
.. code-block:: console
278 9de17202 Alex Pyrgiotis
279 1e72da95 Alex Pyrgiotis
   $ sudo -s
280 b0ddf192 Nikos Skalkotos
   $ snf-mkimage ubuntu.raw
281 9de17202 Alex Pyrgiotis
282 1e72da95 Alex Pyrgiotis
In the first screen you will be asked to choose if you want to run the program
283 1e72da95 Alex Pyrgiotis
in *Wizard* or *Expert* mode. Choose *Wizard*.
284 9de17202 Alex Pyrgiotis
285 ccb6b943 Nikos Skalkotos
.. image:: /snapshots/wizard.png
286 9de17202 Alex Pyrgiotis
287 ffc64d7c Nikos Skalkotos
Then you will be asked to select a cloud and provide a name, a description and
288 ffc64d7c Nikos Skalkotos
a registration type (*private* or *public*). Finally, you'll be asked to
289 ffc64d7c Nikos Skalkotos
confirm the provided data.
290 9de17202 Alex Pyrgiotis
291 ccb6b943 Nikos Skalkotos
.. image:: /snapshots/confirm.png
292 9de17202 Alex Pyrgiotis
293 ffc64d7c Nikos Skalkotos
Choosing *YES* will create and upload the image to your cloud account.
294 9de17202 Alex Pyrgiotis
295 5aa25240 Nikos Skalkotos
Limitations
296 5aa25240 Nikos Skalkotos
===========
297 5aa25240 Nikos Skalkotos
298 5aa25240 Nikos Skalkotos
Supported operating systems
299 5aa25240 Nikos Skalkotos
---------------------------
300 5aa25240 Nikos Skalkotos
301 5aa25240 Nikos Skalkotos
*snf-image-creator* can only fully function on input media hosting *Linux*
302 5aa25240 Nikos Skalkotos
systems. The program will detect the needed metadata and you may use it to
303 5aa25240 Nikos Skalkotos
upload and register other *Unix* or *Windows* images, but you cannot use it to
304 5aa25240 Nikos Skalkotos
shrink them or perform system preparation operations.
305 5aa25240 Nikos Skalkotos
306 5aa25240 Nikos Skalkotos
Logical Volumes
307 5aa25240 Nikos Skalkotos
---------------
308 5aa25240 Nikos Skalkotos
309 5aa25240 Nikos Skalkotos
The program cannot work on LVM partitions [#f1]_. The input media may only
310 5aa25240 Nikos Skalkotos
contain primary or logical partitions.
311 9de17202 Alex Pyrgiotis
312 1e72da95 Alex Pyrgiotis
Para-virtualized drivers
313 1e72da95 Alex Pyrgiotis
------------------------
314 9de17202 Alex Pyrgiotis
315 ffc64d7c Nikos Skalkotos
Most synnefo deployments uses the *VirtIO* framework. The disk I/O controller
316 ffc64d7c Nikos Skalkotos
and the Ethernet cards on the VM instances are para-virtualized and need
317 ffc64d7c Nikos Skalkotos
special *VirtIO* drivers. Those drivers are included in the Linux Kernel
318 ffc64d7c Nikos Skalkotos
mainline since version 2.6.25 and are shipped with all the popular Linux
319 ffc64d7c Nikos Skalkotos
distributions. The problem is that if the driver for the para-virtualized disk
320 ffc64d7c Nikos Skalkotos
I/O controller is built as module, it needs to be preloaded using an initial
321 ffc64d7c Nikos Skalkotos
ramdisk, otherwise the VM won't be able to boot.
322 9de17202 Alex Pyrgiotis
323 8c7d7b90 Nikos Skalkotos
Many popular Linux distributions, like Ubuntu and Debian, will automatically
324 4197b5a6 Nikos Skalkotos
create a generic initial ramdisk file that contains many different modules,
325 4197b5a6 Nikos Skalkotos
including the VirtIO drivers. Others that target more experienced users, like
326 5aa25240 Nikos Skalkotos
Slackware, won't do that [#f2]_. *snf-image-creator* cannot resolve this kind
327 4197b5a6 Nikos Skalkotos
of problems and it's left to the user to do so. Please refer to your
328 4197b5a6 Nikos Skalkotos
distribution's documentation for more information on this. You can always check
329 4197b5a6 Nikos Skalkotos
if a system can boot with para-virtualized disk controller by launching it with
330 8c7d7b90 Nikos Skalkotos
kvm using the *if=virtio* option (see the kvm command in the
331 4197b5a6 Nikos Skalkotos
`Creating a new image`_ section).
332 4197b5a6 Nikos Skalkotos
333 5aa25240 Nikos Skalkotos
Some caveats on image creation
334 5aa25240 Nikos Skalkotos
==============================
335 5aa25240 Nikos Skalkotos
336 4197b5a6 Nikos Skalkotos
Image partition schemes and shrinking
337 4197b5a6 Nikos Skalkotos
-------------------------------------
338 4197b5a6 Nikos Skalkotos
339 4197b5a6 Nikos Skalkotos
When image shrinking is enabled, *snf-image-creator* will shrink the last
340 4197b5a6 Nikos Skalkotos
partition on the disk. If this is a swap partition, it will remove it, save
341 4197b5a6 Nikos Skalkotos
enough information to recreate it during image deployment and shrink the
342 4197b5a6 Nikos Skalkotos
partition that lays just before that. This will make the image smaller which
343 4197b5a6 Nikos Skalkotos
speeds up the deployment process.
344 4197b5a6 Nikos Skalkotos
345 4197b5a6 Nikos Skalkotos
During image deployment, the last partition is enlarged to occupy the available
346 4197b5a6 Nikos Skalkotos
space in the VM's hard disk and a swap partition is added at the end if a SWAP
347 4197b5a6 Nikos Skalkotos
image property is present.
348 4197b5a6 Nikos Skalkotos
349 4197b5a6 Nikos Skalkotos
Keep this in mind when creating images. It's always better to have your swap
350 4197b5a6 Nikos Skalkotos
partition placed as the last partition on the disk and have your largest
351 4197b5a6 Nikos Skalkotos
partition (*/* or */home*) just before that.
352 4197b5a6 Nikos Skalkotos
353 5aa25240 Nikos Skalkotos
Large temporary files
354 5aa25240 Nikos Skalkotos
---------------------
355 4197b5a6 Nikos Skalkotos
356 4197b5a6 Nikos Skalkotos
*snf-image-creator* may create large temporary files when running:
357 4197b5a6 Nikos Skalkotos
358 4197b5a6 Nikos Skalkotos
 * During image shrinking, the input media snapshot file may reach the size of
359 4197b5a6 Nikos Skalkotos
   the original media.
360 8c7d7b90 Nikos Skalkotos
 * When bundling the host system, the temporary image file may became as large
361 8c7d7b90 Nikos Skalkotos
   as the rest of the disk files altogether.
362 4197b5a6 Nikos Skalkotos
363 8c7d7b90 Nikos Skalkotos
*/tmp* directory is not a good place for hosting large files. In many systems
364 4197b5a6 Nikos Skalkotos
the contents of */tmp* are stored in volatile memory and the size they may occupy
365 4197b5a6 Nikos Skalkotos
is limited. By default, *snf-image-creator* will use a heuristic approach to
366 4197b5a6 Nikos Skalkotos
determine where to store large temporary files. It will examine the free space
367 4197b5a6 Nikos Skalkotos
under */var/tmp*, the user's home directory and */mnt* and will pick the one
368 8c7d7b90 Nikos Skalkotos
with the most available space. The user may overwrite this behaviour and
369 8c7d7b90 Nikos Skalkotos
indicate a different directory using the *tmpdir* option. This option is
370 8c7d7b90 Nikos Skalkotos
supported by both *snf-image-creator* and *snf-mkimage*.
371 9de17202 Alex Pyrgiotis
372 1e72da95 Alex Pyrgiotis
.. rubric:: Footnotes
373 9de17202 Alex Pyrgiotis
374 5aa25240 Nikos Skalkotos
.. [#f1] http://sourceware.org/lvm2/
375 5aa25240 Nikos Skalkotos
.. [#f2] http://mirrors.slackware.com/slackware/slackware-14.0/README.initrd