Harddisk Preparation

harddisk configuration icon

If you had purchased your harddisk from Linuxvillage as part of a computer package, it would have been partition for you. The following documents the preparation procedures we use to reproduce consistent installs on multiple machines.

We have choosen a semi-automatic install for flexibility purposes but there are fully automatic install solution available. Such as FAI , Mondo or Bootcd etc.

Normally, if you use the installation disk from Debian (Etch), it will step you thorough the partitioning and formatting. But occassionally, you may want to skip all the extra steps in a traditional install for recovery purposes or multiple install etc. Here is how...

All material presented are licensed under The GNU Free Documentation License.

Warning

Warning: The instructions in this section will destroy all data on the hard disk. Use this information to reinstall or reproduce original installation.


  1. Prerequisites
  2. Backup partitions.
  3. Initial partitioning of a harddisk.
  4. Formatting of the individual partitions.
  5. Bootloading.
  6. Restore partitions.
  7. USB Mobile Harddisk Preparation
  8. SATA RAID

  1. Prerequisites

    1. You will need a running system with Linux on it. The target drive is attached but unmounted.
    2. sfdisk
    3. e2fsprogs
    4. Grub
    5. Partition Images created previously with Partimage.

    Updated: 2006-11-19

    Back to top
  2. Backup Partitions.

    Backup each partition image with this command. Assuming it is the 1st SATA/SCSI drive, replace ? with partition id.

    # partimage -z1 -db save /dev/sda? partimagefile

    References

    Updated: 2006-11-19

    Back to top
  3. Partitioning

    The partitioning on your harddisk is done the same way regardless of type or size. e.g. PATA, SATA drive or 80GB to 500GB+.

    Your harddisk is partitioned for security and convenience reasons. It is much easier for backup and recovery and more secure to have separate partitions than to have only one partition. e.g. If all your partitions can be restore from installation disks, you only have to backup your home partition.

    Harddisk Partition Table
    PartitionIdLabelCyclindersSizeFormat
    Primary (bootable)1/89732.5 MBext3
    Extended
    5usr10948.7GBreiserfs
    6var3652.9GBext3
    7swap255 2.0 GBswap
    8tmp73600 MBext2
    9homeremainingremainingreiserfs

    Procedure

    Suppose you have a SATA drive and it is the 1st drive, i.e. sda. Using sfdisk, the command to partition the drive as:
    # sfdisk /dev/sda << EOF 
    ,89,L,* 
    ,,5 
    ,,0
    ,,0
    ,1094,L,
    ,365,L,
    ,255,S,
    ,73,L,
    ,,L,
    EOF
    
    or simiply use this partition.data file and issue the following command to the appropriate drive.
    # sfdisk /dev/sda < partition.data 
    where sda is the target device name.

    To dump the partition information to a file do the following:

    # sfdisk -d /dev/sda
    where sda is the device name.

    References

    Updated: 2006-11-19

    Back to top
  4. Formatting

    Now, time to format. If it is the 1st SATA/SCSI drive and has the same id as above. i.e. sda1, sda5, sda6, etc. Run the following commands to format as journalled file system.

    # mke2fs -j -L / /dev/sda1
    # mke2fs -j -L /var /dev/sda6
    Run the following command to format as non-journalled file system.
    # mke2fs -L /tmp /dev/sda8
    Run the following command to initialize the swap partition.
    # mkswap /dev/sda7
    Run the following command to initialize the Reiserfs journalled file system.
    # mkreiserfs -ql /usr /dev/sda5
    # mkreiserfs -ql /home /dev/sda9

    Alternatively, you can use a script file like formatfs.sh to do the formats. Issue the following command with sda as your target drive.

    # sh formatfs.sh sda

    References

    Updated: 2006-11-19

    Back to top
  5. Boot Loader

    Once you have the partition and format completed, you can now put the boot loader onto the drive. We use Grub not lilo.

    1. Create a directory in /mnt
      # mkdir /mnt/debinst
    2. Mount the root partition first. e.g.
      # mount /mnt/debinst /dev/sda1 
    3. Install grub.
      # grub-install --root-directory=/mnt/debinst /dev/sda

    References

    Updated: 2006-11-19

    Back to top
  6. Restore Partitions.

    Restore each partition image with this command.

    # partimage restore -eb /dev/sda? partimagefile

    References

    Updated: 2006-11-19

    Back to top
  7. USB Mobile Harddisk Preparation

    Warning

    Warning: The procedures outlined in this section will destroy existing data - use with caution.

    We will be using GParted to create the partition and format the usb harddisk.

    Select Applications->System Tools->GParted to start the application. Then select the proper device on the upper right hand corner.

    GParted Devices

    Press the <New> button, and specifiy the partition size and file system format.

    GParted Format

    Press <+Add> when done.

    Press <Apply> and the changes will be written to the disks.

    If there are no errors, mount the usbdisk.

    Updated: 2007-04-04

    Back to top


  8. SATA RAID

    Linuxvillage currently does not support SATA RAID on its products, but here are some external links for further reading.

    Basically, there are hardware RAID, software RAID and fake RAID.:

    • Hardware RAID doesn't need much user space programs except to monitor failures. They are very fast and transparent but less flexible then software RAID, because they usually requires specialized hardware.

    • Software RAID are more flexible because they will work with many combination of hardware and software but requires a lot more work on setup. NVIDIA's build in raid is a BIOS raid, they are fake RAIDs and falls under software raid because they rely heavily on userspace programs.

      There are a few popular programs on software raids: mdadm and dmraid. dmraid is a device mapper and will work with NVIDIA's raid. mdadm has been around for a long time, supports different combination of software/hardware and reportedly has decent performance. The only draw back is the level of difficulty on installation.

      We will stop here and let you explore on your own. Make sure to backup before you begin.

    References

    Updated: 2007-04-14

    Back to top