This article describes how to use a KnopPix CD to access the unacceptable Linux system, obtain read and write rights of the configuration file, create and manage partitions and file systems, copy files to different storage or networks. You can use Knoppix to perform hardware and system configuration detection and partitioning, and management of file systems. You can use the Knoppix-friendly graphical interface or command tool to complete the above tasks.
Knoppix is a complete bootable Linux on a CD, I chose it as a first aid disk. There is a very good introduction to Knoppix a few months ago (Cameron Laird "Knoppix provides a leadable, capacity of a Linux").
I used to rely on Tom's root boot, "the best GNU / Linux" on a floppy disk, "Super Emergency CD". They are all first-class Linux emergency dishes. My favorite drama is to complete the reconstruction of the bare metal system only with a TOM root boot disk and network connection.
As the CD-ROM becomes a standard configuration on the PC, I also use several SuperRecue CDs. However, it is based on Red Hat 7.2, although this is a good Red Hat but is also an old Red Hat. Moreover, 7.2 does not provide some of the hardware supports in the new version, such as USB and wireless connections.
NEW Nats Knoppix, system recovery of new members with excellent features:
First-class hardware detection and support, including PCMCIA, USB, and wireless connection the latest best debian and KDE fast boot, usually in two minutes, commercially available CDs can be bought with the lowest price
Until I got a place with no high-speed Internet, I realized the importance of the last point. If you can only use a co-whatever, download 700M file is very unreal.
Knoppix integrates the best debian, KDE, and its own system tools. In this article we will use this tool from two aspects of using the command line and graphics tools. Be sure to use data that matches your system, such as partition number, file name, and network host.
Departure If you need to run the KDE, or any other graphic desktop or window manager, at least 96M RAM and Pentium level or better processors are required. If you do not need X, the plain text mode only needs 20m RAM, and even run on an old 486. It will use existing Linux exchange files.
The boot option is booted with the Knoppix CD, it will wait for 30 seconds in the command prompt and continue to boot. There is a large number of boot options, press F2 to see them. For example, the following is the command used to guide Knoppix 3.2 on a test system:
Knoppix Lang = US Knoppix Wheelmouse Knoppix Desktop = ICEWM
The default keyboard mapping is German, so I always boot with Knoppix LANG = US. Knoppix guides to the KDE desktop by default. Knoppix 2 is guided to text mode and does not start X. Failsafe minimizes hardware detection.
Knoppix is running in memory, or if you want to sound more "regular", run on the memory disk. In fact, you can see memory disks in the file tree. Remember, sometimes it will be slower because it must go to the CD to take the executable, which is slower than the hard disk. It can be installed on the hard disk, but that is not the topic we have to talk about today.
The Linux system that saves can't be guided is the most common situation. Some have problems, the system crashes, and cannot be guided. It doesn't matter: Start Knoppix, then you can find the icon of all your local partition on the KDE desktop. (Or browse the file tree in the / mnt directory.) Click the corresponding icon, all your files are. But they are wisely set to read only. Also don't matter: Right-click on the icon of the desktop, pop up a great menu, one option is "Chang Read / Write Mode". This can set the partitioned file system to read / write. Now you can edit any files. The default user is Knoppix. For operations that require root privileges, you need SU to root and assign a root password:
Knoppix @ TTYP0 [Knoppix] # SUROOT @ TTYP0 [Knoppix] # Passwd
Set the file system to read / write from the command line:
Root @ TTYP0 [Knoppix] # mount -t reiserfs -o rw / dev / hda5 / mnt / hda5
Cancel settings:
Root @ TTYP0 [Knoppix] # umount / mnt / hda5
If you get an error message "Could Not Unmount Device, Device Is Busy", it is possible that the file system is being read. Please turn off those files and switch out that file system.
So how do you know which set points and file systems have been specified? Just look at / etc / fstab:
Root @ TTYP0 [Knoppix] # cat /etc/fstab...# Added by Knoppix / dev / hda5 / mnt / hda5 Reiserfs Noauto, Uses, Exec 0 0
Hardware Detection should first check the hardware information before starting to modify the wrong configuration file. Knoppix is well done at this point, it has the latest version of Linux hardware and system tools: fdisk, lspci, ipconfig, ifconfig, dmesg, / proc, and more. (Check hardware information testing and Linux compatibility before purchasing. Sound card, soft cats and wireless NICs are especially prone to problems; manufacturers often replace the chips but do not change their models, so you need to know if Linux does this The driver of a chip. Knoppix CD includes many sound files, which can start "OpenMusic" quickly test sound on the welcome screen.)
FDisk -l Displays all partitions on all hard drives. LSPCI -V gives the details of each connected to the PCI bus and the chip. CAT / proc / cpuinfo gives the exact type of the installed CPU. Ifconfig display and modify the network interface settings. Usually Ethernet cards and point-to-point devices, as well as cats of the cat. iwconfig is similar to ifconfig, but it is used for wireless network cards. Dmesg is very interesting. If you are not particularly familiar with the kernel, Man Dmesg is not used. Just use DMESG | GREP, you will find this is a useful troubleshooting and system discovery tool. Just run DMESG does not add any parameters to see all content.
Of course, KDE provides friendly GUI to complete the above features; use System> Info Center.
Saving data files Usually the first saving step is to copy data from the hard disk of the problem. When you need to copy a lot of files, what I like is: Install another hard drive, then guiding Knoppix, and copy the file from the old hard drive to the new hard drive. Even if you don't have a hot disk or the extracted hard disk, open the chassis installation, you can't use how long it is. Do you use a new blank dish or need to clean up and reformat? It doesn't matter, Knoppix can prepare a disk. Partitioning and formatting first installing the second hard disk. Then guide Knoppix and open a root shell. If there is a partition in the second hard drive, you only need to format those partitions you need. Note that the SCSI hard disk is specified as SD, and the IDE hard disk is HD. This command lists the existing hard disk partition; be sure to use the data corresponding to your system:
Root @ TTYP0 [Knoppix] # fdisk -l / dev / hdb
Format a disk partition:
Root @ TTYP0 [Knoppix] # mkfs.ext2 -c / dev / hdb1
This creates a Plain-Vanilla EXT2 file system. The parameter-C is to detect a bad block. Of course, you can create any file system you like: EXT3, Reiserfs, which can:
Root @ TTYP0 [Knoppix] # mke2fs -j -c / dev / hdb1root @ TTYP0 [Knoppix] # mkreiserfs / dev / hdb1
what? No partition? First, let's see how to create partitions through the command line FDisk. Using the fdisk command is medium security because all changes will not be written to the hard drive before you command. So, you can try different options and preview the partition table before submitting any modifications. The following series of commands can create a partition:
Root @ TTYP0 [Knoppix] # fdisk / dev / hdb
You can always enter "m" to display the command table of FDISK. Then, enter "N" to create a new partition. Now enter "P" to create a primary partition. Enter the car and accept the default. Or, if you don't want to use the entire hard drive, press Enter to accept the default starting point, then select the size you want:
1000M
You can preview the new partition table at any time. When confirmed, press "W" to write the change to the hard disk. FDISK creates a "Type 83" partition by default, the Linux partition. The list of partition types is observed Press "L". Change the type of partition and press "T". Want to delete a partition? Very simple, press "D" and press the prompt operation.
Qtparted is simpler is to start KDE, using qtparted (System> Qtparted). Qtparted can be created, deleted, or not lost data mobile partition and reset the partition size (even NTFS). So, you can arrange space without any loss of data.
Copying the file in GUI, I like the graphic file manager. Drag and drop more than tapping a long command string. Click on the KDE desktop icon and destination disk icon, each open a file manager, dragging and dropping and simple. It is necessary to ensure that the destination hard disk is set to be writable.
Copying files in a command line Don't forget to create a directory to copy to by:
# MKDIR / MNT / HDB1 / Home / Carla / Backup # CP -R / MNT / HDA5 / HOME / Carla / MNT / HDB1 / HOME / Carla / Backup
Cloning the entire hard drive you require two hard drives of the same size, or the destined disk is larger than the source disk. Confirm that there is no partition on both hard drives. In this example, / dev / hda is a source disk, / dev / hdb is a destination disk. The DD command performs an accurate bitmap copy, including MBR (Master Boot Record, Main Boot Record): # DD if = / dev / hda of = / dev / hdb
Set the confusion, did not remember what is set and set? No problem, save through / proc:
# cat / proc / mounts
This will display all file systems, file system types, read and write status, and other properties that have been set. How many hard drives are there in the system? One of the following commands will tell you (remember that the SCSI hard drive is the SD, the IDE hard drive is HD):
# fdisk -l
or
# Dmesg | GREP HD
or
# Dmesg | GREP SD
Copy to CD Use KDE and Knoppix easy. Assume that there is a CD recorder in the system, just right-click the partition icon of your file on your desktop, you will see "Create Data CD With K3b". Execute File> New Project, drag and drop the file you want to copy, you can. K3B is very good at automatic detection and automatically configuring your CD drive; it will do all tasks for you. If some links have problems, please refer to developerWorks Articles "Burnt CD on Linux", and the article will teach you how to firing CDs under the command line.
Copy to other media Knoppix automatically identify the ZIP drive, floppy disk, and USB storage devices and display their icons on the desktop. Just set the file to be copied to the drive, then drag and drop it.
Copy on the network You can configure KnopPix to connect to the network, just like any other Linux. Knoppix has its own graphics configuration tool: Find the knoppix> network / Internet on the main menu. The Knoppix excellent hardware detection function takes effect again; it can even work in wireless NIC (assuming is Linux supported wireless NID). Just answer a series of questions, you can complete it.
It is also simple to use the command line. Execute as root:
# NetCardConfig
Once your network is configured, there will be some options for transferring files. The CP is used to copy the local mounted file system. Copying files on an untrustworthy network should use SCP (Secure Copy), in fact, Knoppix does not allow you to use any other way. SCP uses SSH to transfer encrypted files, allowing you to move files without setting up NFS or SAMBA. You also need an SSH server on the machine that receives files on the network. The following is a copy of the whole directory:
# SCP -RP / MNT / HDA5 / HOME / Carla 192.168.1.5:/HOME/CARLA/TMP
What is SSH to play quickly? Do you have no SSH server? If you haven't installed SSH yet, here is a quick wizard using SSH. But before using it for remote management tasks, you should learn more deeply. Pay attention to recent many important security patches.
OpenSSH will come with all major release versions, so you should already have. (Use the command locate sshd to find it.) If not, you can download and install it. No need to be on a special machine; any Linux PC can run SSH. Start it like this:
# /etc/init.d/ssh start
Next, all you have to do is set the same account on both machines. Using root is the simplest, but there is potential danger. Of course, you can create the required account on Knoppix, use the useeradd and passwd commands. Then run the SCP command as the previous example, it is possible. When you first connect, you will get a message, "The Authenticity of Host X CAN't Be Established ... Are you Sure You want to contact Continue Connecting?" Answer "Yes", which will ask you the SSH server Root password, then you can operate any. Mobile files in non-root users:
# SCP -RP / MNT / HDA5 / Home / Carla Carla@192.168.1.5: / home / carla / tmp
Open a root shell on the host system This allows you to operate the host system, just like you log in directly to it. Find the partition where the host system is located, then open a Knoppix root shell and set it:
Root @ TTYP0 [Knoppix] # mount / dev / hda1 / mnt / hda1Root @ TTYP0 [Knoppix] # chroot / mnt / hda1root @noppix: /
The problem of Knoppix exists can cause some strange problems on CD, especially on laptops. This is usually because power management disrupts the Knoppix session: When you wake the machine, Knoppix no longer responds to any command. The only solution I know is to disable power management, or restart using the power switch.
Sometimes Knoppix hangs during the boot process, stops in the KDE (or other X session). Switch to the first virtual console (Ctrl Alt F1) to view system messages; this can know where you have problems. Press Alt F5 to return to the default X session. For example, my test system hangs when detecting SCSI. why? Who knows. I added the Knoppix No SCSI in the boot command to disable SCSI detection and solved this problem.
Knoppix brings innovative linux never lacks a lack of amazing creativity. Knoppix has been far away, and Knoppix brings inspiration to many creative projects, such as Inside Security Rescue Toolkit, OpenGroupware Knoppix, Damn Small Linux, and Overclockix. See the link in the reference section below, you can get more information and customize your own Knoppix version.
Reference
Although MAN Pages is not read, it includes a full command and option list. The following Man Pages are most useful in recovery operations: