如何在实际上是 UUID 的磁盘上执行 xfs_repair

yae*_*ael 1 linux filesystems fsck xfs uuid

我们有 redhat 机器版本 6.x

我们想修复我们其中一个磁盘上的文件系统

UUID=198s5364-a29c-429e-b16d-e772acd /data_SA              xfs     rw,noatime,inode64,allocsize=16m 1 2
Run Code Online (Sandbox Code Playgroud)

但磁盘是 UUID

那么以下语法是否正确?

xfs_repair  UUID=198s5364-a29c-429e-b16d-e772acd 
Run Code Online (Sandbox Code Playgroud)

从手册页

SYNOPSIS
       xfs_repair [ -dfLnPv ] [ -m maxmem ] [ -c subopt=value ] [ -o subopt[=value] ] [ -t interval ] [ -l logdev ] [ -r rtdev ] device
       xfs_repair -V
Run Code Online (Sandbox Code Playgroud)

Ste*_*itt 10

您应该在/dev/disk/by-uuid以下位置找到您的设备 UUID :

xfs_repair /dev/disk/by-uuid/198s5364-a29c-429e-b16d-e772acd
Run Code Online (Sandbox Code Playgroud)


fro*_*utz 6

findfs在UUID转换为设备名称。

# findfs UUID=01d91a31-d25c-48ea-a10f-6166ce0f5964
/dev/mapper/SSD-archlinux
Run Code Online (Sandbox Code Playgroud)

因此,您可以使用它来提供期望设备名称的参数:

# echo file -s $(findfs UUID=01d91a31-d25c-48ea-a10f-6166ce0f5964)
file -s /dev/mapper/SSD-archlinux

# file -s $(findfs UUID=01d91a31-d25c-48ea-a10f-6166ce0f5964)
/dev/mapper/SSD-archlinux: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)

# xfs_repair $(findfs UUID=01d91a31-d25c-48ea-a10f-6166ce0f5964)
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
Run Code Online (Sandbox Code Playgroud)