Linux livecd CD or a third-party linux system to log on to the console-Linux general technology-Linux technology and application information. The following is a detailed description. Linux livecd is a linux system that runs on a CD without installation. livecd is mostly used for restoration. livecd integrates common system operating tools;
A third-party Linux system refers to the installation of more than one Linux system on your machine. If one of them has a problem, we can use the other to fix it;
Livecd and a third-party linux system are used to fix damaged Linux systems. Common tools include mount and chroot. If you simply change the problematic system file, mount is enough. The chroot tool can change/and then enter another system. This tool is indeed useful.
Use livecd linux or other linux to repair damaged Linux:
1) mount the file system;
Note: run the mount and chroot commands with the root permission;
For example, the problematic system is located in/dev/hda5. If you do not know which partition is linux, you can view it through fdsik-l;
[Root @ localhost ~] # Fdisk-l note: view the partition information;
[Root @ localhost ~] # Pwd Note: determine the current working directory;
/Root note: the current working directory is/root
[Root @ localhost ~] # Mkdir upload MP Note: create a temporary directory under the current working directory;
[Root @ localhost ~] # Mount/dev/hda5 into MP/Note: mount hda5 to the tmpsys directory;
[Root @ localhost ~] # Df-h Note: Check whether the disk has been mounted;
Filesystem capacity in use available % mount point
/Dev/hda8 11 GB 9.8G 581 M 95%/
/Dev/shm 236 M 0 236 M 0%/dev/shm
/Dev/hda5 7.9G 5.9G 2.0G 76%/root/batch MP
Note: As you can see, it is mounted to the/root/sort MP directory;
Since the file system in the/dev/hda5 partition has been mounted, we can write the mounted file system. For simple backup and file modification, it works;
Note: During the write operation, you must be overwhelmed. When operating a file, you must back up the file first. When the file cannot be mounted, it may be that your current kernel does not support the corresponding file system;
2) chroot to the mounted file system;
The chroot tool is very useful. Many Linux systems support switching chroot to another file system and installing a series of system packages and system configurations. This does not mean that chroot can be used in any file system, first, the file system has certain tools and environments for running the system, such as/bin and/sbin directories ....
For example, I have two Linux systems on my machine. One of them runs normally, and the other has some problems (for example, the root password is forgotten). I want to use a normal system to fix the other; the first step is to mount the file system, that is, the previous step is chroot, and switch to the file system to be repaired through chroot;
For example, the problematic system is located at/dev/hda5.
[Root @ localhost ~] # Fdisk-l
[Root @ localhost ~] # Pwd
/Root
[Root @ localhost ~] # Mkdir upload MP
[Root @ localhost ~] # Mount/dev/hda5 initialize MP/
[Root @ localhost ~] # Df-h
Filesystem capacity in use available % mount point
/Dev/hda8 11 GB 9.8G 581 M 95%/
/Dev/shm 236 M 0 236 M 0%/dev/shm
/Dev/hda5 7.9G 5.9G 2.0G 76%/root/batch MP
[Root @ localhost ~] # Chroot slave MP Note: chroot is in the hda5 partition system;
Bash-3.00 # Note: You have logged on;
Bash-3.00 # df-lh Note: view the mounting status of the file system;
Filesystem capacity in use available % mount point
/Dev/hda5 7.9G 5.9G 2.0G 76%/
Proc 7.9G 5.9G 2.0G 76%/proc
Sysfs 7.9G 5.9G 2.0G 76%/sys
The preceding command uses the chroot command to complete cross-console logon from one system to another. Livecd also completes this task.
Now that we have logged on to the problematic system, we can perform corresponding repair work, such as restoring the root password, installing the software package, and modifying the corresponding file ......
Some release versions of the installation disk are similar to livecd, such as the first slackware installation disk. When it is started and asked you to enter the user name and password for installation, we do not have to enter anything, or directly enter the root, now we can access the cdrom virtual environment. In this case, we will mount the file system with the aforementioned mount, and then mount the file system with chroot.
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.