This just happened again on a different machine, right after running
$ sudo xfs_repair /dev/mmcblk0 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 = 1 - agno = 2 - agno = 0 - 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 $ echo $? 0 $ sudo mount -t xfs /dev/mmcblk0 /mnt/disk mount: wrong fs type, bad option, bad superblock on /dev/mmcblk0, $ sudo dmesg -t | tail XFS (mmcblk0): Mounting V5 Filesystem XFS (mmcblk0): Corruption warning: Metadata has LSN (20:50596) ahead of current LSN (1:2). Please unmount and run xfs_repair (>= v4.3) to resolve. XFS (mmcblk0): log mount/recovery failed: error -22 XFS (mmcblk0): log mount failedWhat happened here? Apparently, with the XFS v5 superblock the userspace tools (xfsprogs) also changed.
And so it happened that xfs_repair version 3.2.1 tried to check an XFS file system that had already enabled its
v5superblock format. But the version is too old to handle v5 superblocks and left the file system in an corrupt state.
Luckily it's easy to fix:
> Kernel v4.4 and later detects an XFS log problem which is only fixed by > xfsprogs v4.3 or later. If you have encountered the inability to mount an > xfs filesystem, please update to this version of xfsprogs and run > xfs_repair against the filesystem.And indeed:
$ /opt/xfsprogs/sbin/xfs_repair -V xfs_repair version 4.5.0 $ sudo /opt/xfsprogs/sbin/xfs_repair /dev/mmcblk0 [...] Phase 7 - verify and correct link counts... Maximum metadata LSN (20:50596) is ahead of log (1:2). Format log to cycle 23. done $ sudo mount -t xfs /dev/mmcblk0 /mnt/disk $ mount | tail -1 /dev/mmcblk0 on /mnt/disk type xfs (rw,relatime,attr2,discard,inode64,noquota)Phew! :-)