home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Enter 1999 June / enter_06_1999.iso / doc / rescue.txt < prev    next >
Text File  |  1998-05-05  |  9KB  |  247 lines

  1. This document describes how rescue mode works in Red Hat Linux 5.1.
  2.  
  3. NOTE: Rescue mode is supported only for Red Hat Linux/Intel!
  4.  
  5. WHAT IS RESCUE MODE?
  6.  
  7. Rescue mode is a term used to describe a method of booting a small Linux
  8. environment completely from diskettes.
  9.  
  10. WHY IS THERE A RESCUE MODE?
  11.  
  12. As the name implies, rescue mode is there to rescue you from something.  In
  13. normal operation, your Red Hat Linux system uses files located on your
  14. system's hard drive to do everything -- run programs, store your files,
  15. etc.
  16.  
  17. However, there may be times when you are, for one reason or another, unable
  18. to get Linux running completely enough to access its files on your system's
  19. hard drive.  By using rescue mode, it's possible to access the files stored
  20. on your system's hard drive, even if you can't actually *run* Linux from
  21. that hard drive.
  22.  
  23. WHAT CAN I DO IN RESCUE MODE?
  24.  
  25. Normally, you'll need to get into rescue mode for one of two reasons:
  26.  
  27.     o You are unable to boot Linux, and you'd like to fix it.
  28.  
  29.     o You are having hardware or software problems, and you want to get a
  30.     few important files off your system's hard drive.
  31.  
  32. Let's a take a closer look at each these scenarios.
  33.  
  34. Unable to boot Linux -- Many times this is caused by the installation of
  35. another operating system after you've installed Red Hat Linux.  Some other
  36. operating systems assume that you have no other operating systems on your
  37. computer, and overwrite the Master Boot Record (or MBR) that originally
  38. contained the LILO bootloader.  If LILO is overwritten in this manner,
  39. you're out of luck -- unless you can get into rescue mode.
  40.  
  41. Hardware/Software problems -- There can be as many different situations
  42. under this category as there are systems running Linux.  Things like
  43. failing hard drives and forgetting to run LILO after building a new kernel
  44. are just two things than can keep you from booting Red Hat Linux.  If you
  45. can get into rescue mode, you might be able to resolve the problem -- or at
  46. least get copies of your most-important files.
  47.  
  48. WHAT DO I NEED TO GET INTO RESCUE MODE?
  49.  
  50. You need a rescue disk set.  These are two diskettes that contain the files
  51. necessary to boot into rescue mode.
  52.  
  53. HOW DO I PRODUCE A RESCUE DISK SET?
  54.  
  55. If you elected to make a boot disk while you were installing Red Hat Linux,
  56. you're halfway there!  The first diskette in a rescue disk set is this boot
  57. disk.  If you didn't make it, no problem; it's easy to do.  There's a
  58. program called "mkbootdisk" that does exactly that.  You probably installed
  59. it when you installed Red Hat Linux.  You can use the Red Hat Package
  60. Manager to find out if you did; simply type:
  61.  
  62.                              rpm -q mkbootdisk
  63.  
  64. If it returns something like "mkbootdisk-1.0-1", you're in business!  (If
  65. you got a message saying the package is not installed, and you're sure you
  66. entered the command properly, skip to the end of this document, and we'll
  67. help you get it installed.)
  68.  
  69. To make a boot disk with mkbootdisk, you need to know what version of the
  70. Linux kernel your system is running.  Enter the following command to find
  71. out:
  72.  
  73.                                  uname -r
  74.  
  75. This command should return a set of numbers -- something like "2.0.34".
  76. Write down that number, because you're going to need to enter it just as
  77. it's displayed.  Now it's time to run mkbootdisk.  The basic format of the
  78. mkbootdisk command is:
  79.  
  80.                            mkbootdisk <version>
  81.  
  82. Where <version> is the version of the running Linux kernel.  So if, for
  83. example, your system is running version 2.0.34, you should enter this
  84. command (make sure you're logged in as root):
  85.  
  86.                              mkbootdisk 2.0.34
  87.  
  88. You'll be asked to insert a diskette in your first diskette drive (the one
  89. your system tries to boot from when you turn on your computer).  Do so, and
  90. press <Enter>.  Your system's diskette drive should clunk away for a
  91. while.  After a minute or so, the command should be done.  Congratulations,
  92. you now have a boot diskette!  Remove it from your diskette drive, label it
  93. appropriately (keeping in mind that this diskette is customized for this
  94. *one* system), and store it someplace safe.  Now on to the second
  95. diskette...
  96.  
  97. The second diskette is called the rescue diskette.  It is the same for
  98. every system running Red Hat Linux 5.1.  It is produced by writing an
  99. "image file" onto a diskette.  The image file is called rescue.img, and is
  100. located in the images directory on the first Red Hat Linux CD-ROM.
  101.  
  102. To gain access to this file, you'll first need to mount your Red Hat Linux
  103. CD-ROM.  Start by inserting the CD-ROM in your system's CD-ROM drive.
  104. You'll need to do this while logged in as root.  Issue the following
  105. commands:
  106.  
  107.                              mkdir /mnt/cdrom
  108.                         mount /dev/cdrom /mnt/cdrom
  109.  
  110. You may get an error message from the first command saying that the file
  111. exists.  That's fine; we just want to make sure that there is a /mnt/cdrom
  112. directory on your system.  The second command should issue an informational
  113. message that /dev/cdrom is being mounted read-only (Note: some systems may
  114. not recognize /dev/cdrom.  If this is the case, you'll have to replace
  115. /dev/cdrom in the command with the appropriate device name for your
  116. CD-ROM).
  117.  
  118. Next, issue the following commands (again, while logged in as root):
  119.  
  120.                          cd /mnt/cdrom/images
  121.                                 ls
  122.  
  123. You should see a file named rescue.img.  This is the rescue diskette image
  124. file.  Next, put a diskette in your first diskette drive, and enter the
  125. following command:
  126.  
  127. dd if=rescue.img of=/dev/fd0 bs=1440k
  128.  
  129. Your system's diskette drive should start writing to the diskette.  After a
  130. minute or so, the "dd" command will complete, and you'll get a shell prompt
  131. back.  That's it!  You now have a rescue disk set.  Label this diskette
  132. something like "Red Hat Linux 5.1 rescue diskette", and store it someplace
  133. safe.  Let's hope you never have to use it.  But to make sure your rescue
  134. disk set is working properly, let's give them a try right now.  Shut your
  135. system down as you would normally ("shutdown -h now" works pretty well).
  136.  
  137. IF YOU HAVE TO USE RESCUE MODE
  138.  
  139. If you should ever need to use rescue mode, here's how.  Boot your system
  140. with the boot diskette in the first diskette drive.  At the "LILO Boot:"
  141. prompt, enter the word "rescue" (without the quotes).  You will see the
  142. usual kernel messages as the Linux kernel starts up.  Eventually, it will
  143. ask you to insert the next diskette, and press <Enter>.  Remove the boot
  144. diskette, insert the rescue diskette, and press <Enter>.
  145.  
  146. The rescue diskette will be read into memory.  After a minute or so, you
  147. should see a "bash#" prompt.  That's it -- you're in rescue mode!
  148.  
  149. WHAT DO I DO NOW?
  150.  
  151. When it comes to rescue mode, that's a bit like asking, "how long is a
  152. piece of string?" -- what you need to do depends a great deal on what your
  153. system's problem is, your level of Linux expertise, and several other
  154. variables we haven't even thought of yet.  So we can't give you explicit
  155. instructions.
  156.  
  157. But we *can* tell you what programs you have access to while in rescue
  158. mode.  Here's the list:
  159.  
  160. badblocks
  161. bash
  162. bzip2
  163. cat
  164. chmod
  165. chroot
  166. cp
  167. cpio
  168. dd
  169. e2fsck
  170. fdisk
  171. grep
  172. gunzip
  173. gzip
  174. head
  175. ifconfig
  176. init
  177. ln
  178. ls
  179. lsmod
  180. mkdir
  181. mke2fs
  182. mknod
  183. mount
  184. mt
  185. mv
  186. open
  187. pico
  188. ping
  189. ps
  190. restore
  191. rm
  192. route
  193. rpm
  194. sed
  195. sh
  196. swapoff
  197. swapon
  198. sync
  199. tac
  200. tail
  201. tar
  202. traceroute
  203. umount
  204. vi
  205. vim
  206.  
  207. If any of these commands are unfamiliar to you, now would be a good time to
  208. look at some man pages; you may not have that luxury when you have to use
  209. these commands for real...
  210.  
  211.                                          The Red Hat Linux Development Team
  212.  
  213. INSTALLING THE MKBOOTDISK PACKAGE
  214.  
  215. To gain access to this file, you'll first need to mount your Red Hat Linux
  216. CD-ROM.  Start by inserting the CD-ROM in your system's CD-ROM drive.
  217. You'll need to do this while logged in as root.  Issue the following
  218. commands:
  219.  
  220.                              mkdir /mnt/cdrom
  221.                         mount /dev/cdrom /mnt/cdrom
  222.  
  223. You may get an error message from the first command saying that the file
  224. exists.  That's fine; we just want to make sure that there is a /mnt/cdrom
  225. directory on your system.  The second command should issue an informational
  226. message that /dev/cdrom is being mounted read-only (Note: some systems may
  227. not recognize /dev/cdrom.  If this is the case, you'll have to replace
  228. /dev/cdrom with the appropriate device name for your CD-ROM).
  229.  
  230. Next, issue the following commands (again, while logged in as root):
  231.  
  232.                            cd /mnt/cdrom/images
  233.                                     ls
  234.  
  235. You should see a file with a name similar to:
  236.  
  237. mkbootdisk-1.0-1.i386.rpm
  238.  
  239. Enter the filename *exactly* as shown at the end of an "rpm -Uvh".  For
  240. example:
  241.  
  242.                     rpm -Uvh mkbootdisk-1.0-1.i386.rpm
  243.  
  244. The name of the package (mkbootdisk) will be displayed, followed by a
  245. series of pound signs (#).  After a short time, you'll get a shell prompt.
  246. The mkbootdisk package is now installed.  No you can head back to the place
  247. in this document where you left off, and create your boot diskette.