kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

xfs文件系统修复 xfs_repair

https://blog.csdn.net/theoldsod2000/article/details/105988902/

因为断电等原因可能无法开机,提示

1
Failed to start Remount Root and Kenal File System

可以通过xfs_repair命令进行修复。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@localhost ~]# xfs_repair
Usage: xfs_repair [options] device

Options:
  -f           The device is a file
  -L           Force log zeroing. Do this as a last resort.
  -l logdev    Specifies the device where the external log resides.
  -m maxmem    Maximum amount of memory to be used in megabytes.
  -n           No modify mode, just checks the filesystem for damage.
  -P           Disables prefetching.
  -r rtdev     Specifies the device where the realtime section resides.
  -v           Verbose output.
  -c subopts   Change filesystem parameters - use xfs_admin.
  -o subopts   Override default behaviour, refer to man page.
  -t interval  Reporting interval in seconds.
  -d           Repair dangerously.
  -V           Reports version and exits.

xfs_repair最重要的是指定要修复的设备

如果是LVM管理分区的

可以通过 ls -l /dev/mapper 来查看可用的设备。

一般可以看到2到3个链接文件,centos-home -> ../dm-1, centos-root->../dm-0

执行xfs_repair /dev/dm-0 正常情况下,这个分区就修复好了,再接着执行 xfs_repair /dev/dm-1,正常情况下,这个分区也会修复好。

如果不是LVM分区管理的,可以 通过 ls /dev 查看,一般会有sda,sda1,sda2.

可以执行 xfs_repair /dev/sda1 和 xfs_repair /dev/sda2 进行修复。

如果修复失败,可以加上 -L 参数,这样可能会丢失部分数据。

修复的过程中可能会出错,提示找不到superblock。

下面这篇文章很清楚的讲述了superblock,inode,block的关系,可以帮助我们理解

https://blog.csdn.net/Ohmyberry/article/details/80427492

dm是device mapper的意思,主要涉及的linux下卷的管理。卷管理通过映射的方法建立了逻辑卷。每个逻辑卷相当于一个分区。