Statistics
| Branch: | Tag: | Revision:

root / docs / usage.rst @ 56884b64

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