Linux Recovery

Here’s another version of recovery.html that I put into the Compaq ProLiant Linux Installation HOWTO version 0.7 March 2001. I believe this is a really short way of describing how to do the recovery. I’ll leave the old sections below this in case you need more detailed information.

Recovering LILO using Original Installation Media

  1. Boot the server using the same installation media that was originally used to install the system.
  2. Use the Linux installation program to load your SCSI device drivers.

    Note: Be very careful about choosing the type of install. In certain versions of Linux, including Red Hat, you may have choices for “Custom”, “Workstation”, “Server”, etc. Any choice other than “Custom” will erase existing partitions.

  3. When the Linux installer program asks “What type of installation would you like to perform?” choose “Custom”.

    Note: Be very careful about choosing the type of install. In certain versions of Linux, including Red Hat, you may have choices for “Custom”, “Workstation”, “Server”, etc. Any choice other than “Custom” will erase existing partitions.

  4. Access the BASH# prompt by pressing CTRL+ALT+F2 from the GUI or ALT+F2 from a text based screen. Pressing this key combination will switch you away from the installer screen (usually F1 for text based and F7 for GUI based) to the 2nd virtual console where the BASH# prompt is located during installation. You may be unable to access the BASH# prompt until you proceed to the “Welcome” screen.
  5. Once you reach the BASH# prompt, make two directories: /mydev and /mymnt:
  6. 
    # mkdir /mydev
    # mkdir /mymnt
    

  7. Check the /dev directory for the device nodes needed for your SCSI controller. If the device nodes are not present in the /dev directory, then create them in the /mydev directory according to the Device Node Table below:
  8. Here is an example using entries for the cpqarray driver:

    
    # mknod /mydev/c0d0 b 72 0
    # mknod /mydev/c0d0p1 b 72 1
    # ...
    # mknod /mydev/c0d0p15 b 72 15
    

    Note: Make as many or as few device nodes as you need. Don’t waste time creating nodes for devices you don’t even have.

    Here is a table containing device node values for the first controller of the ide, sda, cpqarray, cciss, and md drivers.

    IDE   Regular SCSI   cpqarray   cciss   md
    hda b 3 0 sda b 8 0 c0d0 b 72 0 c0d0 b 104 0 md0 b 9 0
    hda1 b 3 1 sda1 b 8 1 c0d0p1 b 72 1 c0d0p1 b 104 1 md1 b 9 1
    hda2 b 3 2 sda2 b 8 2 c0d0p2 b 72 2 c0d0p2 b 104 2 md2 b 9 2
    hda3 b 3 3 sda3 b 8 3 c0d0p3 b 72 3 c0d0p3 b 104 3 md3 b 9 3
    hda4 b 3 4 sda4 b 8 4 c0d0p4 b 72 4 c0d0p4 b 104 4 md4 b 9 4
    hda5 b 3 5 sda5 b 8 5 c0d0p5 b 72 5 c0d0p5 b 104 5 md5 b 9 5
    hda6 b 3 6 sda6 b 8 6 c0d0p6 b 72 6 c0d0p6 b 104 6 md6 b 9 6
    hda7 b 3 7 sda7 b 8 7 c0d0p7 b 72 7 c0d0p7 b 104 7 md7 b 9 7
    hda8 b 3 8 sda8 b 8 8 c0d0p8 b 72 8 c0d0p8 b 104 8 md8 b 9 8
    hda9 b 3 9 sda9 b 8 9 c0d0p9 b 72 9 c0d0p9 b 104 9 md9 b 9 9
    hda10 b 3 10 sda10 b 8 10 c0d0p10 b 72 10 c0d0p10 b 104 10 md10 b 9 10
    hda11 b 3 11 sda11 b 8 11 c0d0p11 b 72 11 c0d0p11 b 104 11 md11 b 9 11
    hda12 b 3 12 sda12 b 8 12 c0d0p12 b 72 12 c0d0p12 b 104 12 md12 b 9 12
    hda13 b 3 13 sda13 b 8 13 c0d0p13 b 72 13 c0d0p13 b 104 13 md13 b 9 13
    hda14 b 3 14 sda14 b 8 14 c0d0p14 b 72 14 c0d0p14 b 104 14 md14 b 9 14
    hda15 b 3 15 sda15 b 8 15 c0d0p15 b 72 15 c0d0p15 b 104 15 md15 b 9 15
    hda16 b 3 16       md goes to 31

    If you need to access a 2nd drive on the same controller, here are the device node values for the second drive of the ide, sda, cpqarray, and cciss drivers:

    IDE   Regular SCSI   cpqarray   cciss
    hdb b 3 64 sdb b 8 16 c0d1 b 72 16 c0d1 b 104 16
    hdb1 b 3 65 sdb1 b 8 17 c0d1p1 b 72 17 c0d1p1 b 104 17
    hdb2 b 3 66 sdb2 b 8 18 c0d1p2 b 72 18 c0d1p2 b 104 18
    hdb3 b 3 67 sdb3 b 8 19 c0d1p3 b 72 19 c0d1p3 b 104 19
    hdb4 b 3 68 sdb4 b 8 20 c0d1p4 b 72 20 c0d1p4 b 104 20
    hdb5 b 3 69 sdb5 b 8 21 c0d1p5 b 72 21 c0d1p5 b 104 21
    hdb6 b 3 70 sdb6 b 8 22 c0d1p6 b 72 22 c0d1p6 b 104 22
    hdb7 b 3 71 sdb7 b 8 23 c0d1p7 b 72 23 c0d1p7 b 104 23
    hdb8 b 3 72 sdb8 b 8 24 c0d1p8 b 72 24 c0d1p8 b 104 24
    hdb9 b 3 73 sdb9 b 8 25 c0d1p9 b 72 25 c0d1p9 b 104 25
    hdb10 b 3 74 sdb10 b 8 26 c0d1p10 b 72 26 c0d1p10 b 104 26
    hdb11 b 3 75 sdb11 b 8 27 c0d1p11 b 72 27 c0d1p11 b 104 27
    hdb12 b 3 76 sdb12 b 8 28 c0d1p12 b 72 28 c0d1p12 b 104 28
    hdb13 b 3 77 sdb13 b 8 29 c0d1p13 b 72 29 c0d1p13 b 104 29
    hdb14 b 3 78 sdb14 b 8 30 c0d1p14 b 72 30 c0d1p14 b 104 30
    hdb15 b 3 79 sdb15 b 8 31 c0d1p15 b 72 31 c0d1p15 b 104 31
    hdb16 b 3 80      

    If you need to access to a 2nd array controller, here are the device node values for the second array controllers:

    cpqarray   cciss
    c1d0 b 73 0 c1d0 b 105 0
    c1d0p1 b 73 1 c1d0p1 b 105 1
    c1d0p2 b 73 2 c1d0p2 b 105 2
    c1d0p3 b 73 3 c1d0p3 b 105 3
    c1d0p4 b 73 4 c1d0p4 b 105 4
    c1d0p5 b 73 5 c1d0p5 b 105 5
    c1d0p6 b 73 6 c1d0p6 b 105 6
    c1d0p7 b 73 7 c1d0p7 b 105 7
    c1d0p8 b 73 8 c1d0p8 b 105 8
    c1d0p9 b 73 9 c1d0p9 b 105 9
    c1d0p10 b 73 10 c1d0p10 b 105 10
    c1d0p11 b 73 11 c1d0p11 b 105 11
    c1d0p12 b 73 12 c1d0p12 b 105 12
    c1d0p13 b 73 13 c1d0p13 b 105 13
    c1d0p14 b 73 14 c1d0p14 b 105 14
    c1d0p15 b 73 15 c1d0p15 b 105 15
       

    This same patterns continue for the following device nodes:


    IDE
    /dev/hda b 3 0 to 16
    /dev/hdb b 3 64 to 80
    /dev/hdc b 22 0 to 16
    /dev/hdd b 22 64 to 80
    /dev/hde b 33 0 to 16
    /dev/hdf b 33 64 to 80
    /dev/hdg b 34 0 to 16
    /dev/hdh b 34 64 to 80
    IDE device nodes go span /dev/hda to /dev/hdt
    = 20 ide drives

    SCSI
    /dev/sda b 8 0 to /dev/sda15 b 8 15
    /dev/sdb b 8 16 to /dev/sdb15 b 8 31
    /dev/sdc b 8 32 to 47
    /dev/sdd b 8 48 to 63
    /dev/sde b 8 64 to 79
    /dev/sdf b 8 80 to 95

    /dev/sdp b 8 240 to /dev/sdp15 b 8 255
    /dev/sdq b 65 0 to /dev/sdq15 b 65 15
    /dev/sdz b 65 144 to /dev/sdz15 b 65 159
    /dev/sdaa b 65 160 to /dev/sdaap15 b 65 175
    /dev/sdab b 65 176 to /dev/sdabp15 b 65 191

    /dev/sdaf b 65 240 to /dev/sdafp15 b 65 255

    SCSI drives span the following:
    /dev/sda to /dev/sdz
    /dev/sdaa to /dev/sdaz
    /dev/sdba to /dev/sdbz
    /dev/sdca to /dev/sdcz
    /dev/sdda to /dev/sddx
    = 128 SCSI drives

    IDA
    /dev/ida/c0d0 b 72 0 to /dev/ida/c0d0p15 b 72 15
    /dev/ida/c0d1 b 72 16 to 31
    /dev/ida/c0d2 b 72 32 to 47
    /dev/ida/c0d3 b 72 48 to 63
    /dev/ida/c0d4 b 72 64 to 79

    /dev/ida/c0d15 b 72 240 to /dev/ida/c0d15p15 b 72 255
    /dev/ida/c1d0 b 73 0 to /dev/ida/c1d15p15 b 73 255
    /dev/ida/c2d0 b 74 0 to /dev/ida/c2d15p15 b 74 255
    /dev/ida/c3d0 b 75 0 to /dev/ida/c3d15p15 b 75 255
    /dev/ida/c4d0 b 76 0 to /dev/ida/c4d15p15 b 76 255
    /dev/ida/c5d0 b 77 0 to /dev/ida/c5d15p15 b 77 255
    /dev/ida/c6d0 b 78 0 to /dev/ida/c6d15p15 b 78 255
    /dev/ida/c7d0 b 79 0 to /dev/ida/c7d15p15 b 79 255
    = 8 controllers with 15 logical drives each

    CCISS
    /dev/cciss/c0d0 b 104 0 to /dev/ida/c0d0p15 b 104 15
    /dev/cciss/c0d1 b 104 16 to 31
    /dev/cciss/c0d2 b 104 32 to 47
    /dev/cciss/c0d3 b 104 48 to 63
    /dev/cciss/c0d4 b 104 64 to 79

    /dev/cciss/c0d15 b 104 240 to /dev/cciss/c0d15p15 b 104 255
    /dev/cciss/c1d0 b 105 0 to /dev/cciss/c1d15p15 b 105 255
    /dev/cciss/c2d0 b 106 0 to /dev/cciss/c2d15p15 b 106 255
    /dev/cciss/c3d0 b 107 0 to /dev/cciss/c3d15p15 b 107 255
    /dev/cciss/c4d0 b 108 0 to /dev/cciss/c4d15p15 b 108 255
    /dev/cciss/c5d0 b 109 0 to /dev/cciss/c5d15p15 b 109 255
    /dev/cciss/c6d0 b 110 0 to /dev/cciss/c6d15p15 b 110 255
    /dev/cciss/c7d0 b 111 0 to /dev/cciss/c7d15p15 b 111 255
    = 8 controllers with 15 logical drives each

    MD
    /dev/md0 b 9 0 to /dev/md31 b 9 31

    The first and second floppy drives are noted by the following:

    /dev/fd0 b 2 0
    /dev/fd1 b 2 1

  9. Use “fdisk -l” to get a listing of your partitions
  10. Here is an example using fdisk to list partitions on an array controller:

    
    # fdisk -l /mydev/c0d0
    

  11. Mount your root partition to /mymnt. You will know which partition is your root partition because it will contain etc/fstab.

    Here is an example mounting a root partition. In this example partition 6 is our root partition.

  12. 
    # mount /mydev/c0d0p6 /mymnt
    # ls /mymnt/etc/fstab
    

    Note: If “ls” does not list the fstab file, then the partition mounted is probably not the root partition. Unmount that partition and then try another partition until the root partition is found.

    If “e2label” is present, it may be helpful in determining which partition is which.

    Here is an example of using e2label on partition number 5:

    
    # e2label /dev/c0d0p5
    

    e2label should then respond with what mount point c0d0p5 uses. It is possible that e2label may not be available. It is also possible that the partitions may not have been labeled with e2label.

  13. Once you have your root partition mounted, mount the rest of your partitions according to the contents of etc/fstab.
  14. 
    # cat /mymnt/etc/fstab
    # mount /mydev/c0d0p7 /mymnt/usr
    # mount /mydev/c0d0p1 /mymnt/boot
    

  15. Use chroot to make /mymnt your new temporary root partition.
  16. 
    # /mymnt/usr/sbin/chroot /mymnt
    

  17. Su to root
  18. 
    # su -
    

  19. Now make necessary repairs to your system. This usually involves repairing /etc/lilo.conf and possibly /etc/fstab. If there is anything kernel related you would need to do in order to bring the system up, then do that now as well.
  20. 
    # cat /etc/lilo.conf
    # cat /etc/fstab
    # /sbin/lilo
    

  21. Once all repairs have been made, then lets exit out of the repair mode.
    1. Exit from su –
    2. 
      # exit
      

    3. Exit from chroot
    4. 
      # exit
      

    5. Unmount all partitions you mounted
    6. Use the mount command to list partitions you have mounted.

      
      # mount
      

      Use the umount command to unmount partitions.

      
      # umount /mymnt/boot
      # umount /mymnt/usr
      # umount /mymnt
      

  22. Reboot. It is not necessary to do anything about /mymnt, /mydev, nor their contents as these directories and device nodes were created in a ram disk. As soon as you reboot the computer will discard the contents of the ram disk.


Below this line is more detailed information. The above section should allow you to recover your system; however, if you need more information, then you may read on for more details. I believe that the above section concisely describes how to recover your system using only the installation media.


The Quick Version of the Recovery HOWTO:

Here’s the short “sweet and simple” version of recovery on Linux. The long version is located in this document as well.

This is mainly for Red Hat Linux but this concept does work on other versions (I’ve personally seen it work on Slackware and Corel Linux). I believe that it works for Caldera and SuSE as well.

If you don’t have recovery media then this section is for you.

  • Boot as you normally do to perform an install on this system.
  • Load the drivers you need to access your hard drives (IDE/SCSI/CPQARRAY/etc…)
  • Get to the bash prompt on console #2 (CTRL+ALT+F2) – this usually doesn’t show up until the 2nd stage installer is loaded
  • DO NOT go into the fdisk/disk druid sections of the installation program
  • Make a directory to hold your device nodes
  • mkdir /mydev
  • Make the device nodes you need for your system. The common major numbers are IDE=3, SCSI=8, CPQARRAY=72
  • #Examples of IDE device nodes
    mknod /mydev/hda b 3 0
    mknod /mydev/hda1 b 3 1
    mknod /mydev/hda6 b 3 6
    
    #Examples of SCSI device nodes
    mknod /mydev/sda b 8 0
    mknod /mydev/sda1 b 8 1
    mknod /mydev/sda6 b 8 6
    
    #Examples of Cpqarray device nodes
    mknod /mydev/c0d0 b 72 0
    mknod /mydev/c0d0p1 b 72 1
    mknod /mydev/c0d0p6 b 72 6
    
  • Make a directory to mount your partitions
  • mkdir /mymnt
  • Mount the partitions you need (/, /boot, /usr, etc…), be sure to mount your root partition first, then the others.
  • mount /mydev/sda6 /mymnt
    mount /mydev/sda1 /mymnt/boot
    
  • Chroot into your hard drive
  • /mymnt/usr/sbin/chroot /mymnt
  • su to root to get environment variables and paths
  • su -
  • inspect /etc/fstab
  • inspect /etc/lilo.conf
  • Fix anything else you need to at this point
  • run /sbin/lilo
  • exit from su –
  • exit from chroot
  • unmount the partitions you mounted
  • cd /
    umount /mymnt/boot
    umount /mymnt
    
  • Reboot
  • CTRL+ALT+DEL

The Long Version of the Recovery HOWTO

This recovery process involves booting with your Linux boot diskette or your Linux install CD, mounting your root and /boot partitions, correcting /etc/lilo.conf and /etc/fstab, then putting out a fresh copy of LILO by running /sbin/lilo. You may find that “/usr/sbin/chroot” will help you out during this process.

Currently, the only section tested in this document is the one about recovering using the Red Hat 6.0 CD method. The other methods have been pulled from memory and may have some items that don’t line up with the real world. In essence it is the same thing as booting from the Red Hat 6.0 CD, it is just a lot easier to do it from the floppy (even easier if you can bring your Linux system all the way up with your boot floppy). All in all, the concept is still the same.

This document discusses three methods for recovering your system if LILO is no longer pointing to your boot and root directories. 1) LILO no longer works on the hard drive, but my system boots with my boot diskette 2) I have a boot diskette for my system 3) I don’t have a boot diskette for my system.

If you are able to boot your Linux system from floppy then proceed to the section marked “Recovering LILO from within Linux.”

If you have a boot disk but are unable to bring Linux up, then see the section marked “How to recover LILO by using your Boot and Root disk for your System.”

If you don’t have a boot diskette, then see the section marked “How to recover LILO without a Boot and Root disk for your System.”


Recovering LILO from within Linux



If you are forced to use your boot diskette to boot Linux on your system every time because LILO on your hard drive doesn’t work, then you can change this by repairing LILO. You just need to boot your system, edit your /etc/lilo.conf and /etc/fstab, then run /sbin/lilo to put out a fresh LILO into the /boot partition. Make sure that your /boot partition is the only partition made active and is a primary partition.


How to recover LILO by using your Boot and Root disk for your System

If you don’t have your boot and rescue floppies, you can then try to recover your system by going to the section marked “How to recover LILO without a Boot and Root disk for your System.” If you do have the boot and rescue disks for your system, then you can use this section.

This section is under construction. I am doing this step here from memory. I don’t currently have a valid boot disk for my system, but since I have been through the process once or twice, I will go ahead and give you what info I have. I will give more precise details later once I double check these steps.

Boot with your Linux Boot Disk that you created during your install, or after you installed (not the Red Hat Installation Boot Disk). Type “rescue” at the “LILO:” prompt. It will finally ask you for the rescue diskette (created from the images directory from the Installation CD).

In one of the directories (probably /dev or /tmp) you will find device nodes which point to your hard drive and partitions. Make a mount point (empty directory, preferably under /mnt), then mount your root (“/”) partition into the your mount point. Next mount your /boot partition into your mounted root (“/”) partition.

You should now be able to do a chroot into your mount point which holds your root (“/”) partition, then do a “cd /” to get you to the root directory of your root partition (sometimes running chroot, gives strange results if you don’t follow that command with a “cd /”).

Make corrections to /etc/lilo.conf and /etc/fstab, save your changes, then run /sbin/lilo to put out a fresh copy of LILO.

You should now be able to type “exit” followed by a “cd /” to get out of the chroot shell. Now unmount your /boot partition, then unmount your root partition. Now reboot, pull all floppies and CD’s. You should now be able to boot with LILO on the hard drive.

The process should go a little like this:

#get a mount point
mkdir -p /mnt/drive

#mount your root partition
mount /dev/sda6 /mnt/drive

#mount your /boot partition
mount /dev/sda2 /mnt/drive/boot

#chroot to /mnt/drive
chroot /mnt/drive

#su to root to bring in environment variables and paths
su -

You can print your partitions in fdisk to see what numbers you should be using in /etc/lilo.conf and /etc/fstab

edit your /etc/lilo.conf and /etc/fstab, make sure you have the correct partition numbers listed there

save your files (/etc/lilo.conf and /etc/fstab)

#put out a fresh copy of LILO
/sbin/lilo

#exit from su -
exit

#exit from your chroot shell
exit

#unmount your boot and root partitions
cd /
umount /mnt/drive/boot
umount /mnt/drive

#reboot (CTRL+ALT+DEL)
CTRL+ALT+DEL

pull all cd’s and floppies

Your Linux system should come back up on the hard drive if you properly configured /etc/lilo.conf and /etc/fstab and then ran /sbin/lilo.

If your system didn’t come up, then go back and make sure that /etc/lilo.conf and /etc/fstab are correctly set up. Be sure to run /sbin/lilo once you make your changes.


How to recover LILO without a Boot and Root disk for your System

The purpose of this document is to show how to restore the ability to boot Linux from your hard drive. This is usually accomplished by using your boot and rescue (sometimes called boot and root floppies). On occasion, you may not have your boot and rescue (boot and root) floppies or they may be damaged. This section of the document covers booting your system with your Red Hat 6.0 CD and gaining access to your system, very similar to the way you would use your boot and rescue floppies.

If you have working copies of your boot diskette for your system, then by all means use that method instead of the Red Hat 6.0 installation CD. See the section labeled “How to recover LILO by using your Boot and Root disk for your System” for instructions on how to do that.

During this example, we will be using boot and root partitions on a SCSI hard drive, denoted by /dev/sda. If you have some other type of hard drive controller, then use the appropriate name and parameters for that device. You will find a table below, listing devices, and parameters. Before we get started, we will start off with a few definitions.

Device Nodes:

A device node is a name that references a specific device. The name is meaningless, it is just a collection of parameters. It is best to use the correct name when possible as it helps you to remember what device you are working with. Device names usually are one of the following: /dev/sda, /dev/ida/c0d0, /dev/hda. A complete device node consists of a Major and Minor number and a type specification (block or character).

Major & Minor Numbers:

Devices nodes have major and minor numbers. A major number would be the class of the device, the minor number would be the specific device. You have to get the correct major and minor number to speak with the correct device. For example Major 8 and Minor 0 would reference the first SCSI disk drive (actually references the whole disk or the MBR). If you run fdisk on this device, then you will be partitioning /dev/sda. Major 72 and Minor 0 would reference the first disk on the first Compaq array controller (again, it actually references the whole disk or the MBR).

Block or Character Devices:

Since we are dealing with hard drives and those partitions, we will be dealing with block devices. Basically block or character is the way you communicate to a specific device. I will not explain the difference between block and character, I will only inform you that for dealing with hard drives, we will be using block devices.

Table of devices:

Here is an example of how to create a complete listing of nodes for /dev/sda. Note that it starts with the MBR, then the 1st partition, then all the way to the 15th partition. Device letters for SCSI disks go all the way from “a” to “p”. You are allowed 15 partitions per drive.

mknod /mnt/sda b 8 0
mknod /mnt/sda1 b 8 1
mknod /mnt/sda2 b 8 2
mknod /mnt/sda3 b 8 3
mknod /mnt/sda4 b 8 4
mknod /mnt/sda5 b 8 5
mknod /mnt/sda6 b 8 6
mknod /mnt/sda7 b 8 7
mknod /mnt/sda8 b 8 8
mknod /mnt/sda9 b 8 9
mknod /mnt/sda10 b 8 10
mknod /mnt/sda11 b 8 11
mknod /mnt/sda12 b 8 12
mknod /mnt/sda13 b 8 13
mknod /mnt/sda14 b 8 14
mknod /mnt/sda15 b 8 15

If you need to access /dev/sdb, those parameters look like:

mknod /mnt/sdb b 8 16
mknod /mnt/sdb1 b 8 17
mknod /mnt/sdb15 b 8 31
mknod /mnt/sdc b 8 32
mknod /mnt/sdc1 b 8 33
mknod /mnt/sdc15 b 8 47
mknod /mnt/sdd b 8 48
mknod /mnt/sdd1 b 8 49
mknod /mnt/sdd15 b 8 63

This follows all the way to /dev/sdp15 (i.e. /dev/sda uses letters from "a" to "p")

mknod /mnt/sdp b 8 240
mknod /mnt/sdp1 b 8 241
. . .
mknod /mnt sdp15 b 8 255

The Compaq Smart Array (/dev/ida/c0d0) has a script that will create them located at “/usr/src/linux/Documentation/mk2dev.ida“. You can also create them by hand as follows:

mknod /mnt/c0d0 b 72 0
mknod /mnt/c0d0p1 b 72 1
mknod /mnt/c0d0p2 b 72 2
mknod /mnt/c0d0p3 b 72 3
mknod /mnt/c0d0p4 b 72 4
mknod /mnt/c0d0p5 b 72 5
mknod /mnt/c0d0p6 b 72 6
mknod /mnt/c0d0p7 b 72 7
mknod /mnt/c0d0p8 b 72 8
mknod /mnt/c0d0p9 b 72 9
mknod /mnt/c0d0p10 b 72 10
mknod /mnt/c0d0p11 b 72 11
mknod /mnt/c0d0p12 b 72 12
mknod /mnt/c0d0p13 b 72 13
mknod /mnt/c0d0p14 b 72 14
mknod /mnt/c0d0p15 b 72 15
mknod /mnt/c0d15 b 72 240
mknod /mnt/c0d15p1 b 72 241
. . .
mknod /mnt/c0d15p15 b 72 255
mknod /mnt/c1d0 b 73 0
mknod /mnt/c1d0p1 b 73 1
. . .
mknod /mnt/c1d0p15 b 73 15
mknod /mnt/c2d0 b 74 0
. . .
mknod /mnt/c2d15p15 b 74 255

For some strange reason, you get 16 partitions out of /dev/hda (ide devices) instead of 15 out of /dev/sda (SCSI devices) and /dev/ida/c0d0 (Compaq Array Controller Devices). The last ide device stops at “h” (/dev/hdh16).

mknod /mnt/hda b 3 0
mknod /mnt/hda1 b 3 1
mknod /mnt/hda16 b 3 16
mknod /mnt/hdb b 3 64
mknod /mnt/hdb16 b 3 80
mknod /mnt/hdc b 22 0
mknod /mnt/hdc16 b 22 16
mknod /mnt/hdd b 22 64
mknod /mnt/hdd16 b 22 80
mknod /mnt/hde b 33 0
mknod /mnt/hde16 b 33 16
mknod /mnt/hdf b 33 64
mknod /mnt/hdf16 b 33 80
mknod /mnt/hdg b 34 0
mknod /mnt/hdg16 b 34 16
mknod /mnt/hdh b 34 64
mknod /mnt/hdh16 b 34 80

Now lets get started with the Repair:

Boot to the Red Hat 6.0 CD and let it detect your SCSI controllers:

  • Go through the following screens: Welcome, “English”, “US”, “Local CDRom”, “Install”, “Custom”
  • The installation will then start detecting your embedded SCSI.
  • The installation will ask you “Do you have any more SCSI adapters on your system?”

At this point go to your BASH# screen by pressing Left Alt+F2

Lets create the /mnt directory since it doesn’t exist (if /mnt/exists for you then create some other directory, such as /mnt1, and use it throughout the following example):

mkdir /mnt

Let’s create a pointer to your SCSI hard drive (Remember, if you your /boot and root partitions on another device that is not a SCSI hard drive (/dev/sda), then get the appropriate device, and parameters from the above “Device Table”).

The following will create pointers to your SCSI hard drive:

mknod /mnt/sda b 8 0

You can use fdisk /mnt/sda to see how many partitions you have and which ones are where (use “p” to list your partitions). Don’t make any changes in fdisk, just find your root and /boot partitions. In this example, mine are /boot = #2 and root = #6.

Use the following commands to add the partitions you need (it doesn’t hurt to add device nodes for all 15 partitions, it’s just a lot of work by hand to do all 15)

mknod /mnt/sda1 b 8 1
mknod /mnt/sda2 b 8 2
mknod /mnt/sda3 b 8 3
mknod /mnt/sda4 b 8 4
mknod /mnt/sda5 b 8 5
mknod /mnt/sda6 b 8 6
mknod /mnt/sda7 b 8 7
mknod /mnt/sda8 b 8 8
mknod /mnt/sda9 b 8 9
mknod /mnt/sda10 b 8 10
mknod /mnt/sda11 b 8 11
mknod /mnt/sda12 b 8 12
mknod /mnt/sda13 b 8 13
mknod /mnt/sda14 b 8 14
mknod /mnt/sda15 b 8 15

Do a long listing of these nodes to make sure their values are correct. You will see the major and minor numbers listed separated by a comma. If any are incorrect then remove the file (rm /mnt/sda…) and create a new node with the proper value

ls -l /mnt

Make a directory to mount your root partition

mkdir /mnt/drive

Make sure it has 0755 permissions (use “chmod 0755 /mnt/drive” to fix if needed)

ls -l /mnt

-rwxr-xr-x . . . . . . drive

#Mount your root partition onto /mnt/drive
mount /mnt/sda6 /mnt/drive

#Make sure /mnt/drive/boot exists
ls -l /mnt/drive

#Make sure /mnt/drive/boot has 0755 permissions
ls -l /mnt/drive

-rwxr-xr-x . . . . . . boot

#Mount your /boot partition into /mnt/drive/boot
mount /mnt/sda2 /mnt/drive/boot

Since you have access to your full system (root and /boot partitions), you can then change those to be your root directory.

/tmp/rhimage/misc/src/trees/rescue/bin/chroot /mnt/drive

#bring in environment variables and pathnames
su -

#Then you can enter /etc
cd /etc

#see if /etc/fstab needs any changes
less /etc/fstab

Be sure to make a backup copy of /etc/fstab before you edit it. If you mess it up, it will be difficult to recreate it without the original. Here is an example of making a copy of the /etc/fstab file and giving it a date stamp of today (as of this writing) as well.

#Making a backup of /etc/fstab
cp /etc/fstab /etc/fstab.old991008

#If you need to edit your fstab file, then do so.
pico /etc/fstab

#See if /etc/lilo.conf needs any changes
less /etc/lilo.conf

Be sure to make a backup copy of /etc/lilo.conf before you edit it. If /etc/lilo.conf gets messed up it too is somewhat hard to recreate but not impossible. Here is an example of backing up /etc/lilo.conf (I like to put the date as a part of the file name to know when I created the backup).

cp /etc/lilo.conf /etc/lilo.conf.old991008

#Edit your lilo.conf if you need to.
pico /etc/lilo.conf

After making your changes save and exit the files you changed.

Run “lilo” to put out a fresh copy of LILO to the boot record (This step may be necessary if LILO is damaged or you have moved partitions without changing their partition number).

#Run /sbin/lilo
/sbin/lilo

#exit from su -
exit

#exit from your chroot shell
exit

#unmount your /boot and root file systems.
cd /
umount /mnt/drive/boot
umount /mnt/drive

#reboot (CTRL+ALT+DEL)
CTRL+ALT+DEL

pull all cd’s and floppies

Your Linux system should come back up on the hard drive if you properly configured /etc/lilo.conf and /etc/fstab and then ran /sbin/lilo.

If your system didn’t come up, then go back and make sure that /etc/lilo.conf and /etc/fstab are correctly set up. Be sure to run /sbin/lilo once you make your changes.


prev next

Leave a Comment