Register now for better personalized quote!

HOT NEWS

Solution of Read-only file system under Linux

Feb, 19, 2024 Hi-network.com

Problem Description

When it comes to modifying/saving entries and other commands that need to be written to disk operations can not be used (such as tar, cp, mv, rm, chmod, chown, wget download and other commands), it always prompts Read-only file system, that is, the system is read-only, nothing can be written.


Processing

1, check /etc/fstab file, in which found such a record (note that errors = remount-ro paragraph), as follows:

/dev/sda1 / ext3 errors=remount-ro 0 1

This situation is usually caused by the protection mechanism adopted by the system after detecting a disk hardware failure or file corruption in the file system. In order to protect the data from destroying the contents of the partition, Linux mounts the filesystem read-only. The exact reason why a mounted filesystem inexplicably becomes mounted read-only is unknown. Possible reasons are

a. The system file is corrupted; b. The disk has bad sectors; c. The fstab file is misconfigured, such as the partition format error error (write ntfs as fat), the configuration command is misspelled, and so on.


If you can confirm that the data and system files are not corrupted, repairing the fstab file configuration can be restored to normal with a new R/W mount or reboot.


Remount the file system as read/write mount -o remount rw /


If there are important files on the machine, you can use the scp command to back them up to the remote host before remounting the file system:


1 scp -r import_dir/import_file user@host:backup_dir


The reason for using the scp -r command to back up important directories/files to the remote host instead of using the tar command to pack and compress them before transferring them is that packing and compressing files/directories with the tar command involves writing to disk, which can cause a Read-only file system error.

If there is a problem with the file system, you need to execute the fsck command in the umount state to check the file system and fix the error in the file system.


nohup fsck -y /dev/VolGroup00/LogVol00 > /dev/shm/fscklog &#reboot after checking well reboot


If the disk hardware is damaged, the best thing to do is to just get a new hard drive. If you think it's a pity to throw away the old hard disk, you can also low-frame it and then reinstall the system, the disk will be repartitioned after the system is reinstalled.

If you just want to back up your data and have the machine with you, you can boot the system from the CD-ROM with a live-cd and back it up directly. Of course, at this point you can also modify the configuration file on the hard disk, such as /etc/fstab.


Suggestions and summary

Attachment:

Another way to deal with it, convenient and concise:

1, to read and write to remount the file system mount -o remount rw /

2, in the '~' root user's home directory to execute the command 11 -a, to find .viminfo, in the implementation of tar, cp, mv, rm, chmod, chown, wget command, test normal.


If you have requirement of network equipments, please contact us www.hi-network.com  (Email: [email protected])

tag-icon Hot Tags : LINUX Server fusion

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.
Our company's operations and information are independent of the manufacturers' positions, nor a part of any listed trademarks company.