| 1 |
.TH setup-storage 8 "September 16, 2008" "Debian/GNU Linux"
|
| 2 |
.SH NAME
|
| 3 |
\fBsetup-storage\fP
|
| 4 |
\- automatically prepare storage devices
|
| 5 |
.SH SYNOPSIS
|
| 6 |
.br
|
| 7 |
\fBsetup-storage\fP
|
| 8 |
[\fB\-X\fP]
|
| 9 |
[\fB\-f\fP \fIfilename\fP]
|
| 10 |
[\fB\-d\fP]
|
| 11 |
[\fB\-h\fP]
|
| 12 |
.SH DESCRIPTION
|
| 13 |
Using FAI disk_config files,
|
| 14 |
\fBsetup-storage\fP
|
| 15 |
computes effective partition and volume sizes and executes the necessary
|
| 16 |
commands to configure storage devices. It manages disk drives as well as RAID
|
| 17 |
and LVM volumes. It handles all file systems supported by
|
| 18 |
\fBparted\fP(8)
|
| 19 |
as well as ntfs but is flexible enough to be extended to further types as well.
|
| 20 |
Once the storage devices are prepared, an appropriate
|
| 21 |
\fBfstab\fP(5)
|
| 22 |
file is generated.
|
| 23 |
|
| 24 |
Without the
|
| 25 |
\fB\-X\fP
|
| 26 |
parameter
|
| 27 |
\fBsetup-storage\fP
|
| 28 |
runs in test-only mode and does not execute commands other than writing disk
|
| 29 |
labels to a blank disk.
|
| 30 |
|
| 31 |
The exit code of
|
| 32 |
\fBsetup-storage\fP
|
| 33 |
is 0 if all operations were performed successfully and non-zero if an error
|
| 34 |
occurs.
|
| 35 |
.SH USAGE
|
| 36 |
To enable the use of the new partioning tool setup-storage you have to
|
| 37 |
set
|
| 38 |
.IR USE_SETUP_STORAGE =1
|
| 39 |
in the according class file in configspace (like
|
| 40 |
/srv/fai/config/class/FAIBASE.var for example).
|
| 41 |
.SH OPTIONS
|
| 42 |
|
| 43 |
.TP
|
| 44 |
\fB\-X\fP
|
| 45 |
Really write the configuration to disk. Otherwise
|
| 46 |
\fBsetup-storage\fP
|
| 47 |
runs in test-only mode.
|
| 48 |
|
| 49 |
.TP
|
| 50 |
\fB\-f\fP \fIfilename\fP
|
| 51 |
Normally
|
| 52 |
\fBsetup-storage\fP
|
| 53 |
selects an appropriate configuration from
|
| 54 |
$FAI/disk_config/
|
| 55 |
by picking the first class from
|
| 56 |
.IR classes
|
| 57 |
that has an existing file.
|
| 58 |
If however
|
| 59 |
\fB\-f\fP
|
| 60 |
is given the configuration in
|
| 61 |
\fIfilename\fP
|
| 62 |
is used.
|
| 63 |
|
| 64 |
.TP
|
| 65 |
\fB\-d\fP
|
| 66 |
Enable debugging output.
|
| 67 |
|
| 68 |
.TP
|
| 69 |
\fB\-h\fP
|
| 70 |
Display the synopsis and version info and exit.
|
| 71 |
.SH ENVIRONMENT
|
| 72 |
\fBsetup-storage\fP
|
| 73 |
will use the following environment variables:
|
| 74 |
.TP
|
| 75 |
.B disklist
|
| 76 |
The
|
| 77 |
.IR disklist
|
| 78 |
variable must contain a newline separated list of disk drives available in the
|
| 79 |
system. Their order matters as they may be referred to as disk1, etc. in
|
| 80 |
disk_config.
|
| 81 |
.TP
|
| 82 |
.B debug
|
| 83 |
If
|
| 84 |
.IR debug
|
| 85 |
is set to a non-zero value all actions and details to track the operation of
|
| 86 |
\fBsetup-storage\fP
|
| 87 |
are printed to stderr.
|
| 88 |
.TP
|
| 89 |
.B FAI
|
| 90 |
The location of the config space to find the disk_config directory.
|
| 91 |
.TP
|
| 92 |
.B classes
|
| 93 |
The list of FAI classes to determine the appropriate configuration to choose.
|
| 94 |
.TP
|
| 95 |
.B LOGDIR
|
| 96 |
\fBsetup-storage\fP
|
| 97 |
generates disk_var.sh and fstab (see below) in this directory.
|
| 98 |
.SH FILES
|
| 99 |
If
|
| 100 |
\fBsetup-storage\fP
|
| 101 |
executes successfully an
|
| 102 |
\fBfstab\fP(5)
|
| 103 |
file matching the specified configuration is generated as
|
| 104 |
$LOGDIR/fstab. Further $LOGDIR/disk_var.sh
|
| 105 |
is generated and may be sourced to get the variables
|
| 106 |
.IR SWAPLIST ,
|
| 107 |
.IR ROOT_PARTITION ,
|
| 108 |
.IR BOOT_PARTITION
|
| 109 |
and
|
| 110 |
.IR BOOT_DEVICE .
|
| 111 |
The latter two will only be set in case they
|
| 112 |
reside on a disk drive.
|
| 113 |
.SH SYNTAX
|
| 114 |
This section describes the syntax of disk_config files
|
| 115 |
|
| 116 |
|
| 117 |
file ::= <lines> EOF
|
| 118 |
.br
|
| 119 |
|
| 120 |
|
| 121 |
lines ::= EOL
|
| 122 |
.br
|
| 123 |
/* empty lines or whitespace only */
|
| 124 |
.br
|
| 125 |
| <comment> EOL
|
| 126 |
.br
|
| 127 |
| <config> EOL
|
| 128 |
.br
|
| 129 |
|
| 130 |
|
| 131 |
comment ::= #.*
|
| 132 |
.br
|
| 133 |
|
| 134 |
|
| 135 |
config ::= disk_config lvm( <lvmoption>)*
|
| 136 |
.br
|
| 137 |
| disk_config raid( <raidoption>)*
|
| 138 |
.br
|
| 139 |
| disk_config end
|
| 140 |
.br
|
| 141 |
| disk_config disk[[:digit:]]+( <option>)*
|
| 142 |
.br
|
| 143 |
| disk_config [^[:space:]]+( <option>)*
|
| 144 |
.br
|
| 145 |
/* fully qualified device-path or short form, like hda, whereby full
|
| 146 |
.br
|
| 147 |
* path is assumed to be /dev/hda; may contain shell globbing such
|
| 148 |
.br
|
| 149 |
* as /dev/disk/by-id/scsi-* */
|
| 150 |
.br
|
| 151 |
| <volume>
|
| 152 |
.br
|
| 153 |
|
| 154 |
|
| 155 |
lvmoption ::= /* empty */
|
| 156 |
.br
|
| 157 |
| preserve_always:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
|
| 158 |
.br
|
| 159 |
/* preserve partitions -- always */
|
| 160 |
.br
|
| 161 |
| preserve_reinstall:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
|
| 162 |
.br
|
| 163 |
/* preserve partitions -- unless the system is installed for the
|
| 164 |
.br
|
| 165 |
first time */
|
| 166 |
.br
|
| 167 |
| resize:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
|
| 168 |
.br
|
| 169 |
/* attempt to resize partitions */
|
| 170 |
.br
|
| 171 |
| fstabkey:(device|label|uuid)
|
| 172 |
.br
|
| 173 |
/* when creating the fstab, the key used for defining the device
|
| 174 |
.br
|
| 175 |
may be the device (/dev/xxx), a label given using \-L, or the uuid
|
| 176 |
.br
|
| 177 |
*/
|
| 178 |
.br
|
| 179 |
|
| 180 |
|
| 181 |
raidoption ::= /* empty */
|
| 182 |
.br
|
| 183 |
| preserve_always:[[:digit:]]+(,[[:digit:]]+)*
|
| 184 |
.br
|
| 185 |
/* preserve partitions -- always */
|
| 186 |
.br
|
| 187 |
| preserve_reinstall:[[:digit:]]+(,[[:digit:]]+)*
|
| 188 |
.br
|
| 189 |
/* preserve partitions -- unless the system is installed for the
|
| 190 |
.br
|
| 191 |
first time */
|
| 192 |
.br
|
| 193 |
| fstabkey:(device|label|uuid)
|
| 194 |
.br
|
| 195 |
/* when creating the fstab the key used for defining the device
|
| 196 |
.br
|
| 197 |
may be the device (/dev/xxx), a label given using \-L, or the uuid
|
| 198 |
.br
|
| 199 |
*/
|
| 200 |
.br
|
| 201 |
|
| 202 |
|
| 203 |
option ::= /* empty */
|
| 204 |
.br
|
| 205 |
| preserve_always:[[:digit:]]+(,[[:digit:]]+)*
|
| 206 |
.br
|
| 207 |
/* preserve partitions -- always */
|
| 208 |
.br
|
| 209 |
| preserve_reinstall:[[:digit:]]+(,[[:digit:]]+)*
|
| 210 |
.br
|
| 211 |
/* preserve partitions -- unless the system is installed for the
|
| 212 |
.br
|
| 213 |
first time */
|
| 214 |
.br
|
| 215 |
| resize:[[:digit:]]+(,[[:digit:]]+)*
|
| 216 |
.br
|
| 217 |
/* attempt to resize partitions */
|
| 218 |
.br
|
| 219 |
| disklabel:(msdos|gpt)
|
| 220 |
.br
|
| 221 |
/* write a disklabel - default is msdos */
|
| 222 |
.br
|
| 223 |
| bootable:[[:digit:]]+
|
| 224 |
.br
|
| 225 |
/* mark a partition bootable, default is / */
|
| 226 |
.br
|
| 227 |
| virtual
|
| 228 |
.br
|
| 229 |
/* do not assume the disk to be a physical device, use with xen */
|
| 230 |
.br
|
| 231 |
| fstabkey:(device|label|uuid)
|
| 232 |
.br
|
| 233 |
/* when creating the fstab the key used for defining the device
|
| 234 |
.br
|
| 235 |
may be the device (/dev/xxx), a label given using \-L, or the uuid
|
| 236 |
.br
|
| 237 |
*/
|
| 238 |
.br
|
| 239 |
|
| 240 |
|
| 241 |
volume ::= <type> <mountpoint> <size> <filesystem> <mount_options> <fs_options>
|
| 242 |
.br
|
| 243 |
| vg <name> <size> <fs_options>
|
| 244 |
.br
|
| 245 |
/* lvm vg */
|
| 246 |
.br
|
| 247 |
|
| 248 |
|
| 249 |
type ::= primary
|
| 250 |
.br
|
| 251 |
/* for physical disks only */
|
| 252 |
.br
|
| 253 |
| logical
|
| 254 |
.br
|
| 255 |
/* for physical disks only */
|
| 256 |
.br
|
| 257 |
| raid[0156]
|
| 258 |
.br
|
| 259 |
/* raid level */
|
| 260 |
.br
|
| 261 |
| [^/[:space:]]+-[^/[:space:]]+
|
| 262 |
.br
|
| 263 |
/* lvm logical volume: vg name and lv name*/
|
| 264 |
.br
|
| 265 |
|
| 266 |
|
| 267 |
mountpoint ::= (-|swap|/[^\:[:space:]]*)(:encrypt(:randinit)?)?
|
| 268 |
.br
|
| 269 |
/* do not mount, mount as swap, or mount at fully qualified path;
|
| 270 |
.br
|
| 271 |
* if :encrypt is given the partition will be encrypted, the key
|
| 272 |
.br
|
| 273 |
* is generated automatically; :randinit adds random
|
| 274 |
.br
|
| 275 |
* initialization of the partition */
|
| 276 |
.br
|
| 277 |
|
| 278 |
|
| 279 |
name ::= [^/[:space:]]+
|
| 280 |
.br
|
| 281 |
/* lvm volume group name */
|
| 282 |
.br
|
| 283 |
|
| 284 |
|
| 285 |
size ::= [[:digit:]]+[kMGTP%]?(-([[:digit:]]+[kMGTP%]?)?)?(:resize)?
|
| 286 |
.br
|
| 287 |
/* size in kilo, mega (default), giga, tera or petabytes or %,
|
| 288 |
.br
|
| 289 |
* possibly given as a range; physical
|
| 290 |
.br
|
| 291 |
* partitions or lvm logical volumes only; */
|
| 292 |
.br
|
| 293 |
| -[[:digit:]]+[kMGTP%]?(:resize)?
|
| 294 |
.br
|
| 295 |
/* size in kilo, mega (default), giga, tera or petabytes or %,
|
| 296 |
.br
|
| 297 |
* given as upper limit; physical partitions
|
| 298 |
.br
|
| 299 |
* or lvm logical volumes only */
|
| 300 |
.br
|
| 301 |
| [^,:[:space:]]+(:(spare|missing))*(,[^,:[:space:]]+(:(spare|missing))*)*
|
| 302 |
.br
|
| 303 |
/* devices and options for a raid or lvm vg */
|
| 304 |
.br
|
| 305 |
|
| 306 |
|
| 307 |
mount_options ::= [^[:space:]]+
|
| 308 |
.br
|
| 309 |
|
| 310 |
|
| 311 |
filesystem ::= -
|
| 312 |
.br
|
| 313 |
| swap
|
| 314 |
.br
|
| 315 |
| [^[:space:]]
|
| 316 |
.br
|
| 317 |
/* mkfs.xxx must exist */
|
| 318 |
.br
|
| 319 |
|
| 320 |
|
| 321 |
fs_options ::= (createopts=".*"|tuneopts=".*"|(pv|vg|lv|md)createopts=".*")*
|
| 322 |
.br
|
| 323 |
/* options to append to mkfs.xxx and to the filesystem-specific
|
| 324 |
.br
|
| 325 |
* tuning tool, pvcreate, vgcreate, lvcreate or mdadm */
|
| 326 |
.br
|
| 327 |
.SH MIGRATION FROM SETUP_HARDDISKS
|
| 328 |
The major differences to the prior configuration syntax are:
|
| 329 |
.IP \(bu
|
| 330 |
The disk_config ... line allows for the keywords lvm and raid
|
| 331 |
.IP \(bu
|
| 332 |
Options may need to be appended to the disk_config line
|
| 333 |
.IP \(bu
|
| 334 |
The ";" is not used anymore, the options that were given there have now been split up
|
| 335 |
.IP \(bu
|
| 336 |
The filesystem is now an explicit parameter; note that the order of
|
| 337 |
filesystem/mount-options is the same /etc/fstab as opposed to the previous
|
| 338 |
format of disk_config.
|
| 339 |
.IP \(bu
|
| 340 |
Any options to mkfs.xxx may be given using createopts="".
|
| 341 |
.IP \(bu
|
| 342 |
The "preserveX" and "boot" options are one of the options now given on the
|
| 343 |
disk_config line, using preserve_reinstall or preserve_always and bootable.
|
| 344 |
preserve_always is equivalent to the previous preserveX option, whereas
|
| 345 |
preserve_reinstall preserves the partition unless "initial" is given as one of
|
| 346 |
the FAI_FLAGS.
|
| 347 |
.IP \(bu
|
| 348 |
Support for LVM and RAID is completely new
|
| 349 |
.IP \(bu
|
| 350 |
Resizing partitions and filesystems is supported
|
| 351 |
.SH EXAMPLES
|
| 352 |
Simple configuration of /dev/hda
|
| 353 |
.sp
|
| 354 |
.nf
|
| 355 |
.ta 10n 20n 30n 40n 50n
|
| 356 |
disk_config hda preserve_always:6,7 disklabel:msdos bootable:3
|
| 357 |
|
| 358 |
primary /boot 20-100 ext3 rw
|
| 359 |
primary swap 1000 swap sw
|
| 360 |
primary / 12000 ext3 rw createopts="\-b 2048"
|
| 361 |
logical /tmp 1000 ext3 rw,nosuid
|
| 362 |
logical /usr 5000 ext3 rw
|
| 363 |
logical /var 10%- ext3 rw
|
| 364 |
logical /nobackup 0- xfs rw
|
| 365 |
.sp
|
| 366 |
.fi
|
| 367 |
.PP
|
| 368 |
.IP \(bu
|
| 369 |
Preserve the 6th and the 7th partition. The disklabel is msdos which is the default
|
| 370 |
for x86. Furthermore the 3rd partition is made bootable.
|
| 371 |
.IP \(bu
|
| 372 |
Create a primary partition /dev/hda1 with a size between 20 and 100 MB and mount it
|
| 373 |
read-write as /boot; it is formatted using ext3 filesystem.
|
| 374 |
.IP \(bu
|
| 375 |
/dev/hda2 will be a swap space of 1000 MB
|
| 376 |
.IP \(bu
|
| 377 |
/dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3
|
| 378 |
the option "\-b 2048" is appended.
|
| 379 |
.IP \(bu
|
| 380 |
Create the logical partition /dev/hda5
|
| 381 |
.IP \(bu
|
| 382 |
Make /dev/hda7 at least 10% of the disk size
|
| 383 |
.IP \(bu
|
| 384 |
Use mkfs.xfs to format the partition 8
|
| 385 |
|
| 386 |
.TP
|
| 387 |
Create a softRAID
|
| 388 |
.sp
|
| 389 |
.nf
|
| 390 |
.ta 6n 9n 40n 45n
|
| 391 |
disk_config raid
|
| 392 |
raid1 / sda1,sdd1 ext2 rw,errors=remount-ro
|
| 393 |
raid0 - disk2.2,sdc1,sde1:spare:missing ext2 default
|
| 394 |
.sp
|
| 395 |
.fi
|
| 396 |
.PP
|
| 397 |
.IP \(bu
|
| 398 |
Create a RAID-1 on /dev/sda1 and /dev/sdd1, format using mkfs.ext2 and mount
|
| 399 |
it as /
|
| 400 |
.IP \(bu
|
| 401 |
Create a RAID-0 on the second partition of the second disk, /dev/sdc1, and
|
| 402 |
/dev/sde1 as a spare partition. The latter may be missing.
|
| 403 |
|
| 404 |
.TP
|
| 405 |
Simple LVM example
|
| 406 |
.sp
|
| 407 |
.nf
|
| 408 |
.ta 15n 22n 30n 40n
|
| 409 |
disk_config sda bootable:1
|
| 410 |
primary /boot 500 ext3 rw
|
| 411 |
primary - 4096- - -
|
| 412 |
disk_config lvm
|
| 413 |
vg my_pv sda2
|
| 414 |
my_pv-_swap swap 2048 swap sw
|
| 415 |
my_pv-_root / 2048 ext3 rw
|
| 416 |
.sp
|
| 417 |
.fi
|
| 418 |
.PP
|
| 419 |
.SH SEE ALSO
|
| 420 |
This program is part of FAI (Fully Automatic Installation).
|
| 421 |
The FAI homepage is http://www.informatik.uni-koeln.de/fai.
|
| 422 |
|
| 423 |
Further documentation, including coding related information, is maintained
|
| 424 |
in a wiki page at http://faiwiki.informatik.uni-koeln.de/index.php/Setup-storage.
|
| 425 |
.SH AUTHOR
|
| 426 |
FAI is courtesy of Thomas Lange <lange@informatik.uni-koeln.de>. Michael
|
| 427 |
Tautschnig <mt@debian.org> contributed the initial version of
|
| 428 |
\fBsetup-storage\fP
|
| 429 |
to replace the previous setup-harddisks, with the help of Christian Kern.
|