The procedure below documents the commands necessary to run a check of the system partitions of ESXi. The below image shows the output of fdisk -l and the partitions which will be checked are circled. The 2 partitions consisting of 49136 blocks are the Hypervisor1 and Hypervisor2 partitions. These are mounted by ESXi as /bootbank and /altbootbank and store the firmware which ESXi boots with. A system backup file state.tgz (local.tgz for ESXi Embedded) is also stored on these partitions.
ESXi will read /bootbank when booting and then will backup it’s configuration once per hour. The last partition consisting of 552944 blocks is Hypervisor3 and is mounted as /store by ESXi. This partition is used to store items like download files for the VI client, VMware Tools ISOs for VMs, and configuration and system files for the vCenter Server agent and the HA agent.
The last partition circle first below will only exist with ESXi Installable. This partition is mounted as /scratch and is where ESXi will place the userworld swap file. This partition will correspond to the location set by the Advanced Setting: ScratchConfig.ConfiguredScratchLocation.
While not necessary for this procedure, you can use the commands esxcfg-vmhbadevs and ls to link the partitions shown by fdisk to the mounts ESXi has made to determine which partition is /altbootbank and which is /bootbank.
~ # esxcfg-vmhbadevs -f
[2009-03-19 01:19:03 ‘StorageInfo’ warning] Skipping dir: /vmfs/volumes/0451af74-f19fbb7e-e274-97e1e6858ec4. Cannot open volume: /vmfs/volumes/0451af74-f19fbb7e-e274-97e1e6858ec4
vmhba1:0:0:8 /vmfs/devices/disks/vmhba1:0:0:8 e0a264ee-3bc421b8-cdd5-3a5cb7c2a09f
vmhba1:0:0:2 /vmfs/devices/disks/vmhba1:0:0:2 488fb202-34873070-edd2-00096b63ac0a
vmhba1:0:0:5 /vmfs/devices/disks/vmhba1:0:0:5 9820ef76-fed75a33-f596-a0e3aa642c3a
~ # ls -l | grep vmfs
l——— 0 root root 1984 Jan 1 1970 altbootbank -> /vmfs/volumes/0451af74-f19fbb7e-e274-97e1e6858ec4
l——— 0 root root 1984 Jan 1 1970 bootbank -> /vmfs/volumes/9820ef76-fed75a33-f596-a0e3aa642c3a
l——— 0 root root 1984 Jan 1 1970 scratch -> /vmfs/volumes/488fb202-34873070-edd2-00096b63ac0a
l——— 0 root root 1984 Jan 1 1970 store -> /vmfs/volumes/e0a264ee-3bc421b8-cdd5-3a5cb7c2a09f
drwxr-xr-x 1 root root 512 Jan 9 02:35 vmfs
Once you have identified the partitions to check you can use the dosfsck command to check a partition. The command has a number of options, but you must at least specify the disk to check. The first example also includes the -v option with provides verbose output. The -a option will automatically try to correct any issues.
dosfsck -v /dev/disks/vmhba1:0:0:5 dosfsck 2.11 (12 Mar 2005) dosfsck 2.11, 12 Mar 2005, FAT32, LFN Checking we can access the last sector of the filesystem Boot sector contents: System ID "mkdosfs" Media byte 0xf8 (hard disk) 512 bytes per logical sector 1024 bytes per cluster 2 reserved sectors First FAT starts at byte 1024 (sector 2) 2 FATs, 16 bit entries 98304 bytes per FAT (= 192 sectors) Root directory starts at byte 197632 (sector 386) 512 root directory entries Data area starts at byte 214016 (sector 418) 48927 data clusters (50101248 bytes) 32 sectors/track, 64 heads 0 hidden sectors 98272 sectors total Checking for unused clusters. /dev/disks/vmhba1:0:0:5: 10 files, 37485/48927 clusters
You can also use the -V option to run a verification pass of a partition or the -t option to test for bad sectors (this also requires the -a (automatically repair) or -r (interactively repair) options).
dosfsck -t -r /dev/disks/vmhba1:0:0:2 dosfsck 2.11, 12 Mar 2005, FAT32, LFN Seek to 2147491840:Success dosfsck -V /dev/disks/vmhba1:0:0:2 dosfsck 2.11, 12 Mar 2005, FAT32, LFN Starting check/repair pass. Starting verification pass. /dev/disks/vmhba1:0:0:2: 8 files, 16390/65515 clusters
All the options for the command dosfsck are shown below.
dosfsck usage: dosfsck [-aAflrtvVwy] [-d path -d ...] [-u path -u ...] device -a automatically repair the file system -A toggle Atari file system format -d path drop that file -f salvage unused chains to files -l list path names -n no-op, check non-interactively without changing -r interactively repair the file system -t test for bad clusters -u path try to undelete that (non-directory) file -v verbose mode -V perform a verification pass -w write changes to disk immediately -y same as -a, for compat with other *fsck