You must partition and format the disks in your computer before installing a new operating system or before restoring a system from backup.
# 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.
# cfdisk -z /dev/sda
(The -z switch will erase all partitions that are already on the disk.)
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
# cat /proc/partitions
[screenshot]
Notice how sda1 and sdb1 have appeared in the partitions file.
# mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/sda1 /dev/sdb1
[screenshot]
# 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.
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.
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.
# install-mbr /dev/sda
Install the generic boot loader to the second disk. (This command is silent.)
# install-mbr /dev/sdb
# 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.