==================
 bootcd2disk.conf
==================

------------
bootcd utils
------------

:Author: bernd.schumacher@hpe.com
:Date: 2019-07-26
:Copyright: gpl3
:Version: 0.1
:Manual section: 5
:Manual group: bootcd utils

SYNOPSIS
========

/etc/bootcd2disk.conf

DESCRIPTION
===========

**bootcd2disk.conf** is a configuration file used by **bootcd2disk**.
The default path is **/etc/bootcd2disk.conf**.

This file will be sources as shell file.
The following Options can be used.
Examples how to use the Options are shown.

OPTIONS
=======

**do_first**

  A function **do_first** can be defined, to
  do some things first before doing anything else.
  Example of a function, that does nothing::

    do_first() {
      return
    }

**BOOCDMP**

  This defines the mountpoint, where filesystems can be mounted
  to be temporarily modified by bootcd2disk.

  Default::

    BOOTCDMP="/mnt/bootcd.disc"

**DISK0**

  The Variables **DISK0**, **DISK1**, ... can be defined to specify the disks
  disk that will be newly partitioned before copying the cd to it::

    DISK0="/dev/hda"

  To not partition any disk::

    DISK0=""

  To let bootcd2disk find a disk (bootcd2disk tries to use the first disk)::

    DISK0="auto"

  It is possible to define more disks. The disk number must be increased by 1::

    DISK1="auto"
    DISK2="auto"

  Default::

    DISK0="auto"

**COPYDEST**

  This points to the mounted disk and normally needs not to be changed.
  Default::

    COPYDEST="/mnt/bootcd.disc"

**MD**

  To define Raid devices. Not well tested. Not documented.

  Default::

    MD=""

**DISKIDTYP**

  With the variable **DISKIDTYP** it can be defined which type of name bootcd
  should write in config files.
  When naming a disk in a file, bootcd2disk can try to name the disk by UUID::

    DISKIDTYP="UUID"

  Or bootcd can name the disk by the devicename::

    DISKIDTYP="DEVNAME"

  Default::

    DISKIDTYP="UUID"

**LVMGRP**

  Each volume group definition needs a new line. Syntax ::

    LVMGRP="<group> <diskdev> [<diskdev> ...][<vgcreate-cmd>][...]"

  Example1 ::

    LVMGRP="vg00 DISK0P1
    vg01 DISK0P2
    vg02 DISK0P3 DISK0P4"


  Example2 which is the same as Example1 because it uses the default schema ::

    LVMGRP="vg00 DISK0P1 vgcreate vg00 DISK0P1
    vg01 DISK0P2 vgcreate vg01 DISK0P2
    vg02 DISK0P3 vgcreate vg02 DISK0P3 DISK0P4"

  Default::

    LVMGRP=""

**LVMVOL**

  Each logical volume definition needs a new line!
  Size in vgcreate syntax is MByte, e.g.: 100 means 100 MByte.
  Syntax ::

    LVMVOL="<volname> <size> <group> [<lvcreate-cmd>][...]"

  Example1 ::

    LVMVOL="lv00 2000 vg00"


  Example2 which is the same as Example1 because it used the default schema ::

    LVMVOL="lv00 2000 vg00 lvcreate -n lv00 -L 2000 vg00"

  Example3 uses striping for the second volume ::

    LVMVOL="lv00 2000 vg00
    lv01 100 vg00 lvcreate -n lv01 -i 3 -I 8 -L 100 vg00"


  Default::

    LVMVOL=""

**TRYFIRST**

  If DISK0="auto" is defined, the first disk found will be used.
  To change this order TRYFIRST can be defined for example to use SCSI Disks first::

    TRYFIRST="/dev/sda /dev/hda"

  Most people will not need this option and will use the default::

    TRYFIRST=""

**SFDISK0**

  SFDISK0 defines how *sfdisk* will format DISK0.
  If nothing should be repartitioned::

    SFDISK0=""

  If it has to be specified, see man *sfdisk(8)*. Nubers are sectors::

    SFDISK0="
    ,50
    ,100,S
    ;
    "

  If bootcd2disk does it automatically, there will be 3 partitions
  /boot, swap and /. /boot is created first to be sure the bios can load
  the kernel also on very large disks. Sectors will be used as unit::

    SFDISK0="
    unit: sectors
    2048,102400,L
    102401,307201,S
    307202,+,L
    "

  For each defined DISK<x> there must be one SFDISK<x> Line::

    SFDISK1="auto"
    SFDISK2="auto"

  Default::

    SFDISK0="auto"

**VFAT**

  Each device or logical volume definition needs a new line!.
  VFAT is often needed for EFI. If not needed::

    VFAT=""

  To ceate partitions with mkdosfs::

    VFAT="/dev/sdb4"

  To create partitions needed automatically::
  Default::

    VFAT="auto"

**EXT2FS**

  Each device or logical volume definition needs a new line!.
  Do not not create ext2 filesystems::

    EXT2FS=""

  Create partitions defined in EXT2FS with mke2fs::

    EXT2FS="/dev/hda1
    /dev/hda3"

  To create partitions needed automatically::
  Default::

    EXT2FS="auto"

  if also EXT3FS="auto" then ext3 will be used if possible

**EXT3FS**

  Each device or logical volume definition needs a new line!
  Do not not create ext3 filesystems::

    EXT3FS=""

  Create partitions defined in EXT3FS with mke2fs -j::

    EXT3FS="/dev/hda1
    /dev/hda3"

  To create partitions needed automatically
  Default::

    EXT3FS="auto"

  if also EXT4FS="auto" then ext4 will be used if possible

**EXT4FS**

  Each device or logical volume definition needs a new line!
  Do not not create ext4 filesystems::

    EXT4FS=""

  Create partitions defined in EXT4FS as ext4 filesystems::

    EXT4FS="/dev/hda1
    /dev/hda3"

  To create partitions needed automatically:
  Default::

    EXT4FS="auto"

**XFS**

  Each device or logical volume definition needs a new line!
  Create partitions defined as xfs filesystems::

    XFS="/dev/hda1
    /dev/hda3"

  Do not not create xfs filesystems::
  Default::

    XFS=""

**SWAP**

  Each swap device definition needs a new line!
  If you don't want to run mkswap use::

    SWAP=""

  If you want to specify partitions for mkswap::

    SWAP="/dev/hda2"

  Default::

    SWAP="auto"

**MOUNT**

  If you want to mount everything yourself::

    MOUNT="mount /dev/hda3 /mnt/bootcd.disc;
    mkdir /mnt/bootcd.disc/boot; mount /dev/hda1 /mnt/bootcd.disc/boot"

  Default::

    MOUNT="auto"

**UMOUNT**

  Example::

    UMOUNT="umount /mnt/bootcd.disc/boot; umount /mnt/bootcd.disc"

  Default::

    UMOUNT="auto"

**FSTAB**

  If you don't want to change the /etc/fstab copied form cd:
    FSTAB=""

  If You want to define it yourself::

    FSTAB="/dev/sda1 /boot ext2 defaults 0 1
    /dev/sda2 none  swap sw 0 0
    /dev/sda3 /     ext2 defaults,errors=remount-ro 0 1
    proc      /proc proc defaults 0 0"

  The string **DISK0P1** will be automatically changed to <device of the first
  partition of the first disk>. The string **UUID!DISK1P3** will be automacally
  changed to the <UUID of the third partition of the second disk>.

  Default::

    FSTAB="auto"

**EFIBOOT**

  Create a disk that can boot with old BIOS::

    EFIBOOT="bios"

  Create a disk that can boot with EFI.
  Will work with secureboot enabled, if kernel and grub are
  signed or unchanged from debian.::

    EFIBOOT="efi"


  To check actual system and result in either BIOS or EFI::

    EFIBOOT="auto"

  The same as before::

    EFIBOOT=""

  Create a disk that can boot from BIOS and EFI.
  The disk may be removed, and used on another host, with
  either bios or efi::

    EFIBOOT="bios+efi"

  Default::

    EFIBOOT="auto"

**GRUB2**

  This variable defines if GRUB2 will be used and
  how the file /boot/grub/grub.cfg is created.
  If GRUB2 and GRUB and LILO is defined and installed, GRUB2 will be used

  If you don't want to use GRUB2::

    GRUB2=""

  GRUB2 can also define the content of /boot/grub/grub.cfg.
  Grub2 starts counting partitions at 1 and grub1 starts at 0.
  Example::

    GRUB2="
    set lang=en
    insmod gettext
    set timeout=5
    set menu_color_normal=cyan/blue
    set menu_color_highlight=white/blue

    menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os {
         insmod ext2
         set root='(hd0,1)'
         linux   /\$(basename $KERNEL) root=DISK0P3 ro
         initrd  /\$(basename $INITRD)
    }"

  If GRUB2 is auto, update-grub will be used to create /boot/grub/grub.cfg automatically.
  Default::

    GRUB2="auto"

**GRUB**

  If you don't want to use GRUB::

    GRUB=""

  If GRUB2 is not installed or defined and GRUB is defined and grub is
  installed it will be used and LILO will be ignored.

  If you want to define it yourself::

    GRUB="default 0
    timeout 5
    color   cyan/blue white/blue
    title   Debian GNU/Linux
    root    (hd0,0)
    kernel  /vmlinuz-2.4.27-2-386 root=/dev/hda3 ro
    initrd  /initrd.img-2.4.27-2-386
    savedefault
    boot"

  If You want to do it automatically::

    GRUB="auto"

**GRUBBOOTDISK**

  If /boot is not the first partition on disk, we need to know which
  one it is to install grub properly.
  bootcd starts counting with 0 like grub1 !
  Example::

    GRUBBOOTDISK="hd0"

  Default::

    GRUBBOOTDISK=""

**GRUBBOOTDIR**

  Example::

    GRUBBOOTDIR="0"

  Default::

    GRUBBOOTDIR=""

**GRUBDEVICEMAP**

  Syntax::

    GRUBDEVICEMAP=auto|no|<value>

  Let bootcd2disk delete the original device.map, so that it will be
  auto-created by grub again.::

    GRUBDEVICEMAP="auto"

  bootcd2disk shoult not change device.map.
  This should work if a bootcd is installed on the original hardware::

    GRUBDEVICEMAP="no"

  Everything else will be used as new value for device.map.
  Default::

    GRUBDEVICEMAP="auto"

**LILO**

  If GRUB is defined and installed LILO will be ignored.
  If you don't want to change the /etc/lilo.conf copied from cd::

    LILO=""

  If you want to define it yourself::

    LILO="boot=DISK0
    delay=20
    vga=0
    image=/vmlinuz
    root=DISK0P3
    initrd=/initrd.img
    label=Linux
    read-only"

  If You want to do it automatically::
  Default::

    LILO="auto"

**SSHHOSTKEY**

  Syntax::

    SSHHOSTKEY=yes|no

  If you are using ssh it is helpful to have a unique ssh hostkey for
  each PC installed with bootcd2disk. This will be generated with::

    SSHHOSTKEY="yes"

  To use in backups::

    SSHHOSTKEY="unchanged"

  Default::

    SSHHOSTKEY="yes"

**UDEV_FIXNET**

  Syntax::

    UDEV_FIXNET=yes|no

  If you are using udev filesystem and install the image on other machines
  you need to set this to "yes" because the network interfaces are hardwired
  in /etc/udev/rules.d/z25_persistent-net.rules (etch) or in
  /etc/udev/rules.d/70-persistent-net.rules (lenny) and we must remove them.::

    UDEV_FIXNET="yes"

  Default::

    UDEV_FIXNET="yes"

**IMAGEURL**

  If bootcd2disk is slow on your system (because of a slow CD/DVD drive or
  the HP ILO virtual CD interface), you can use a image server to get the
  image from.
  bootcd2disk use the SWAP partition of your upcoming system as temporary
  space and copy the image from the configured image server (IMAGEURL or
  cmdline -url) to this partition and use it as image.
  Please use a ip because of failed DNS and you need also the configured ip interface.
  The "url" is used with "wget" so all url from wget are possible. Example::

   IMAGEURL="http://192.168.100.10/cdimage.iso"

  Default::

    IMAGEURL=""

**PARTITIONLABEL**

  If you want the filesystem or swap partitions to have labels you can define
  them here. Example::

    PARTITIONLABEL="/dev/sda1:/
    /dev/sda2:SWAP-sda2"

  Default::

    PARTITIONLABEL=""

**after_copy**

  function after_copy
  if you want to do some things after copying the files (e.g. remount of
  directories ...), you can add this to this function.::

    after_copy() {
      return
    }

**RESUME**

  Fix RESUME configuration.
  If you get the Warning "Gave up waiting for suspend/resume device"
  when booting from a disk created with bootcd2disk, this may help.
  It fixes the file /etc/initramfs-tools/conf.d/resume, that may be
  enabled with the option RESUME in /etc/initramfs-tools/initramfs.conf
  If you want to define the RESUME device yourself::

    RESUME="/dev/hda2"

  To calculate the disk-partition automatically, which requires 
  SFDISK0="auto" and FSTAB="auto" use::

    RESUME="auto"

  To not change the RESUME configuration, the variable has to be empty::

    RESUME=""

  To disable the RESUME Feature, RESUME has to be none::
  Default::

    RESUME="none"

**RESTORECMD**

  The RESTORECMD defined in bootcd2disk.conf defines how the backup is
  Default::

    RESTORECMD=""

**ISOLOOPBACK**

  Normally the System is running from **bootcd**, when **bootcd2disk** is called.
  Then files under **/** are copied to the new disk.
  But it may be faster to additionally mount the **bootcd** to another mountpoint
  and copy from there. This mountpoint can then be defined with **ISOLOOPBACK**

  Default::

    ISOLOOPBACK=""

ENVIRONMENT
===========

**ia_logfile**

  The logfile of *bootcd2disk* is */var/log/bootcd2disk*,
  if not overwriten with variable *ia_logfile* before.

SEE ALSO
========

bootcd(7), bootcdwrite(1), bootcd2disk(1), bootcdflopcp(1),
bootcdmk2diskconf(1), bootcdbackup(1), bootcdwrite.conf(5)
