Linux file system becomes read-only fix

Source: Internet
Author: User

A simple and temporary way for a Linux system to restart or to become read-only causes the site to fail to access normally:


One


1. Mount:

Used to see which module input is read-only, typically shown as:


/DEV/HDA1 on/type ext3 (rw)

None On/proc type proc (rw)

Usbdevfs ON/PROC/BUS/USB type USBDEVFS (rw)

None on/dev/pts type devpts (rw,gid=5,mode=620)

/dev/hda5 on/home type ext3 (rw)

None On/dev/shm type TMPFS (rw)

/dev/hda2 on/usr/local type ext3 (rw)

/DEV/NB1 on/earthview/raw type ext3 (RO) (changed to read-only)



2, if found RO, re-mount, or Umount later remount


3, UMOUNT/DEV/NB1

If you find a hint "device is busy", find out what process is making him busy


Fuser-m/mnt/data will show the PID using this module

Fuser-mk/mnt/data will kill the PID directly.


Then you can re-mount.


4, there is also a method is direct remount, command for


Mount-o Rw,remount/mnt/data


Two


Specific in-depth approach, different circumstances can be selected by oneself:


Server/var/log/messages Error:


END_REQUEST:I/O error, Dev SDA, Sector 122194293 Buffer I/O error on device sda1, logical block 446493 lost page write du E to I/O error on SDA1


Here's the whole process.


[Email protected] ~]# Fdisk-lu #第一步: Find the partition where the local slice is located.

disk/dev/sda:73.4 GB, 73407868928 bytes

255 heads, Sectors/track, 8924 cylinders, total 143374744 sectors

Units = sectors of 1 * MB = bytes


Device Boot Start End Blocks Id System

/DEV/SDA1 * 4096574 2048256 Linux

/dev/sda2 4096575 75778604 35841015-up Linux

/dev/sda3 75778605 129034079 26627737+-up Linux

/DEV/SDA4 129034080 143364059 7164990 5 Extended

/dev/sda5 129034143 139267484 5116671-up Linux

/dev/sda6 139267548 143364059 2048256, Linux swap



[Email protected] ~]# tune2fs-l/dev/sda3 |grep "Block size" #找到block大小.

Block size:4096


(122194293-75778605) *512/4096 = 528691 Use the formula to calculate the logical block address


b = (int) ((l-s) *512/b)


[Email protected] ~]# Debugfs

Debugfs 1.35 (28-feb-2004)

Debugfs:open/deb/sda3

/deb/sda3:no such file or directory while opening filesystem

Debugfs:open/dev/sda3

Debugfs:icheck 582391

Block Inode Number

582391 277584

Debugfs:ncheck 277584

Inode Pathname

277584/users/inn.net.cn/data/upload/download/innshow004.rar

Debugfs:quit

[[Email protected] ~] #dd if=/dev/zero of=/dev/sda1 bs=4096 count=1 seek=582391 #找到这个快的文件之后, need to do backup, we force it to set to 0 bytes.

[[Email protected] ~]# Sync




2009-10-14


This article is from the "Five Corners" blog, please be sure to keep this source http://hi289.blog.51cto.com/4513812/1764624

Linux file system becomes read-only fix

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.