In this entry I detail how I managed to fix this problem that I have had in CentOS 8: 'Metadata corruption detected at xfs_agi_verify. Unmount and run xfs_repair. First 128 bytes of corrupter buffered'. On a CentOs 8 virtual machine managed with Virtual Box by an incorrect shutdown of the host computer I have had this issue that prevents the vm from booting with the following error detail:

I ran both 'journalctl -xe' and 'cat /run/initramfs/rdsosreport.tct' and I have been given the same result indicating that the '/sysroot' mount failed with the message 'Failed to read root inode 0x00':

I did not have the command 'df' available to see the mount points, and I ran the 'mount' command to see which mount points did not appear that failed as is logical:

To run xfs_repair I need to know where to run it and make a previous umount as specified by the error message, but the problem is that I do not know where the /sysroot is mapped.

To know where the '/sysroot' is mapped I stopped the machine again and started it by entering the 'e' option to be able to see the boot script:

In this menu I press the 'e' key and the following appears:

Where you see that the operating system root is in /dev/mapper/cl-root, interpreting this as the filesystem to 'umount' and to run the 'xfs_repair' command.

Before doing anything, as I have another CentOS 8 vm I confirm by booting this and running the following command to see the mappings you have:

df -h

Where I certify that in '/dev/mapper/cl-root' the root '/' is mapped:

I run first on CentOS 8 that does not boot the command:

umount -f /dev/mapper/cl-root

to confirm that it is not mapped as 'xfs_repair' must be run on an uns yet mounted filesystem, and as confirmed the response is not mounted:

Then I run the 'xfs_repair' command for '/dev/mapper/cl-root' with the '-n' option to only report errors without making changes:

xfs_repair -n /dev/mapper/cl-root

This command returns the following that I can't interpret (I don't have the scroll available in the error console and therefore I can only show the end of the command response):

I decide against any error or strange message to run the 'xfs_repair' command without any options (there are different options if it does not work with any option to make specific repairs: see https://man7.org/linux/man-pages/man8/xfs_repair.8.html):

xfs_repair /dev/mapper/cl-root

which returns:

Then as I don't have available 'shutdown' I run:

init 6

And the system starts smoothly:

Ugh, that's a bad time.