|
setup-storage − automatically prepare storage devices |
|
setup-storage [−X] [−f filename] [−d] [−h] |
|
Using FAI disk_config files, setup-storage computes effective partition and volume sizes and executes the necessary commands to configure storage devices. It manages disk drives as well as RAID and LVM volumes. It handles all file systems supported by parted(8) as well as ntfs but is flexible enough to be extended to further types as well. Once the storage devices are prepared, an appropriate fstab(5) file is generated. Without the −X parameter setup-storage runs in test-only mode and does not execute commands other than writing disk labels to a blank disk. The exit code of setup-storage is 0 if all operations were performed successfully and non-zero if an error occurs. |
|
To enable the use of the new partioning tool setup-storage you have to set USE_SETUP_STORAGE=1 in the according class file in configspace (like /srv/fai/config/class/FAIBASE.var for example). |
|
−X |
Really write the configuration to disk. Otherwise setup-storage runs in test-only mode. |
|
−f filename |
|
Normally setup-storage selects an appropriate configuration from $FAI/disk_config/ by picking the first class from classes that has an existing file. If however −f is given the configuration in filename is used. |
|
−d |
Enable debugging output. |
|||
|
−h |
Display the synopsis and version info and exit. |
|
setup-storage will use the following environment variables: |
|
disklist |
|
The disklist variable must contain a newline separated list of disk drives available in the system. Their order matters as they may be referred to as disk1, etc. in disk_config. |
|
debug |
If debug is set to a non-zero value all actions and details to track the operation of setup-storage are printed to stderr. |
||
|
FAI |
The location of the config space to find the disk_config directory. |
|
classes |
|
The list of FAI classes to determine the appropriate configuration to choose. |
|
LOGDIR |
setup-storage generates disk_var.sh and fstab (see below) in this directory. |
|
If setup-storage executes successfully an fstab(5) file matching the specified configuration is generated as $LOGDIR/fstab. Further $LOGDIR/disk_var.sh is generated and may be sourced to get the variables SWAPLIST, ROOT_PARTITION, BOOT_PARTITION and BOOT_DEVICE. The latter two will only be set in case they reside on a disk drive. |
|
This section describes the syntax of disk_config files file ::= <lines> EOF lines ::= EOL comment ::= #.* config ::= disk_config lvm( <lvmoption>)* lvmoption ::= /* empty */ raidoption ::= /* empty */ option ::= /* empty */ volume ::= <type> <mountpoint> <size>
<filesystem> <mount_options>
<fs_options> type ::= primary mountpoint ::=
(-|swap|/[^[:space:]]*)(:encrypt(:randinit)?)? name ::= [^/[:space:]]+ size ::=
[[:digit:]]+[kMGTP%]?(-([[:digit:]]+[kMGTP%]?)?)?(:resize)? mount_options ::= [^[:space:]]+ filesystem ::= - fs_options ::=
(createopts=".*"|tuneopts=".*"|(pv|vg|lv|md)createopts=".*")* |
|
The major differences to the prior configuration syntax are: |
|
• |
The disk_config ... line allows for the keywords lvm and raid |
||
|
• |
Options may need to be appended to the disk_config line |
||
|
• |
The ";" is not used anymore, the options that were given there have now been split up |
||
|
• |
The filesystem is now an explicit parameter; note that the order of filesystem/mount-options is the same /etc/fstab as opposed to the previous format of disk_config. |
||
|
• |
Any options to mkfs.xxx may be given using createopts="". |
||
|
• |
The "preserveX" and "boot" options are one of the options now given on the disk_config line, using preserve_reinstall or preserve_always and bootable. preserve_always is equivalent to the previous preserveX option, whereas preserve_reinstall preserves the partition unless "initial" is given as one of the FAI_FLAGS. |
||
|
• |
Support for LVM and RAID is completely new |
||
|
• |
Resizing partitions and filesystems is supported |
|
Simple configuration of /dev/hda |
disk_config hda preserve_always:6,7 disklabel:msdos bootable:3
|
primary |
/boot |
20-100 |
ext3 |
rw |
||
|
primary |
swap |
1000 |
swap |
sw |
||
|
primary |
/ |
12000 |
ext3 |
rw |
createopts="−b 2048" |
|
|
logical |
/tmp |
1000 |
ext3 |
rw,nosuid |
||
|
logical |
/usr |
5000 |
ext3 |
rw |
||
|
logical |
/var |
10%- |
ext3 |
rw |
||
|
logical |
/nobackup |
0- |
xfs |
rw |
|
• |
Preserve the 6th and the 7th partition. The disklabel is msdos which is the default for x86. Furthermore the 3rd partition is made bootable. |
||
|
• |
Create a primary partition /dev/hda1 with a size between 20 and 100 MB and mount it read-write as /boot; it is formatted using ext3 filesystem. |
||
|
• |
/dev/hda2 will be a swap space of 1000 MB |
||
|
• |
/dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3 the option "−b 2048" is appended. |
||
|
• |
Create the logical partition /dev/hda5 |
||
|
• |
Make /dev/hda7 at least 10% of the disk size |
||
|
• |
Use mkfs.xfs to format the partition 8 |
|
Create a softRAID |
disk_config raid |
|
raid1 |
/ |
sda1,sdd1 |
ext2 |
rw,errors=remount-ro |
|
|
raid0 |
- |
disk2.2,sdc1,sde1:spare:missing |
ext2 default |
|
• |
Create a RAID-1 on /dev/sda1 and /dev/sdd1, format using mkfs.ext2 and mount it as / |
||
|
• |
Create a RAID-0 on the second partition of the second disk, /dev/sdc1, and /dev/sde1 as a spare partition. The latter may be missing. |
|
Simple LVM example |
disk_config sda bootable:1 |
|
primary |
/boot |
500 |
ext3 |
rw |
|
|
primary |
- |
4096- |
- |
- |
|
disk_config lvm |
|
my_pv-_swap |
swap |
2048 |
swap |
sw |
|
|
my_pv-_root |
/ |
2048 |
ext3 |
rw |
|
• |
Partition UUID cannot be obtained: In case a partition was previously used as part of a software RAID volume and now is intended as swap space, udev fails when asked for a UUID. This happens because mkswap does not overwrite the previous RAID superblock. You can remove it using mdadm --zero-superblock <device>. |
||
|
• |
Machine does not boot because not partition is marked as bootable: If the bootable option is not specified, not partition will be marked as such. Modern BIOSes don’t seem to require such markers anymore, but for some systems it may still be necessary. Previous versions of setup-storage by default marked the partition mounting / as bootable, but this is not a sane default for all cases. If you want to be sure not boot failures happen because of a missing bootable marker, explicitly set the bootable option. Of course, there are lots of other reasons why a system may fail to boot. |
|
This program is part of FAI (Fully Automatic Installation). The FAI homepage is http://www.informatik.uni-koeln.de/fai. Further documentation, including coding related information, is maintained in a wiki page at http://faiwiki.informatik.uni-koeln.de/index.php/Setup-storage. |
|
FAI is courtesy of Thomas Lange <lange@informatik.uni-koeln.de>. Michael Tautschnig <mt@debian.org> contributed the initial version of setup-storage to replace the previous setup-harddisks, with the help of Christian Kern. |