6

I have 9 partitions formatted as XFS on my server.

When I try to mount one of them, it fails. The others mount fine.

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

So I tried to use xfs_repair -n to find secondary SB, but that failed:

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.

Here's the partitions on that specific drive, which include the root partition (sdf1), and the swap partition (sdf5). I find it weird that the Extended partition doesn't included my sdf3 (XFS) partition. That would mean my XFS partition would be a second primary partition, right?

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

Next, I tried to use file -s to identify the various file-systems on that drive:

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

So, sdf3 appears to be a second extended partition..? Weird.

I tried the same command on a XFS partition that I can mount:

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

And also tried to check the data at the beginning of the sdf3 partition:

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

(Full dump of result: http://f.cl.ly/items/3I3F3c1F1I1Z2f1w1W3Z/hexdump-sdf3.txt)

So, instead of having the partition start on sector 0 (like they do on other drives, like sdb1), it starts at sector 63 (0x7e00 = 32256 / 512 bytes/sector = 63).

Any pointer on how I could resolve that problem, and be able to mount this funny partition?

Thanks.

7

You've established that your filesystem starts 63 sectors into the partition; this is one complete track (63 sectors/track, so the first track of the partition is sectors 0-62). With that in mind, you could try modifying the partition table so that /dev/sdf3 starts exactly one track later, i.e. from

/dev/sdf3            2856      243202  1930581796+  83  Linux

to

/dev/sdf3            2857      243202  1930581796+  83  Linux

and then see if you can mount it.

3
  • What can I use to make such a change non-destructively? – Guillaume Boudreau May 22 '13 at 18:33
  • In theory you're only changing the partition table, which you could change back again. Make sure to mount the filesystem read-only in the first instance, and run an fsck before mounting it read-write. – Flup May 22 '13 at 21:23
  • 3
    Thanks. It worked. Here's how I was able to edit my partition table non-destructively: Backup current partition table: sfdisk -d /dev/sdf > sdf-pt.txt Create a copy: cp sdf-pt.txt new-sdf-pt.txt I then edited the sdf3 line in new-sdf-pt.txt to start 63 sectors higher, and I changed the size to be 63 sectors smaller. Finally: sfdisk --no-reread -f /dev/sdf < new-sdf-pt.txt and reboot. Voilà! :) – Guillaume Boudreau May 23 '13 at 1:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.