SENECA COLLEGE OF APPLIED ARTS & TECHNOLOGY - SCHOOL OF COMPUTER STUDIES

OPS330 SCRIPTING & SOFTWARE INSTALLATION - LAB 10



Student Name:                                       Student ID:                                        Date:
Section ID:                                             Instructor Name:

Lab 10: LINUX LOADER LILO and Master Boot Record MBR

You should have the following with you at the start of the lab:

In this lab, you will backup the MBR, create a boot disk and remove LILO from the MBR.

The dd command that you are going to use in this lab is very powerful and dangerous.
Please check the dd command line carefully before you press the ENTER key.


Backing up the MBR

The following dd command can be a very useful command because it is very powerful. Therefore it can be very dangerous as well. dd will read and write to files in filesystems, but it can also access the raw sectors of a drive. In the following command, replace date with today's date (in the form of yyyymmdd).
1. Login to Linux as root and execute the command:

(a) dd if=/dev/hda of=/boot/mbr.date bs=512 count=1
 
 

dd Data Dump command
if=/dev/hda Input File is: /dev/hda (hda references the entire IDE primary master hard drive, not a partition or directory or file on the hard drive)
of=/boot/file Output File is: /boot/mbr.20001121 (this is the mbr file in the /boot directory)
bs=512 Block Size is 512 bytes (or one sector. Recall that the MBR is the first sector of the hard drive)
count=1 The number of Blocks (of size 512 bytes) to copy

The MBR contains bootup code for LILO (the first 446 bytes) and also 64 bytes of Partition Table information plus the last two bytes, AA55, which is the DOS disk signature. You've just made a backup copy of both.

(b) Now execute the 2nd dd command:

dd if=/dev/hda of=/boot/mbr.446.date bs=446 count=1
2. Run fdisk on /dev/hda using the command "fdisk -l /dev/hda" and write down the partition information below:
 
Device
Boot
Start
End
Block
ID
System
/dev/hda1
/dev/hda2
/dev/hda3
/dev/hda4
/dev/hda5
/dev/hda6
/dev/hda7
/dev/hda8
/dev/hda9
/dev/hda10

3. Insert a blank floppy.

(a) Format the floppy with: "fdformat /dev/fd0h1440"
(b) Create a Linux file system on the floppy: "mke2fs -O none /dev/fd0"
(c) mount the floppy to /floppy directory:"mount /dev/fd0 /floppy"
(d) copy all the mbr file in /boot directory to the floppy:" cp /boot/mbr* /floppy"
(e) do a directory listing on /floppy and verify that the two mbr files are there.
(f) issue the command: "fdisk -l /dev/hda > /floppy/part.info"
(g) umount the floppy and remove from the floppy drive.


4. Create a boot floppy with LILO (according to page 130 in the SuSE 7.1 Installation menu)

(a) Insert another blank floppy disk into the floppy drive
(b) Format the floppy by executing the command: "fdformat /dev/fd0h1440"
(c) Copy Linux kernel image: "dd if=/boot/vmlinuz of=/dev/fd0 bs=18k"
(d) Determine the root partition: rdev
    Output: _____________________
(e) Adjust the root device: rdev /dev/fd0 your_root_partition (result from (d))
(f) Instruct the boot disk to mounts root as readonly: rdev -R /dev/fd0 1
5. Shut down your Linux machine and try to boot from the boot floppy created in step 4. What is the first message displayed on the screen when your system boot from floppy?
 


Instructor checkpoint: Boot Floppy _____    MBR Backup Floppy: ________


Have your instructor check your boot floppy and MBR backup floppy before continue.

Before you continue on to step 6, make sure that you have a backup of any script/data files that you need on your hard drive.
You may make the files on your hard drive inaccessible even by making a very small mistake in any of the following steps.
Be careful with what you are doing!!


6. After you verify that you can boot your Linux from the boot floppy, remove the floppy disk and reboot your Linux. Login as root and issue the following command:
dd if=/dev/zero of=/dev/hda bs=446 count=1
Display the hard disk partition table by executing the command: "fdisk -l /dev/hda". Does it give the same partition information as in step 3?
 
(a) Reboot your machine, does it boot from your hard drive? What message do you get?
 
 

(b) Doesl it boot from the boot floppy you make in step 4?
 
 
 

7. If it boots from the floppy, login as root and issue the following command:
   dd if=/boot/mbr.446.date of=/dev/hda bs=446 count=1
   and reboot your Linux box. Does it boot from hard drive now?
 
 
 

8. If you can boot your system from hard drive in step 7, login as root and issue the following command:

   dd if=/dev/zero of=/dev/hda bs=512 count=1 (This command will erase the MBR)
        Issue the command "fdisk -l /dev/hda" to display the partition information. What is the output?
 
 

9. Reboot your system again. Does it boot from hard drive now? Will it boot from your boot floppy?
 
 
 

10. Will your system boot from Toms Root Boot? Can you fix your system with the backup of MBR on the floppy? Write down the steps how you fix the problem. (Ask for help if you are not sure what you are doing. If you mess up your system, you have to re-install SuSE Linux with minimal package selection. The minimal installation may take about 15-20 minutes.)
 
 
 
 
 
 
 
 
 
 


Instructors Check:

(Fix in step 10 ) ________________________

Please have your lab monitor check your installation and sign your lab sheets.

© SENECA COLLEGE Version 200107