Linux fault recovery skills

Source: Internet
Author: User
Article title: linux fault recovery skills. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Author: Arthur Reid
  
No matter what operating system you are running, in many cases, you will face disaster recovery operations. Your primary boot area is overwritten, your hard disk cannot be started, or an important file is deleted, or your display card will flash black at startup. This article will give you some technical discussions on these issues, so that you will not be confused when encountering these problems.
  
The first thing you need is an emergency boot floppy disk. when installing Linux, you usually need to create one. Therefore, you should have this disk. if it has not been created yet, create one. what? I don't know how to do it? It is very simple. Generally, you can use the mkbootdisk command in Linux. If you look at the help of the following parameters, you should understand them.
  
Use
  
# Uname-
  
System prompt:
Linux Albert TXU 2.2.16-2.0 #1 Sun May 20 16:53:41 EST 2001 i586 unknown
  
Let's take a look at the kernel version of the system. The kernel version of the system is 2.2.16-2.0.
  
Then use
# Mkbootdisk -- device/dev/fd0 2.2.16-2.0
  
System prompt:
  
Insert a disk in/dev/fd0.any information on the disk will be lost.
Press to continue or ^ C to abort:
  
Insert a disk. wait for a while until the disk is created. In this way, an emergency start floppy disk is created.
  
In addition to the above method, another method is to use tomsrtbt to create a boot floppy disk. First, introduce the installation steps of this program:
  
# Gunzip tomsrtbt-1.7.218.tar.gz
# Tar-xvf tomsrtbt-1.7.218.tar
# Rm tomsrtbt-1.7.218.tar
# Cd tomsrtbt-1.7.218/
#./Install. s
  
According to the instructions on the screen, this software uses a high-density compression method to compress a variety of Linux tools to a single 1.7 Mb floppy disk.
  
The default disk contains the following programs, drivers, and kernels:
  
2.0.37 unzip BusLogic unzip EEXPRESS unzip EL2 EL3 EXT2 FAT FAT32 fd ide idecd idefloppy idepcmcia idetape ISO9660 joliet loop unzip minix msdos NE2000 nfs proc ram sd serial slip smc sr st tr ultra vfat vortex WD80x3 limit aha1542 aic7xxx ash awk badblocks bdflush bzip2 carw.cardmgr cat ce. help chattr chgrp chmod chown chroot clear cmp cp cpio cut date dd ddate running df dirname dmesg ds du dumpe2fs running eata echo egrep elvis emacs extend false fdflush fdformat fdisk fdomain filesize find findsuper fsck. ext2 fsck. msdos fstab grep gzip halt head hexedit hostname i82365 ifconfig ifport ile init inittab insmod kill killall5 ksyms length less libc. so.5.4.13 lilo. conf ln loadkeys login losetup ls lsattr mawk md5sum memtest mingetty miterm mkdir mkdosfs mke2fs mkfifo mkfs. minix mklost + found mknod mkswap mnsed more mount mt mv nc without ntfs pax pcmcia manually ping plip ppa printf ps pwd restart qlogicfas reboot restart reset rm rmdir rmmod route rsh rshd script scsi_info seagate serial_cs setserial sh slattach sleep slip snari sort split stty swapoff swapon sync tail tar tcic tee telnet test touch tune2fs umount undeb update vi. help wc
  
The most reassuring thing is that tomsrtbt is a program that has nothing to do with the release version, and you can even use it to restore Windows 9x.
  
After the master boot record is lost, Linux cannot start. It is very easy to start a floppy disk with Red Hat. you only need to log on to the disk with the root user after it is started, and then run lilo.
  
The tomsrtbt method is to log on to the system as the root user after startup, and then remove the floppy disk.
  
# Mount-t ext2/dev/hda4/mnt
# Chroot/mnt
#/Sbin/lilo
Added linux *
Added dos
# Exit
# Cd/
# Umount mnt
  
In versions earlier than Red Hat 6.2, a rescue. img file is provided to create a separate emergency disk and be used together with a boot floppy disk. At the LILO: prompt, type linux rescue and follow the prompts. after version 6.2, Red Hat installed the emergency recovery function on the CD and started it with CD, type "rescue.
  
Now, if your/etc/fstab has an input error, you have written the boot disk/dev/hda4 as/dev/hda44, so that your system cannot be started.
  
Start with a tomsrtbt floppy disk and modify/etc/fstab as follows.
  
# Mount-t ext2/dev/hda4/mnt
# Vi/mnt/etc/fstab
# Umount/mnt
  
Another common problem is that the system does not shut down normally. you can use tomsrtbt to repair a damaged disk partition.
  
# E2psk-f/dev/hda2
  
This command must be repeated several times for a seriously damaged partition.
  
If a partition cannot be completely repaired, you can write important files to the disk. when tomsrtbt is started, these files are loaded into the memory and the disk space can be used by other applications.
  
# Fdformat/dev/fd0H1440
# Mke2fs/dev/fd0
# Mkdir/mnt/image
# Mkdir/mnt/floppy
# Mount-t ext2/dev/hda4/mnt/image
# Mount-t ext2/dev/fd0/mnt/floppy
# Cd/mnt/floppy
# Cp/mnt/image/etc/*. conf.
# Cp/mnt/image/etc/conf. modules.
# Cp/mnt/image/var/named /*.
# Cp/mnt/image/home/gwilburn/docs/myrecipes.txt.
# Cd/mnt
# Umount floppy
# Umount image
  
The fdformat, mke2fs, mount, cd, and cp commands are used in the preceding steps. these commands are included in tomsrtbt. in this case, we have backed up the configuration file and DNS file in the/etc directory.
  
The following example shows how to use tomsrtbt to restore Windows.
  
# Mkdir/mnt/win
# Mkdir/mnt/floppy
# Mount-t vfat/dev/hda1/mnt/win
# Mount-t vfat/dev/fd0/mnt/floppy
# Vi/mnt/win/autoexec. bat
# Cd/mnt/floppy
# Cp/mnt/win/autoexec. bat.
# Cp/mnt/win/config. sys.
# Cp "/mnt/win/program files/netscape/bookmarks.htm ".
# Cd/mnt
# Umount floppy
# Umount win
  
Disasters do not happen frequently, but the most important thing to prepare for a disaster is to back up data. All the techniques we discuss are just some of the actions we can take when data can be recovered. As a professional system administrator, if data backup is not completed, this so-called "professional" is not a real name.
  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.