查看磁盘信息

[root@localhost ~]# fdisk -l

Disk /dev/vda: 85.9 GB, 85899345920 bytes
16 heads, 63 sectors/track, 166440 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009345c

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018      166441    83373056   8e  Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/vdb: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

有一块500G的盘还未挂载

阅读全文 »

查看是否开启ipv6

  • 通过ifconfig查看是否存在inet6 addr
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 0C:DA:41:1D:21:33  
          inet addr:127.0.0.1  Bcast:127.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::eda:41ff:fe1d:2133/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3784 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1695 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:363770 (355.2 KiB)  TX bytes:514281 (502.2 KiB)
  • 通过内核加载模块信息查看
[root@localhost ~]# lsmod | grep ipv6
nf_conntrack_ipv6       7985  4 
nf_defrag_ipv6         26637  1 nf_conntrack_ipv6
nf_conntrack           79761  3 nf_conntrack_ipv6,nf_conntrack_ipv4,xt_state
ipv6                  337436  139 nf_conntrack_ipv6,nf_defrag_ipv6,ip6t_REJECT

关闭ipv6

[root@localhost ~]# echo "NETWORKING_IPV6=no" >> /etc/sysconfig/network
[root@localhost ~]# echo -e "alias net-pf-10 off\noptions ipv6 disable=1" >>  /etc/modprobe.d/dist.conf
[root@localhost ~]# sed -i 's/::1/#::1/g' /etc/hosts
#禁用ipv6的iptables
[root@localhost ~]# chkconfig ip6tables off
#重启系统
[root@localhost ~]# reboot

问题出现

早上上班来看到几台Linux(centos、Redhat)服务器离线了,上了平台看一下,centos直接黑屏,Redhat倒是没看出有啥问题,但是无法输入命令,貌似没啥操作空间,只能先重启查下日志了。

定位问题

查了一下日志,发现离线的时间都一样,隐约有点不好的感觉。几台都强制重启后发现没有一台起得来。进去一看无法进入系统出现如下提示:

***an error occurred during the file system check 
***dropping you to a shell;the system will reboot 
***when you leave the shell. 
***warningive root password for maintenance(or type Control-D to continue)

大致就是系统在校验文件的时候有问题。查了一下出现以上提示可能由于异常关机或硬盘逻辑错误,会导致linux无法启动,无法进入操作系统。看了一下日志那个时间点并没有人操作服务器,这时候看到存储有报警,一看发现存储的双活故障了,故障时间点跟服务器挂掉的时间点刚好吻合。
QOkiNQ.jpg

解决办法

对于存储:同步双活数据,导出日志交由厂商处理。
对于服务器:

  1. 输入服务器root用户的密码,回车,进入命令操作界面。
  2. 输入fsck -y 回车 ,即开始修复文件系统。时间根据硬盘的大小,在10分钟~几个小时不等。
    修复完文件系统可能会丢失一些文件,丢失的文件在相应分区的lost+found目录。

修复完成后重启,服务器恢复正常。
补充:
关于e2fsck命令的翻译:
e2fsck(ext3/2 file system check) 功能说明:检查ext3/2文件系统的正确性
语法:e2fsck -acCdfFnprsStvVy-B <区块大小>-L <文件> e2fsck执行后的传回值及代表意义如下 0 没有任何错误发生
QOFX9A.jpg