Linux系统挂载存储变成只读的解决方案
1、mount:
用于查看哪个模块输入只读,一般显示为:
[root@localhost ~]# mount
/dev/cciss/c0d0p2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/cciss/c0d0p7 on /home type ext3 (rw)
/dev/cciss/c0d0p6 on /var type ext3 (rw)
/dev/cciss/c0d0p3 on /usr type ext3 (rw)
/dev/cciss/c0d0p1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/dm-0 on /home/book/upload/BookFile1 type ext3 (rw)
/dev/dm-1 on /home/book/upload/BookFile2 type ext3 (rw)
/dev/dm-2 on /backup type ext3 (rw)
/dev/dm-3 on /home/book/upload/BookFile3 type ext3 (ro)
2、如果发现有ro,就重新mount,或者umount以后再remount
3、umount /dev/dm-3
如果发现有提示“device is busy”,找到是什么进程使得他busy
fuser -m /mnt/data 将会显示使用这个模块的pid
fuser -mk /mnt/data 将会直接kill那个pid
然后重新mount即可。
4、还有一种方法是直接remount,命令为
mount -o rw,remount /mnt/data 没有用过,看到网络上有这么写。
二、具体深入的做法,情况不同可以自行选择:
服务器/var/log/messages报错 :
end_request: I/O error, dev sda, sector 122194293 Buffer I/O error on device sda1, logical block 446493 lost page
write due to I/O error on sda1
下面是整个处理全过程
[root@localhost ~]# fdisk -lu #第一步 :找出本地扇片所在的分区。
Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 32 sectors/track, 35132 cylinders, total 286677120 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 32 78711359 39355664 83 Linux
/dev/cciss/c0d0p2 78711360 142114559 31701600 83 Linux
/dev/cciss/c0d0p3 142114560 185044319 21464880 83 Linux
/dev/cciss/c0d0p4 185044320 286677119 50816400 5 Extended
/dev/cciss/c0d0p5 185044352 201625439 8290544 82 Linux swap / Solaris
/dev/cciss/c0d0p6 201625472 207965759 3170144 83 Linux
/dev/cciss/c0d0p7 207965792 286677119 39355664 83 Linux
[root@localhost ~]# tune2fs -l /dev/dm-3 |grep “Block size” #找到block大小。
Block size: 4096
(122194293-75778605)*512/4096 =528691 利用公式算出逻辑块地址
b = (int)((L-S)*512/B)
[root@localhost ~]# debugfs
debugfs 1.35 (28-Feb-2004)
debugfs: open /deb/dm-3
/deb/dm-3: No such file or directory while opening filesystem
debugfs: open /dev/dm-3
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
[root@localhost ~]# dd if=/dev/zero of=/dev/dm-3 bs=4096 count=1 seek=582391 #找到这个快的文件之后,需要做好备份,我们强制把它设置为0字节。
[root@localhost ~]# sync