File system is a very important part of a Linux system. This is a method of organizing data in the storage media of the computer system. All the information about files is stored in the file system. The operating system learns about them from the file system and then, we able to access them. Sometimes, while working on your Linux computer, if power goes away and the system shuts down improperly, there occurs some sort of corruption to the file system. There may be some other reasons behind a possible file system corruption in a Linux OS based system, such as virus/ malware infection, serious application contradiction, OS malfunction etc. Corruption or damage to the file system results in the inaccessibility of your valuable data in the media and you need any Linux partition recovery utility to get the data back.
In case of file system corruption issues, you may encounter some error messages on the screen. The error message that you may have received can be as below:
“Activating swap partitions: dup2:Bad file descriptor [FAILED]
Setting hostname Leshkow2: dup2Bad file descriptor [FAILED]
/etc/rc.sysinit: /dev/null: Read-only file system
Grep: /proc/mounts: No such file or directory
Checking root file system
dup2: Bad file descriptor [FAILED]”
Once after getting these error messages, your Linux system just prompts infinitely for the root password to come back to the shell prompt and all your data remains inaccessible.
The reason behind the above problem is due to the corruption of the ‘/dev/null’ entry in the device inode permission. In a way, it can be said that the file descriptor has been corrupted or missing. This is the reason that the Linux OS has failed to locate the boot file and all the data became inaccessible.
Below methods may help you resolve the issue:
Try giving the root password, which may repair the file system.
If the above fails, try with the below steps:
First, mount the root file system by the command – ‘mount -n -o remount,rw /dev/hdxx’
Note: hdxx is the root partition of your system.
Remove the ‘/dev/null’ entry by the command – ‘rm -rf /dev/null’.
Create a new writable entry by ‘mknod -m 666 /dev/null c 1 2’.
Restart the system using ‘shutdown -r’ or ‘shutdown -h’ , which allows the changes to take effect.
Sometimes, with severe corruption the file system, the above measures also fail and you need any effective Linux data recovery software to do the job.
Was this article helpful? Don't forget to rate it. Ratings helps community members identify top & useful articles.