How to Run ESXi FSCK Command And Fix Its Errors

Regularly performing file system checks on ESXi hosts helps ensure the overall health and stability of the virtualized infrastructure. And this his article will give you an understanding of how to perform ESXi FSCK.

Zelia

By Zelia / Updated on June 6, 2023

Share this: instagram reddit

What is ESXi file system check

ESXi file system check refers to the process of examining and verifying the integrity of the file system used by an ESXi host. The file system, such as VMFS or NFS, is responsible for storing virtual machine files, configurations, and other critical data. Performing regular file system checks is essential to identify and resolve any issues that could potentially impact the stability and reliability of virtual machines.

vmware-esxi-fsck

Why need ESXi FSCK

There are several reasons why performing regular file system checks on ESXi hosts is crucial.

  • Detection of Disk Errors: Identify and flag any disk errors or bad sectors on the storage devices used by ESXi hosts.
  • Metadata Consistency: Validate the metadata and resolve any inconsistencies, ensuring accurate file system operations.
  • Prevention of Data Corruption: Help identify and repair corrupted files or file system structures, minimizing the risk of data loss or incorrect data interpretation.
  • Identification of Orphaned Files: Help identify and remove orphaned files, optimizing storage utilization and improving overall system performance.
  • Compliance Requirements: Help meet compliance requirements and provides documentation of ongoing data protection practices.

Therefore, by performing regular file system checks on ESXi hosts, you can maintain the stability, reliability, and data integrity of your virtualized environments. This proactive approach helps identify and resolve potential issues before they escalate, reducing the risk of data loss, system failures, and downtime.

How to use ESXi FSCK commands to maintain data integrity

When there is a problem with the ESXi file system, you may need to run the ESXi FSCK manually to fix the error and maintain data integrity. Running ESXi check file system manually requires some technical knowledge and operational skills, and the following are specific steps on how to run FSCK:

1. Once the appliance has rebooted, access the VMware console for it, bring up a console for it (if necessary, click the mouse into it to give the window focus), and repeatedly press the Esc key.

bring-up-a-console

2. Press e to edit the commands before booting, and add the following lines:

fsck.mode=force and fsck.repair=yes

press-e-to-edit-the-command

3. Press F10 to boot. The following command should show that fsck was run recently.

press-f10-to-boot

How to fix ESXi file system check when it fails

It is possible to troubleshoot by rebooting the virtual machine, modifying the GRUB edit menu to enter emergency mode before Photon OS fully boots, and executing FSCK if it fails to run when the computer boots and an error message instructs you to do so.

1. Make a backup of virtual machines first.

2. Restart the virtual machine running Photon OS. When Photon OS restarts and the splash screen shows, rapidly type the letter e to access the GNU GRUB edit menu.

Note: As photon OS reboots quickly, so you must type e quickly. Additionally, with VMware vSphere or VMware Workstation Pro installed, the console may need to be given focus by clicking in its window before it will register keyboard input.

3. Add the following code exactly as it appears below to the end of the line that begins with linux in the GNU GRUB edit menu.

systemd.unit=emergency.target

4. Type F10. Depending on whether sda1 or sda2 represents the root file system, use one of the following commands in the bash shell to correct the file system issues:

`e2fsck -y /dev/sda1`

`e2fsck -y /dev/sda2`

5. Restart the virtual machine, and the errors will be fixed.

Backup multiple ESXi VMs for data protection

While ESXi file system check (FSCK) is crucial for maintaining the health of the file system, it's equally important to recognize the inherent limitations of FSCK when it comes to comprehensive data protection. That's where AOMEI Cyber Backup plays a pivotal role.

Implementing a robust data backup solution ensures an additional layer of defense against data loss, safeguarding critical information from hardware failures, software glitches, cyberattacks, and other potential risks.

The free VMware backup software - AOMEI Cyber Backup automates the image-based backup for multiple virtual machines and facilitates the recovery procedures. And it doubtlessly reduces business downtime and operating error.

✍ It supports both VMware ESXi (6.0 and above) & Hyper-V (2012 and later) while offering the following benefits:

✦ Perpetual Free: No time limit for AOMEI Cyber Backup Free Edition.
✦ Easy-to-use: Backup and restore virtual machines in a concise and user-friendly central console.
✦ Agentless Backup: Create image-based backup of multiple VMs without installing Agent on each VM.
✦ Automatic Backup: Schedule the VMware backups to run the tasks automatically.
✦ Restore VM From Any Point: Restore a whole VM from any backed up point.

Please click on the button below to download and try AOMEI Cyber Backup for free:

Download FreewareVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

1. Bind Devices: Access to AOMEI Cyber Backup web client, navigate to Source Device >> VMware >> + Add VMware Device to Add vCenter or Standalone ESXi host. And then click >> Bind Device.

add-vmware-device

2. Create Backup Task: Navigate to Backup Task >> + Create New Task >> VMware ESXi Backup as the Backup Type. Then set the Task Name, Device, Target, Schedule and Cleanup as needed.

create-backup-task

  • Device: Backup multiple VMs on vCenter or standalone host within one backup task.
  • Target: Select to back up to a local path, or to a network path. Used paths will be saved in Favorite Storage for handy selection.
  • Schedule (optional): Perform full, differential, or incremental backup, and automate execution daily, weekly, or monthly according to the frequency you specified.

3. Start Backup: Click Start Backup to select to Add the schedule and start backup now, or Add the schedule only.

start-backup

4. If the ESXi VM corrupts, you can click Restore to perform instant disaster recovery. You can restore VMware VM to the original place.

restore-virtual-machine

While the Free Edition covers most of VM backup needs, you can also upgrade to enjoy the following functions:

  • Batch VM Backup: Batch backup large numbers of VMs managed by vCenter Server or standalone ESXi hosts.

select-virtual-machines-on-vcenter

  • Backup cleanup: Configure a retention policy to auto delete old backup files and save storage space.

backup-cleanup

  • Restore to new location: Create a new VM in the same or another datastore/host directly from the backup, saves the trouble of re-configuring the new VM.

restore-to-new-location

Conclusion

ESXi file system inspection and data backup are important steps to ensure data security. By performing a file system check, you can identify and resolve potential problems in a timely manner and ensure the proper operation of your server. However, file system check alone is not enough, data security requires more comprehensive protection.

In today's digital age, the value of data is becoming more and more important, and you should be highly vigilant about the security of your data. Both individual users and business organizations should take appropriate measures to protect data from potential threats.

Zelia
Zelia · Editor
Zelia is an editor from AOMEI Technology.She mainly writes articles about virtual machine. Writing is one of her hobbies and she wants her articles to be seen by more people. In her spare time, she likes to draw and listen to music, and it is a pleasure for her to focus on her own world.