sudo xfs_db -r -c "sb 0" -c "addr agf" -c "p" /dev/sdb1

If you have a offset (e.g., you found AG 1 at offset 1048576 bytes), you can copy it over the primary superblock.

sudo xfs_repair -o bsize=4096 -L /dev/sdb1

Watch for Reallocated_Sector_Ct and Pending_Sector counts.

When an administrator runs xfs_repair and encounters the error:

: Ensure your device identifier (e.g., /dev/sdb1 ) is correct. If the partition table was recently modified or damaged, xfs_repair might be looking at the wrong sector offsets. Use tools like testdisk to attempt partition table recovery.

Look for I/O errors, sector read failures, or corrupt primary superblock messages. If there are hardware I/O errors (e.g., Read error at sector 12345 ), stop immediately. You have a failing drive. Use ddrescue to clone the drive before any repair attempts.

sudo xfs_repair -L /dev/sdb1

Recoverable if the original partition start/end sectors are restored.