Disk Configuration

You must partition and format the disks in your computer before installing a new operating system or before restoring a system from backup.


  1. Determine the device names of the hard disks.

    # cat /proc/partitions
    [screenshot]

    The device names for SCSI disks have a sd prefix. The first SCSI disk is sda, the second SCSI disk is sdb, and so forth. The screenshot shows two SCSI disks in the example computer.

    The device names for IDE disks have a hd prefix. The first IDE disk is hda, the second IDE disk is hdb, and so forth. If the target computer has IDE disks, then you must substitute hd for sd in this document.

    If your disks are not blank, then the /proc/partitions file may contain other entries. Device names that end with a number represent disk partitions.

  2. Partition the first disk.

    # cfdisk -z /dev/sda

    (The -z switch will erase all partitions that are already on the disk.)

    1. [screenshot] Click "New".
    2. [screenshot] Click "Primary".
    3. [screenshot] Push enter to use the entire disk.
    4. [screenshot] Click "Type".
    5. [screenshot] Enter 'fd' at the prompt and push enter.
    6. [screenshot] Click "Bootable". The boot flag should appear.
    7. [screenshot] Click "Write".
    8. [screenshot] Enter 'yes' at the prompt and push enter.
    9. [screenshot] Click "Quit".

    Note: If you have only one hard disk, then do not change the partition type. (Skip steps 4 and 5 above.) Whenever you see /dev/md0 used in this document, you must use /dev/sda1 or /dev/hda1 instead.

    Repeat this procedure on the second disk.

    # cfdisk -z /dev/sdb

  3. Verify that the partitions were created.

    # cat /proc/partitions
    [screenshot]

    Notice how sda1 and sdb1 have appeared in the partitions file.

  4. Create the disk mirror. (If you have only one disk, then skip to step 6.)

    # mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/sda1 /dev/sdb1
    [screenshot]

  5. Verify that the disk mirror was created.

    # cat /proc/partitions
    [screenshot]

    The device names for RAID volumes have the md prefix, which means "multiple disk". The first raid volume is md0, the second raid volume is md1, and so forth.

    Tip: You can check the RAID status with this command:
    # cat /proc/mdstat
    [screenshot]

    The line that matters is:
    md0 : active raid1 sdb1[1] sda1[0]

    It shows that sda1 and sdb1 have been put into the md0 array.

  6. Create the filesystem. This is the same as the "format c:" DOS command.

    # mkfs -j /dev/md0
    [screenshot]

    The '-j' switch tells mkfs to create a journalled filesystem, which will handle unexpected shutdowns gracefully.

  7. Create the filesystem. This is the same as the "format c:" DOS command.

    # mkfs -j /dev/md0
    [screenshot]

    The '-j' switch tells mkfs to create a journalled filesystem, which will handle unexpected shutdowns gracefully.

  8. Install the generic boot loader to the first disk. (This command is silent.)

    # install-mbr /dev/sda

    Install the generic boot loader to the second disk. (This command is silent.)

    # install-mbr /dev/sdb

  9. Verify that the generic boot loader was installed.

    # install-mbr --list /dev/sda
    [screenshot]

    The output of this command should contain this line:
    Default: D

    This command installs a master boot record ("MBR") that always starts the first partition on the disk with a bootable flag. (This is the same method that is used by Microsoft Windows.) Note that the bundled lilo.conf file installs Lilo to the RAID volume. If Lilo is installed to the RAID volume, then the MBR need not ever be reinstalled, even if the kernel is upgraded.


The disks are now partitioned, mirrored, formatted, and bootable.