Linux root partition with XFS that cannot be mounted because of dirty and inconsistent log. Log can be neither repaired nor cleared:
$ sudo xfs_repair /dev/nvme0n1p7
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
Log inconsistent (didn't find previous header)
failed to find log head
zero_log: cannot find log head/tail (xlog_find_tail=5)
ERROR: The log head and/or tail cannot be discovered. Attempt to mount the
filesystem to replay the log or use the -L option to destroy the log and
attempt a repair.
$ sudo mount /dev/nvme0n1p7 /mnt
# says something like
# Cannot mount, run xfs_repair first
$ sudo xfs_repair -L /dev/nvme0n1p7
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
Log inconsistent (didn't find previous header)
failed to find log head
zero_log: cannot find log head/tail (xlog_find_tail=5)
Log inconsistent (didn't find previous header)
failed to find log head
fatal error -- failed to clear log%
- Attach an external disk
sudo xfs_copy -d /dev/nvme0n1p7 /run/media/manjaro/PortableSSD/mariana_xfs.img
- errors out without-d
, takes ~2h for ~500GB filesystemxfs_repair -L /run/media/manjaro/PortableSSD/mariana_xfs.img
- this succeeds on the copied imagemount /run/media/manjaro/PortableSSD/mariana_xfs.img /mnt
cp /mnt/home/mariana /run/media/manjaro/PortableSSD/mariana
- backup your files
If you need to fix the original filesystem, you can try xfs_metadump
/xfs_mdrestore
combo using the repaired image to repair the original broken file system or use again xfs_copy
to replace the original broken filesystem with the repaired copy.