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
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).
dto delete any existing partitions. You can skip this step if your disk is blank.
nto 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):
nto 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.
ato 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
wto 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:
- Mount the first partition to a folder, such as /mnt/sdb. Run
mount /dev/sdb1 /mnt/sdb.
- 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.
- 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:
- 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.
- 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
appendto 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!
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.
- "Automatic Linux Installation and Configuration with YaST2" is a comprehensive tutorial on the subject.
- "Configuring SUSE Linux on POWER5 to maximize performance" (developerWorks, April 2007) discusses virtual SCSI (VSCSI), which provides configuration and tuning parameters that can improve system performance.
- "Inside the Linux boot process" (developerWorks, May 2006) gives a guided tour from the Master Boot Record to the first user-space application.
- "Install SUSE Linux Enterprise Server 8 on a JS20 blade server" (developerWorks, August 2004) is a good Linux/blade server installation guide.
- In the developerWorks Linux zone, find more resources for Linux developers, and scan our most popular articles and tutorials.
- See all Linux tips and Linux tutorials on developerWorks.
- Stay current with developerWorks technical events and Webcasts.
Get products and technologies
- Get more information on IBM BladeCenter blade servers.
- With IBM trial software, available for download directly from developerWorks, build your next development project on Linux.
- Get involved in the developerWorks community through blogs, forums, podcasts, and community topics in our new developerWorks spaces.
Dig deeper into Linux on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.