Image Format

Version 28 (Nikos Skalkotos, 11/24/2011 06:25 pm)

1 1 Nikos Skalkotos
h1. Image Format
2 1 Nikos Skalkotos
3 9 Constantinos Venetsanopoulos
The image format (@img_format@) is a required OS Provider parameter and snf-image will complain if not found
4 13 Nikos Skalkotos
Right now we support 4 different types of image formats:
5 8 Constantinos Venetsanopoulos
* @extdump@
6 8 Constantinos Venetsanopoulos
* @ntfsdump@
7 1 Nikos Skalkotos
* @diskdump@
8 13 Nikos Skalkotos
* @custom@ _(unstable)_
9 1 Nikos Skalkotos
10 13 Nikos Skalkotos
h2. extdump & ntfsdump image formats
11 4 Nikos Skalkotos
12 4 Nikos Skalkotos
Those two formats are raw copies (using dd) of partitions hosting Linux systems on ext{2,3,4} and Windows systems on ntfs filesystems respectively.
13 4 Nikos Skalkotos
14 5 Nikos Skalkotos
Partitions hosting a Windows or Linux system that are suitable for dumping should have the following properties:
15 1 Nikos Skalkotos
* Be the first partition in the filesystem
16 5 Nikos Skalkotos
* The OS they host should not depend on any other partitions
17 1 Nikos Skalkotos
* Start at sector 2048
18 13 Nikos Skalkotos
* Have a bootloader installed in the boot sector of the partition (not MBR)
19 5 Nikos Skalkotos
* Have the root device in /etc/fstab specified in a persistent way, using UUID or LABEL (for extdump only)
20 3 Nikos Skalkotos
21 4 Nikos Skalkotos
h3. Known Issues
22 1 Nikos Skalkotos
23 1 Nikos Skalkotos
* For linux systems, having grub installed in the partition is fragile and things can go wrong when resizing the partitions, especially when shrinking.
24 3 Nikos Skalkotos
* Swap space is not supported.
25 3 Nikos Skalkotos
* More complicated partition schemes are not supported.
26 3 Nikos Skalkotos
27 13 Nikos Skalkotos
h2. diskdump image format
28 1 Nikos Skalkotos
29 7 Nikos Skalkotos
Diskdump is a newer format that overcomes most of the aforementioned issues. This format is a raw copy (dd) of a whole disk.
30 1 Nikos Skalkotos
31 7 Nikos Skalkotos
This design decision has the following benefits:
32 5 Nikos Skalkotos
* Swap partitions are supported
33 5 Nikos Skalkotos
* The system may use multiple partitions:
34 5 Nikos Skalkotos
** dedicated partitions for /boot, /home etc in linux
35 5 Nikos Skalkotos
** system and boot partition in Windows
36 7 Nikos Skalkotos
* There are no restrictions on starting sectors of partitions
37 5 Nikos Skalkotos
38 8 Constantinos Venetsanopoulos
Although diskdump is a lot more flexible than the older formats, there are still some rules to follow:
39 5 Nikos Skalkotos
* All devices in fstab should be specified by persistent names (UUID or LABEL)
40 1 Nikos Skalkotos
* LVMs and extended partitions should be avoided.
41 6 Nikos Skalkotos
** The support for extended partitions is partial. snf-image does not support resizing logical partitions.
42 1 Nikos Skalkotos
** Logical volumes are not supported at all
43 1 Nikos Skalkotos
* In Linux disks only ext{2,3,4} filesystems are supported
44 1 Nikos Skalkotos
45 19 Nikos Skalkotos
h2. custom image format
46 6 Nikos Skalkotos
47 24 Nikos Skalkotos
For now, a custom image is a diskdump image whose @img_id@ OS Parameter (see [[:#Ganeti-OS-Interface|Ganeti OS Interface]]) is a URL that points to the image file. *For now, the use of this format is discouraged because it may change in the near future.*
48 13 Nikos Skalkotos
49 13 Nikos Skalkotos
h2. Image Properties
50 13 Nikos Skalkotos
51 23 Nikos Skalkotos
In order for snf-image to be able to properly configure an image, it may make use of a set of image properties. Those image properties are passed to snf-image by Ganeti through the @img_poroperties@ OS parameter (see [[:#Ganeti-OS-Interface|Ganeti OS Interface]]). For the @diskdump@ format some properties are *mandatory*. For {ext,ntfs}dump formats all image properties are optional.
52 1 Nikos Skalkotos
53 10 Nikos Skalkotos
A list of mandatory and optional properties follows:
54 16 Nikos Skalkotos
* Mandatory properties (@diskdump@ only)
55 1 Nikos Skalkotos
** *OSFAMILY={linux,windows}*
56 1 Nikos Skalkotos
This specifies whether the image is a Linux or a Windows Image. {ext,ntfs}dump formats are self descriptive regarding this property.
57 1 Nikos Skalkotos
** *ROOT_PARTITION={1,2,3,4}*
58 13 Nikos Skalkotos
This specifies the partition number of the root partition. As mentioned earlier, for now, only primary partitions are supported. This property is trivial for {ext,ntfs}dump formats (they only host one partition).
59 10 Nikos Skalkotos
* Optional properties
60 10 Nikos Skalkotos
** *USERS="username1 username2...."*
61 25 Nikos Skalkotos
This is a space-seperated list of users, whose password will be reset by snf-image. If this is missing then the users are chosen according to a set of rules, but please do not depend on this. Those rules may change or even be dropped in the future. Do directly specify the @USERS@ list, just to be on the safe side. 
62 13 Nikos Skalkotos
The rules we currently use are listed below:
63 13 Nikos Skalkotos
*** For Windows images, the @Administrator@'s password is reset.
64 13 Nikos Skalkotos
*** For Linux images, the root password is reset for all distribution. If @snf-image@ detects the system as a Fedora or an Ubuntu Linux, then it also resets the password of the user with username @user@.
65 21 Nikos Skalkotos
66 28 Nikos Skalkotos
If this property is defined with a value other than _null_, then during the deployment, the image will not be configured at all. This is really handy because it gives the ability to deploy images hosting operating systems whose configuration is not supported by @snf-image@.
67 26 Nikos Skalkotos
** *EXCLUDE_<name_of_a_task>_TASK*
68 28 Nikos Skalkotos
This family of properties gives the ability to exclude individual configuration tasks from running. Hence, if the property @EXCLUDE_DeleteSSHKeys_TASK@ with a value other than _null_ is passed to @snf-image@, the aforementioned configuration step will not be executed, and the SSH Keys found in the image will not be removed during the deployment. Task exclusion provides great flexibility, but it needs to be used with great care. Tasks depend on each other and although those dependencies are well documented, automatic task dependency resolution isn't yet supported in @snf-image@. If you exclude task A but not task B which depends on A, you will probably end up with an unsuccessful deployment because B will fail and exit in an abnormal way. You can read more about configuration tasks [[Configuration Tasks|here]].
69 8 Constantinos Venetsanopoulos
70 11 Nikos Skalkotos
-All image properties are passed to snf-image through the @img_properties@ OS parameter. The @img_properties@ parameter is *mandatory* when trying to deploy an image of @diskdump@ format. @img_properties@ should be a json file dumped as a string. When trying to deploy an image of type @{ext,ntfs}dump@ then @img_properties@ are not necessary.-