Partition

無法再掛載 XFS 分區

  • November 23, 2016

我的伺服器上有 9 個格式化為 XFS 的分區。

當我嘗試安裝其中一個時,它失敗了。其他安裝正常。

root@fileserver2 # mount | grep xfs | head -1
/dev/sdb1 on /mnt/hdd1 type xfs (rw,noatime)

root@fileserver2 # mount -t xfs /dev/sdf3 /mnt/hdd3
mount: wrong fs type, bad option, bad superblock on /dev/sdf3,
      missing codepage or helper program, or other error
      In some cases useful info is found in syslog - try
      dmesg | tail  or so

root@fileserver2 # dmesg | tail -2
XFS (sdf3): bad magic number
XFS (sdf3): SB validate failed

所以我嘗試使用 xfs_repair -n 來查找輔助 SB,但失敗了:

root@fileserver2 # xfs_check /dev/sdf3
xfs_check: /dev/sdf3 is not a valid XFS filesystem (unexpected SB magic number 0x00000000)
xfs_check: WARNING - filesystem uses v1 dirs,limited functionality provided.
xfs_check: read failed: Invalid argument
xfs_check: data size check failed
cache_node_purge: refcount was 1, not zero (node=0x14a7380)
xfs_check: cannot read root inode (22)
bad superblock magic number 0, giving up

root@fileserver2 # xfs_repair -n /dev/sdf3

Phase 1 - find and verify superblock...
bad primary superblock - bad magic number !!!

attempting to find secondary superblock...
............[etc.]
...found candidate secondary superblock... unable to verify superblock, continuing...
[etc.]
...Sorry, could not find valid secondary superblock
Exiting now.

這是該特定驅動器上的分區,其中包括根分區 (sdf1) 和交換分區 (sdf5)。我覺得擴展分區不包括我的 sdf3 (XFS) 分區很奇怪。這意味著我的 XFS 分區將是第二個主分區,對吧?

root@fileserver2 # fdisk -l /dev/sdf

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20a0c72d

  Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *           1        2612    20980858+  83  Linux
/dev/sdf2            2613        2855     1951867    5  Extended
/dev/sdf3            2856      243202  1930581796+  83  Linux
/dev/sdf5            2613        2855     1951866   82  Linux swap / Solaris

接下來,我嘗試使用file -s來辨識該驅動器上的各種文件系統:

root@fileserver2 # file -s /dev/sdf1
/dev/sdf1: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)

root@fileserver2 # file -s /dev/sdf2
/dev/sdf2: x86 boot sector; partition 1: ID=0x82, starthead 254, startsector 2, 3903732 sectors, extended partition table (last)\011, code offset 0x1

root@fileserver2 # file -s /dev/sdf3
/dev/sdf3: x86 boot sector; partition 1: ID=0xbf, starthead 254, startsector 63, 3861163530 sectors, extended partition table (last)\011, code offset 0x0

root@fileserver2 # file -s /dev/sdf5
/dev/sdf5: Linux/i386 swap file (new style) 1 (4K pages) size 487965 pages

那麼,sdf3 似乎是第二個擴展分區..?奇怪的。

我在可以掛載的 XFS 分區上嘗試了相同的命令:

root@fileserver2 # file -s /dev/sdb1
/dev/sdb1: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)

並且還嘗試檢查sdf3分區開頭的數據:

root@fileserver2 # dd if=/dev/sdf3 bs=512 count=64 iflag=direct | hexdump -C
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 fe  |................|
000001c0  ff ff bf fe ff ff 3f 00  00 00 0a ae 24 e6 00 00  |......?.....$...|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  9c 52 1d 9c b7 00 d7 e9  e8 fc 3c 6f 4e dc 31 27  |.R........<oN.1'|
00000210  e9 98 6b b0 2f 74 c1 69  40 12 58 90 4b e3 d0 73  |..k./t.i@.X.K..s|
[...]
00007e00  58 46 53 42 00 00 10 00  00 00 00 00 1c c4 95 c1  |XFSB............|
00007e10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00007e20  41 4c 30 10 33 23 45 5f  88 6c 25 e1 03 a1 be e3  |AL0.3#E_.l%.....|
00007e30  00 00 00 00 10 00 00 04  00 00 00 00 00 00 00 80  |................|
00007e40  00 00 00 00 00 00 00 81  00 00 00 00 00 00 00 82  |................|
00007e50  00 00 00 01 07 31 25 71  00 00 00 04 00 00 00 00  |.....1%q........|
00007e60  00 03 98 92 b4 a4 02 00  01 00 00 10 68 64 64 33  |............hdd3|
00007e70  00 00 00 00 00 00 00 00  0c 09 08 04 1b 00 00 05  |................|
00007e80  00 00 00 00 00 00 00 40  00 00 00 00 00 00 00 3d  |.......@.......=|
00007e90  00 00 00 00 1c c0 fd 1b  00 00 00 00 00 00 00 00  |................|
00007ea0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00007eb0  00 00 00 00 00 00 00 02  00 00 00 00 00 00 00 00  |................|
00007ec0  00 00 00 00 00 00 00 01  00 00 00 0a 00 00 00 0a  |................|
00007ed0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00008000

(結果的完整轉儲:http: //f.cl.ly/items/3I3F3c1F1I1Z2f1w1W3Z/hexdump-sdf3.txt

因此,不是讓分區從扇區 0 開始(就像它們在其他驅動器上所做的那樣,如 sdb1),而是從扇區 63(0x7e00 = 32256 / 512 字節/扇區 = 63)開始。

關於如何解決該問題並能夠安裝這個有趣的分區的任何指針?

謝謝。

您已經確定您的文件系統在分區中啟動了 63 個扇區;這是一個完整的磁軌(63 個扇區/磁軌,因此分區的第一個磁軌是扇區 0-62)。考慮到這一點,您可以嘗試修改分區表,以便/dev/sdf3稍後恰好開始一個軌道,即從

/dev/sdf3            2856      243202  1930581796+  83  Linux

/dev/sdf3            2857      243202  1930581796+  83  Linux

然後看看能不能掛載。

引用自:https://serverfault.com/questions/509852