第一步、查看文件系统


几种查看挂载磁盘分区和文件系统类型的方法


1)df-T可以查看已经挂载的分区和文件系统类型

[root@localhost nginx]# df -T
Filesystem              Type     1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root xfs       28289540 5970724  22318816  22% /
devtmpfs                devtmpfs    906088       0    906088   0% /dev
tmpfs                   tmpfs       917152       0    917152   0% /dev/shm
tmpfs                   tmpfs       917152   24880    892272   3% /run
tmpfs                   tmpfs       917152       0    917152   0% /sys/fs/cgroup
/dev/vda1               xfs        1038336  145756    892580  15% /boot

2) fdisk -l 可以显示出所有挂载和未挂载的分区,但不显示文件系统类型

[root@localhost nginx]# fdisk -l
Disk /dev/vda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009e475
   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     2099199     1048576   83  Linux
/dev/vda2         2099200    62914559    30407680   8e  Linux LVM
Disk /dev/mapper/centos-root: 29.0 GB, 28982640640 bytes, 56606720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

3) parted -l  可以查看未挂载的文件系统类型,以及那些分区尚未格式化

[root@localhost nginx]# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-swap: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0.00B  2147MB  2147MB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-root: 29.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  29.0GB  29.0GB  xfs


Model: Virtio Block Device (virtblk)
Disk /dev/vda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1075MB  1074MB  primary  xfs          boot
 2      1075MB  32.2GB  31.1GB  primary               lvm

5)lsblk -f  也可以查看未挂载的文件系统类型

[root@master1 ~]# lsblk -f
NAME            FSTYPE      LABEL UUID                                   MOUNTPOINT
vda                                                                      
├─vda1          xfs               47540296-497a-4a1a-8eb5-602f3f1473e5   /boot
└─vda2          LVM2_member       N0luC7-9cMv-ZBNJ-icSN-SrJP-H0nX-JXvKK0 
  ├─centos-root xfs               407126a2-772a-4835-bebc-90cc7226bdf6   /
  └─centos-swap swap              e3bcb5e9-3e10-426c-9dd9-aa86bac03852   [SWAP]

第二部、修复磁盘

ext4文件系统,使用命令  fsck.ext4 /dev/xxx 修复,

如果是xfs文件系统,使用命令 xfs_repair -L /dev/xxx修复

一般情况修复后均可挂载,

但是如果磁盘有问题,或者阵列出问题时此种修复可能会失败,挂载时依然要求格盘,那就果断的格盘吧