记一次服务器异常关机磁盘只读问题

原创
林里克斯

记一次服务器异常关机磁盘只读问题



1 发现异常

服务器正常启动后,MySQL 服务器无法正常启动,查看日志发现有无法写入的情况

 [MY-010091] [Server] Can't create test file /mysqldata/data/mysqld_tmp_file_case_insensitive_test.lower-test

排查了一下 /mysqldata 确实变为了只读

$ cd /mysqldata/
$ touch test
touch: cannot touch ‘test’: Read-only file system

2 处理故障

2.1 卸载挂载目录
$ sudo umount /dev/sdb1 
umount: /mysqldata: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
#磁盘被占用无法正常卸载
2.2 查看占用用户
$ sudo fuser -cu /mysqldata/
/mysqldata:           5185c(xxxx)  5622c(root)
-c 是查看进程
-u 是查看占用用户

$ sudo yum -y install psmisc
#如果没有 fuser 命令,安装此包即可
2.3 向进程发出SIGKILL信号
$ sudo fuser -ck /mysqldata/
/mysqldata:           5185c  5622c

$ sudo fuser -cu /mysqldata/
#再次查看没有了占用
2.4 修复文件系统
$ sudo umount /mysqldata/
$ sudo fsck -y /dev/sdb1
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
/dev/sdb1: recovering journal
/dev/sdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found.  Create? yes

Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -(53248--55295) -(59392--65535)
Fix? yes

Free blocks count wrong (21314095, counted=21696488).
Fix? yes

Free inodes count wrong (6552404, counted=6552405).
Fix? yes


/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 1195/6553600 files (67.4% non-contiguous), 4517656/26214144 blocks

3 验证

$ sudo mount -a
$ cd /mysqldata/
$ touch test
#验证已可以正常读写

Over~

版权协议须知!

本篇文章来源于 Uambiguous ,如本文章侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意

817 0 2023-09-07


分享:
icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif
博主卡片
林里克斯 博主大人
一个致力于Linux的运维平台
运维时间
搭建这个平台,只为分享及记载自己所遇之事和难题。

现在时间 2024-12-27

今日天气
站点统计
  • 文章总数:241篇
  • 分类总数:29个
  • 评论总数:12条
  • 本站总访问量 352710 次

@奥奥

@Wong arrhenius 牛比

@MakerFace 厉害了!