How to FSCK VMFS Repair? Fix FSCK Errors in VMFS
Once the file system of your local or virtual drive gets corrupted, it puts the entire data on the drive at risk. Running file system checks on your ESXi hosts will help you identify on time – when something is not right. This article explains how to run file system checks on ESXi hots and why it is important that you do it regularly.
How to Run ESXi FSCK Command
The ESXi FSCK command is a Linux command to manually check your ESXi file system and fix any problems that may be detected in the check. This command is an admin-level action, and you should be a technical person to run it successfully. It is equivalent to running CHKDSK on local hard drives and external media. As a precautionary measure, you may want to run a complete backup of the ESXi drive before proceeding.
- Boot into the vCenter, and launch the console for running admin commands
- Identify the problematic VM and shut it down.
- Choose to edit the commands before rebooting the virtual machine (in the console)
- Now, enter this command: fsck.mode=force and fsck.repair=yes
- Press CTRL + X or F10 to boot the system back
What is ESXi File System Check
The ESXi File System Check helps you to know the status of your virtual machine(s). It helps you to identify failure signs on time and fix them before they escalate and become much more complex issues with greater risks of data loss.
When you run the ESXi file system check, it scans your VMFS drives and shows you quite various handy information worth knowing about your VMs. Literally, you can only ascertain the integrity and healthiness of the file system used by an ESXi host by running this important check.
Thus, it is important that you run this check quite frequently – although it should run automatically each time you reboot the VM, but in situations when it doesn’t, run it manually following the command explained earlier.
Why Do You Need To Run ESXi FSCK?
The reasons cannot be overemphasized as it is necessary to keep an eye on your virtual machines’ health status. Failure to do this, your VMs may fail at the least time you expected, causing you to experience a drastic data loss scenario that may throw you off balance. Hereunder are reasons why ESXi FSCK is important.
- Identify Disk Errors in Time: The check will help you spot disk errors and bad sectors on your ESXi drives.
- Metadata Consistency: Validate and resolve any metadata inconsistency on time to avoid file system corruption.
- Phish Out Orphaned Files: The check will help you spot orphaned files and remove them to optimize your storage space.
- To Meet Compliance Requirements: FSCK can help to point out if you meet specific compliance requirements for data protection practices.
If you fail to run the FSCK command quite regularly, things will go wrong with your VMFS-formatted drives and you won’t know until they turn into fatal scenarios. On the contrary, by checking up your ESXi hosts routinely, you can maintain the stability and data integrity of your virtual environments. So to say, ESXi FSCK is a proactive measure to ensure your virtualized environments run optimally, always, reducing the risk of data loss, downtime, and system failures.
How to Use ESXi FSCK Commands to Retain Data Integrity
There are quite many ESXi FSCK commands, just as there are many commands you can run with the CHKDSK utility for your local drives. However, here’s the command to check file integrity using ESXi FSCK. (Note: maintaining file integrity in this context means to regulary keep an eye on the results from the command being explained below).
- Reboot the system which has the virtual machines running in it.
- When the system reboots, launch the VMware console and repeatedly press the Esc key.
- Now, press “e” on your keyboard entering the command to reboot your virtual machine(s).
- Enter this command into the prompt: fsck.mode=force and fsck.repair=yes
- You can now reboot the system by pressing the F10 key. After the system has rebooted, you will find a report that shows you the information you seek.
How to Fix ESXi File System Check When It Fails
The FSCK command runs automatically at startup, but in a situation where it doesn’t, you have to run it manually. Also, in some cases, the unsuccessful run of FSCK may stop the full booting of the system. In this guide below, we’ll explain how to fix ESXi FSCK when running Photon OS for your VMs.
- A quick fix will be to restart the VM, but in situations where this won’t work, you will need to alter the GRUB edit menu and run some configurations.
- Take a snapshot of the problematic VN and restart the PhotonOS-based virtual machine.
- When the Photon OS splash screen appears, quickly press the “e” button on your keyboard to launch the GNU GRUB edit menu.
Note: If you miss not pressing the “e” button pretty quickly, Photon OS will reboot normally, and quickly. If you use VMware vSphere or VMware Workstation Pro, a mouse click is required to focus the console before your keyboard input will register.
- In the GNU GRUB edit menu, find the line of code that starts with “Linux,” add a space, and copy this syntax exactly as it appears systemd.unit=emergency.target
- Type F10
- Depending on whether your VM is based on sda1 or sda2, you will run any of these in the bash shell:
- `e2fsck -y /dev/sda1`
or
- `e2fsck -y /dev/sda2`
- Restart the virtual machine.
How to Use FSCK to Fix USB Drive?
You have to unmount the USB drive first before proceeding to run the FSCK and repair or fix the filesystem.
Code to unmount the USB drive
$ sudo umount /dev/sdb1
Run FSCK
$ sudo fsck.vfat /dev/sdb1
fsck.fat 4.1 (2023-01-24)
/dev/sdb1: 694 files, 248747/938214 clusters
Backup Multiple ESXi VMs for Data Protection
The ESXi file system check helps to check the health status of your VMs, but it doesn’t come in handy for backing up your VM. Thus, although you may keep up with the FSCK scans, you also need to run regular backups to protect your VMs data.
This backup can be achieved using third-party software like DiskInternals VMFS Recovery. Using VMFS Recovery by DiskInternals, you can create free backups of your local disks which have your VMs created in them. You can always restore the backups at any time.
How To Back Up Your VMs Using DiskInternals VMFS Recovery
The DiskInternals VMFS Recovery is a professional tool that lets you backup your VMware disks and VFMS-formatted drives. It is one of the best-proven effective tools for this action and it runs on all Windows OS platforms.
- Step One: Download the DiskInternals VMFS Recovery and install it on your PC, launch the app, and wait for all your connected drives to appear
- Step Two: Select the VMFS drive that contains your ESXi virtual machines, right-click on the drive, and select “Create Disk Image.”
- Step Three: Select a location to save the disk image; this is simply a clone of your hard drive in image format.
That’s it, DiskInternals VMFS Recovery lets you create these backups for free – as many times as you deem fit, and at any random intervals.
Conclusion
What more? ESXi FSCK has more benefits than limitations. It lets you know the data integrity of your VMware VMs. Also, you can use the FSCK command to repair some common issues you may experience with booting into your VMs. But then, you should not pay deaf ears to the demanding need to make regular backups for data protection. The DiskInternals VMFS Recovery is a very good tool for backing up your VMs, it also comes in handy for recovering VMDK files and literally any file format from VMFS drives.
Tip: learn about VMware orphaned VM