Prepare a self-installing drive for blade servers

Streamline Linux installations with a self-booting drive

Follow these nine steps to build a bootable, self-installing hard disk drive for an IBM BladeCenter® HS20 blade server running SUSE Linux Enterprise Server 10. (These steps work for other blade servers, as well). When the system boots from this drive for the first time, it automatically begins to install Linux® on the disk, which eases the task of preloading the operating system and lightens user workload.

Da Shuang He, Software Engineer, IBM

Da Shuang He is a software engineer at the IBM China Development Lab in Shanghai, China. He is currently working on system management software; he focuses on creating self-bootable servers, remote operation system installation, and power management.



18 March 2008

Also available in Russian

Getting started

Let's start with two systems:

  • System A is preloaded with SLES10 and grub as the boot loader. It has two SCSI disk interfaces, but only the first one is used.
  • System B is a bare system with one disk drive and no operating system loaded.

We'll use System A to prepare the self-installing hard disk drive for System B.

The first step is to make a self-bootable disk. Format this disk with two partitions:

  • The first (smaller) partition will contain the SUSE installation media; let's call this the install partition.
  • The second (larger) partition is reserved for the operating system; let's call this the OS partition.

Step 1. Correct cabling

With both systems powered off, unplug the disk (disk B) from System B, and plug the disk B into System A's second SCSI disk interface. Then boot System A from its own disk (disk A), the first SCSI disk.


Step 2. Partition disk B

Use fdisk to partition disk B. If you use the SCSI disk, the disk name is /dev/sdb (if you use another type of disk, for example an IDE disk, adjust the name accordingly. (You can use fdisk -l to see the device name of your disk).

  1. Run fdisk /dev/sdb.
  2. Type d to delete any existing partitions. You can skip this step if your disk is blank.
  3. Type n to add a new partition. Create the install partition as the first primary partition by choosing primary partition and choosing the number 1 as the partition number. Next, assign a sector from 1 to 900 (about 6.3GB is good, since the SUSE installation media needs about 4.3GB) as shown in Listing 1. You can adjust it as needed.
    Listing 1. Create the install partition
    blade8:~ # fdisk /dev/sdb
    
    The number of cylinders for this disk is set to 8924.
    There is nothing wrong with that, but this is larger that 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
    
    Command (m for help): n
    Command action
        e   extended
        p   primary partition (1-4)
              p
              Partition number (1-4) : 1
              First cylinder (1-8924, default 1):
              Using default value 1
              Last cylinder or +size or +sizeM or +sizeK (1-8924, default 8924) : 900
              Command (m for help):
  4. Type n to create another partition (the OS partition) as shown in Listing 2:
    Listing 2. Create the OS partition
             Command (m for help): n
             Command action
                   e   extended
                   p   primary partition (1-4)
              p
              Partition number (1-4) : 2
              First cylinder (901-8924, default 901):
              Using default value 901
              Last cylinder or +size or +sizeM or +sizeK (1-8924, default 8924) : 
              Using default value 8924
              
              Command (m for help):

    Don't put any data in this partition; this partition will be formatted during SUSE installation.
  5. Type a to toggle the bootable flag on the first partition (the install partition) as shown in Listing 3. Choose to make partition 1 bootable.
    Listing 3. Make install partition bootable
    Command (m for help): a
    Partition number (1-4) : 1
  6. Type w to write all the partition information to the table and exit the partition as shown in Listing 4:
    Listing 4. Write the partition information
    Command (m for help): w
    The partition table has been altered;
    
    Calling ioctl() to re-read partition table.
    Syncing disks.

    This will commit the changes to disk.

You have now successfully partitioned disk B.


Step 3. Format the partition

Format the first partition of disk B with the ext3 file system:

Listing 5. Format the first partition
blade8:~ # mkfs.ext3 /dev/sdb1
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2) 
Fragment size=4096 (log=2)
904960 inodes, 1807304 blocks
90365 blocks (5.00%) reserved for the super user
First data block=0
56 block groups
32768 blocks per group, 32768 fragments per group
16160 inodes per group
Superblock backups stored on blocks:
       32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

The filesystem will be automatically checked every 37 mounts or 180 days, 
whichever comes first. Use tune2fs -c or -I to override.

Step 4. Install the grub loader

Install the grub loader in the first partition of disk B as follows:

  1. Mount the first partition to a folder, such as /mnt/sdb. Run mount /dev/sdb1 /mnt/sdb.
  2. Copy the grub boot file from the folder /boot/grub to the folder /mnt/sdb/boot/; include the grub stage files and the grub configuration file.
  3. Type the following command to install grub on the first partition of disk B as shown in Listing 6: grub-install --root-directory=/mnt/sdb /dev/sdb1 -recheck:
    Listing 6. Install grub
    blade8:~ # grub-install -root-directory=/mnt/sdb /dev/sdb1 -recheck
    Probing devices to guess BIOS drives. This may take a long time.
    Installation finished. No error reported.
    This is the contents of the device map /mnt/sdb/boot/grub/device.map.
    Check if this is correct or not. If any of the line is incorrect,
    Fix it and re-run the script 'grub-install'.
    
    (fd0)   /dev/fd0
    (hd0)   /dev/sda
    (hd1)   /dev/sdb

You have successfully made disk B's install partition bootable with grub. Next, you need to configure grub to start the SUSE installation program when the disk is booted. First, you'll copy the installer's kernel and initrd files to the install partition, and then you'll prepare the grub configuration file.


Step 5. Prepare the kernel for installation

Prepare the kernel for installation by copying the install kernel from SUSE install ISO file. Create a folder /mnt/sdb/boot, then copy files linux and initrd from ISO file folder /boot/i386/loader/ to the new folder.


Step 6. Prepare the Linux installation image files

Prepare the Linux installation image files by creating a folder /mnt/sdb/SUSE, then copy all of the files in the SUSE ISO image to the new folder.

Note: You must copy the contents of the ISO to the directory. It seems SUSE 10 doesn't support the direct use of the ISO file here. The system will not be able to find the installation source file if you put only an ISO file here.


Step 7. Prepare for SUSE installation

Now prepare the autoinst.xml file for SUSE installation. Create the autoinst.xml file using yast autoinstallation. You'll need to make changes to these two parts of the file:

  1. Add a section in the bootloader part so that the user can select this boot menu to boot the system. The system will start to install the OS again and will return back to the initial status. Add the following code to the bootloader part:
    Listing 7. Update the bootloader section
      <bootloader>
        <sections>
    		...
    	  <section>
            <append>ramdisk_size=8192 install=hd://sda1/SUSE 
              autoyast=file:///mounts/extra/autoinst.xml splash=silent showopts</append>
            <initrd>(hd0,0)/boot/initrd</initrd>
            <kernel>(hd0,0)/boot/linux</kernel>
            <lines_cache_id>3</lines_cache_id>
            <name>SUSE Linux Enterprise Server 10 Installation</name>
            <original_name>install</original_name>
            <root>/dev/sda1</root>
            <type>image</type>
          </section>
    		...
        </sections>
      </bootloader>

    Note: If a user chooses to boot from this menu, all the data in the disk will be lost, and the installation will format the user partitions.

  2. Change the partition part of the file to make sure the installation does not create and format partition 1; this also allows the partition to be hidden in the system. Here is the partition part of autoinst.xml file I used:
    Listing 8. Update the partition section
      <partitioning config:type="list">
        <drive>
          <device>/dev/sda</device>
          <partitions config:type="list">
            <partition>
    		  <create config:type="boolean">false</create>
              <filesystem config:type="symbol">ext3</filesystem>
              <format config:type="boolean">false</format>
              <partition_id config:type="integer">131</partition_id>
              <partition_nr config:type="integer">1</partition_nr>
              <partition_type>primary</partition_type>
              <size>7402719232</size>
            </partition>
            <partition>
              <filesystem config:type="symbol">swap</filesystem>
              <format config:type="boolean">true</format>
              <mount>swap</mount>
              <partition_id config:type="integer">130</partition_id>
              <partition_nr config:type="integer">2</partition_nr>
              <partition_type>primary</partition_type>
              <size>auto</size>
            </partition>
            <partition>
              <filesystem config:type="symbol">reiser</filesystem>
              <format config:type="boolean">true</format>
              <mount>/</mount>
              <partition_id config:type="integer">131</partition_id>
              <partition_nr config:type="integer">3</partition_nr>
              <partition_type>primary</partition_type>
              <size>max</size>
            </partition>
          </partitions>
          <use>all</use>
        </drive>
      </partitioning>

We'll use the whole disk, but we won't create and format the first partition. You can customize the partition configurations, but remember: do not create and format the first partition.


Step 8. Copy the install config file

Copy the SUSE silent installation configuration file autoinst.xml to /mnt/sdb, the folder that disk B is mounted to.


Step 9. Create/modify the grub config file

Create the grub configuration file /mnt/sdb/boot/grub/menu.lst, and add the following content:

Listing 9. Update the grub configuration file
color white/blue black/light-gray
default
timeout 30

title SUSE Linux Enterprise Server 10 Installation
  root (hd0,0)
  kernel /boot/linux root=/dev/sda1 ramdisk_size=8192 
   install=hd://sda1/SUSE autoyast=file:///mounts/extra/autoinst.xml 
   splash=silent showopts
  initrd /boot/initrd

Notes on Step 9:

  • The system will find the installation image from the disk, and the installation image location protocol is hd, which means hard disk.
  • The protocol for autoyast should be file not device. (The protocol doesn't work, but the autoyast document says it supports device: I think this is a bug in SUSE).
  • The system will mount the first partition to folder /mounts/extra during installation, so the system needs to find the autoyast file in folder /mounts/extra.
  • We can't use append to add the parameter for kernel here.

After you complete Step 9:

  • Power off System A and unplug disk B from it.
  • Plug disk B in System B as the first disk.
  • Power on System B, and System B will start to install SUSE. Wait for System B to install the OS; System B will reboot once during installation and finish the installation automatically.
  • System B is ready for use now.

If the user wants the system to be restored to the initial status, the user can select the menu item SUSE Linux Enterprise Server 10 Installation during system booting, and the system will format the user's partition and install SUSE on the user's partition.

And you're done!


Conclusion

These steps have walked you through preparing a bootable self-installing hard disk drive. The system using this drive will automatically start to install the OS when system is booted, and the installation process will automatically detect the hardware and make changes as needed. This process is more flexible than simply installing the SUSE on the disk and letting the system boot from it.

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Linux on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux
ArticleID=295760
ArticleTitle=Prepare a self-installing drive for blade servers
publish-date=03182008