Operations 7 min read

How to Rescue a Broken CentOS Filesystem and Fix Windows Boot Issues

Learn step-by-step how to mount a CentOS ISO into rescue mode, activate LVM volumes, run XFS repair (or ext4 fsck), and then restore a Windows Server 2022 virtual machine’s bootloader using diskpart, bootrec, and bcdboot commands, ensuring both Linux and Windows systems boot correctly.

Ops Development Stories
Ops Development Stories
Ops Development Stories
How to Rescue a Broken CentOS Filesystem and Fix Windows Boot Issues

CentOS Filesystem Repair

1. Mount ISO and enter rescue mode

Mount the CentOS installation ISO to the VM/CD‑ROM or insert a boot disk.

Reboot the system and boot from the ISO.

In the boot menu choose Troubleshooting → Rescue a CentOS system .

2. Enter rescue environment

After boot the system presents a text interface with options: Continue: try to mount the existing system and enter a chroot environment. Read-Only: mount the filesystem read‑only. Skip: do not mount, enter a minimal rescue environment.

If you only need to repair the filesystem, choose Skip .

3. Scan and activate LVM volumes

In rescue mode, selecting Skip prevents automatic LVM activation, so devices such as /dev/mapper/centos-root are invisible. To repair XFS you must manually activate LVM.

lvm vgscan
lvm vgchange -ay

After activation you can see /dev/mapper/centos-root, centos-home, etc.

4. Execute xfs_repair

The partition is not mounted, so you can run: xfs_repair /dev/mapper/centos-root If errors persist, try the force option: xfs_repair -L /dev/mapper/centos-root ⚠️ Note: -L discards the XFS log, which may lose recent unwritten data, but usually restores system usability.

For ext4 systems use fsck -y on the logical volume.

6. Reboot after repair

reboot

Windows Boot Repair

Windows Server 2022 VM stuck on the Windows logo.

Attempted boot repair with a third‑party ISO (wepe) – unsuccessful.

Boot from an official Windows 2022 ISO, click Repair your computer → Troubleshoot → Advanced options → Command Prompt .

Identify the system drive inside the recovery environment; the virtual machine shows only ISO drives, so the actual system disk (virtio) is not visible.

Load the virtio driver:

drvload E:\virtio-win\viostor\2k22\amd64\viostor.inf

Replace E: with the drive letter where the virtio ISO is mounted.

After driver load, run diskpart to list disks and volumes.

diskpart
list disk
list volume
exit

The boot partition is C:, the system partition is F:.

Use bootrec and bcdboot to repair the bootloader and rebuild the BCD:

bootsect /nt60 C: /mbr
nt60 writes the boot sector format used by Windows Vista/7/8/10/11/Server 2008+. /mbr rewrites the Master Boot Record, suitable for legacy BIOS boot. C: is the boot partition.

Recreate boot files from the system directory:

bcdboot F:\Windows /s C: /f BIOS
F:\Windows is your Windows system folder. /s C: specifies the boot partition (the “System Reserved” partition). /f BIOS indicates a legacy BIOS boot (not UEFI).

Change the boot order to hard‑disk and reboot. After the MBR fix the VM may show a blue‑screen loop, then press F8 to enter Safe Mode, which auto‑repairs; reboot again to boot normally.

WindowsLVMFilesystemCentOSXFSrescue-modeBoot Repair
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.