1. If important data exists in the VM, back up the VM data before fixing the system.
2. Enter the repair filesystem or rescue mode.
Before fixing the file system, you need to enter the repair filesystem or rescue mode first. The following describes how to enter the repair filesystem or rescue mode separately when three symptoms occur:
The system automatically enters the repair filesystem mode. After you enter the password for the root user, you can proceed to step 3.
Enter the rescue mode by mounting the ISO of the VM system and then proceed to step 3.
Use SUSE10 SP3 (32-bit) as an example. Perform the following operations:
Mount the SUSE10 SP3 (32-bit) system installation DVD-ROM to the VM, boot the system from the DVD-ROM, and enter rescue to enter the rescue mode.
Figure 4 rescue mode 1
Enter root to enter the CLI in rescue mode.
Figure 5 rescue mode 2
Enter any user name and password in the VNC window. If the system can be logged in to, a character window is displayed. Refer to the operations in symptoms 1 and 2 to enter the repair filesystem or rescue mode.
3. Fix the file system.
The fsck command is used to fix the file system. For specific functions of the command, see the man manual. This document only describes some commonly used functions.
To fix general file system damages, you only need to run the following command according to the error message displayed during system startup:
fsck -y /dev/*
with the specific device.
For example, during the system startup, a message is displayed indicating that the file system in the /dev/xvda2 partition malfunctions.
Figure 6 File system exception 1
(a) Run the following command in repair filesystem or rescue mode:
fsck -y /dev/xvda2
(b) If a message is displayed indicating that the partition has been mounted, as shown in Figure 7, do as follows:
Figure 7 Mounted partition
Enter n to stop fixing the system.
Run the following command to remount the partition in read-only mode:
mount -o remount,ro /dev/xvda2
Run the following command to fix the system again:
fsck -y /dev/xvda2
Figure 8 Mounting the partition in read-only mode
In some conditions, after you run the fsck -y /dev/*
command to fix the reiserfs file system damage, a message is displayed indicating the system fails to be fixed.
Figure 9 Unsuccessful system fixing
At this time, run the following command according to the message to fix the system.
fsck.reiserfs --rebuild-tree /dev/xvda2
Figure 10 Fixing command
Restart the system.