Easy solution to Linux OS recovery tips _unix Linux

Source: Internet
Author: User
Tags mkdir
No matter what operating system you are running, in many cases, you will face disaster recovery operations. Your main boot area is overwritten, your hard drive cannot be started, or an important file is deleted, or your display card flashes when it is started on a black screen. This article will make some technical discussions on these issues, to help you in the face of these problems, do not be unprepared.

The first need is an emergency boot floppy disk, in the installation of Linux, the general will require the establishment of a, so you should have this disk, if not yet established, hurriedly to build a bar, what? Don't know how to do that? It's easy to use the Mkbootdisk command on a typical Linux system. The back of those parameters, just look at the help, it should be understood.

First Use

# uname-a

System prompts:

Linux Albertxu 2.2.16-2.0 #1 Sun may 16:53:41 EST 2001 i586 Unknown

To see the kernel version of the system. We know that the kernel version of the system is 2.2.16-2.0.

and then use

# Mkbootdisk--device/dev/fd0 2.2.16-2.0

System prompts:

Insert a disk in/dev/fd0. Any information on the disk would be lost.
Press to continue or ^c to abort:

Insert the disk and wait for a while until the disk is established. In this way, the emergency boot floppy is established.

In addition to adopting the above approach, another option is to use TOMSRTBT to create a boot floppy. First, introduce the installation steps for 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 screen, the software uses a high-density compression method to compress multiple Linux tools onto a single 1.7 Mb floppy disk.

The default disk contains the following programs, drivers, and cores:

  2.0.37 3c589_cs buslogic DEC_ELCP eexpress eexpress_pro EL2 EL3 EXT2 FAT FAT32 FD IDE idecd idefloppy idepcmcia idetape ISO9660 JOLIET LOOP math_emulation MINIX MSDOS NE2000 NFS PROC RAM SD serial SLIP SMC SR ST TR ULTRA VFAT Vortex wd80x3 AH 152x_cs aha152x aha1542 aic7xxx ash awk badblocks bdflush bzip2 CardBus cardmgr cat ce ce.help chattr chgrp chmod chown Ch Root Clear CMP CP cpio cut date dd ddate debugfs df dirname dmesg ds du dumpe2fs e2fsck eata echo egrep Elvis emacs Extend False Fdflush Fdformat fdisk fdomain filesize find findsuper fmt fsck.ext2 fsck.msdos fstab grep gzip-Halt head HexEdit H Ostname i82365 ifconfig ifport ile init inittab insmod kill killall5 ksyms length less libc.so.5.4.13 lilo lilo.conf Ln lo adkeys login losetup ls lsattr mawk md5sum memtest mingetty miterm mkdir mkdosfs mke2fs mkfifo mkfs.minix mklost+found mkn OD mkswap mnsed more mount Mt MV NC ncr53c8xx nmclan_cs NTFS pax PCMCIA pcmcia_core pcnet_cs Ping plip PPA printf PS pwd q Logic_cs Qlogicfas RebooT rescuept Reset rm rmdir rmmod Route rsh rshd script scsi_info seagate sed serial_cs setserial sh slattach sleep slip sna RF sort split Stty swapoff swapon sync tail tar tcic tee telnet test touch tune2fs umount undeb Update VI vi.help WC

Most reassuring of all, TOMSRTBT is a release-independent program that you can even use to restore Windows 9x.

After losing the master boot record, Linux will not start. Using Red Hat's boot floppy is very simple, just log in with Root when you start, and then run Lilo.

The way to use TOMSRTBT is to log in with Root after starting and then remove the floppy disk.

# mount-t Ext2/dev/hda4/mnt
# chroot/mnt
#/sbin/lilo
Added Linux *
Added dos
# exit
# CD/
# Umount MNT

The version prior to Red Hat 6.2 provides a rescue.img file that can be used to create a separate emergency disk to use with the boot floppy disk. At the LILO: prompt, type the Linux rescue and follow the prompts, after version 6.2, Red Hat has the Emergency Recovery feature installed on the CD, and when you start with the CD, type "Rescue".

Now suppose your/etc/fstab has an input error, you write the boot disk/dev/hda4 as/dev/hda44 so your system doesn't start.

Use the TOMSRTBT floppy disk to start, according to the following methods to modify the/etc/fstab on it.

# mount-t Ext2/dev/hda4/mnt
# Vi/mnt/etc/fstab
# umount/mnt

Another common problem is that you can use TOMSRTBT to repair a damaged disk partition without a normal shutdown.

# e2fsk-f/dev/hda2

This command needs to be repeated several times for a severely damaged partition.

If a partition is not fully repaired, you can write important files to disk, and when the TOMSRTBT is started, load the files into memory and use disk space for 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 above steps use the Fdformat, MKE2FS, Mount, CD, and CP commands, which are included in the TOMSRTBT, in which we backed up the/etc directory's configuration files and DNS files.

The following example is an example of using TOMSRTBT to recover 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 disaster is to back up the data. All the techniques we're talking about are just some of the steps we can take to get the data back. As a professional System Manager, if you do not do a good job of data backup, then this so-called "professional" is a misnomer.

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.