To check the free space on an ESX/ESXi service console partitions:
df -h
.Filesystem Size Used Avail Use% Mounted on
/dev/sda2 4.9G 3.0G 1.6G 66% /
/dev/sda1 99M 18M 77M 19% /boot
none 145M 0 145M 0% /dev/shm
/dev/sda7 2.0G 135M 1.7G 8% /var/log
[root@server]#
Filesystem Size Used Available Use% Mounted on
visorfs 1.3G 322.3M 1.0G 24% /
vmfs3 63.3G 570.0M 62.7G 1% /vmfs/volumes/4d71190d-########-####-########16ba
vfat 285.9M 135.5M 150.4M 47% /vmfs/volumes/3c3693e8-########-####-########6d3a
vfat 4.0G 2.7M 4.0G 0% /vmfs/volumes/4d71190d-########-####-########916ba
vfat 249.7M 102.0M 147.7M 41% /vmfs/volumes/474ef17b-########-####-########916e
vfat 249.7M 4.0k 249.7M 0% /vmfs/volumes/51aa187c-########-####-########c73c
Review the Use% for each of the listed items. If any of the volumes listed are 100% full, they must be investigated to determine if space can be freed. The most important mount points to investigate on a default installation of ESX are the /
and /var/log
mounts because if they are full they can prevent proper operation of the ESX host.
logout
and press Enter to exit the system.To check the free space on a VMFS volume of an ESX/ESXi host:
vdf -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 4.9G 3.0G 1.6G 66% /
/dev/sda1 99M 18M 77M 19% /boot
none 145M 0 145M 0% /dev/shm
/dev/sda7 2.0G 135M 1.7G 8% /var/log
/vmfs/devices 439G 0 439G 0% /vmfs/devices
/vmfs/volumes/458865ba-########-####-#######e616
68G 47G 20G 69% /vmfs/volumes/San_Storage
/vmfs/volumes/45b5eb1a-########-####-#######5854b
26G 9.7G 16G 36% /vmfs/volumes/Local_Storage
logout
and press Enter to exit the system.du -h --max-depth=1
<dir>. This command lists the directories within a given filesystem that contain the largest files. By starting at the root (/) directory and finding the largest directories, you can then drill down into these directories (using cd) and execute the same command recursively until you find the files themselves which are occupying space.</dir>
For related information, see Troubleshooting ESXi datastore or VMFS volume that is full or near capacity.
Information may accumulate on disks for several reasons. Log files may grow after a substantial amount of messages are written to them. Content such as virtual machines or ISOs may be copied to the ESX or ESXi host, but placed in an inappropriate location. Coredumps from past outages may have accumulated.
To confirm this, review the size of these directories:
/vmimages/
directory is used to store operating system install files such as the VMware Tools or other ISO files./var/core/
and /root/
directories are used to store crash files for on the service console and the VMkernel./var/log/
directory is used to store the majority of the logs for the ESX host./vmfs/volumes/
Datastores are used to store the virtual machine data.To review the space consumed by several of these common directories, run this command:
du -ch /vmimages /var/core /root /var/log
find
command to locate all files matching a given criteria./
that are larger than 10MB without traversing mount points, use the command:find / -size +10M
-exec du -h {} \; | less
/var/
that are larger than 1MB without traversing mount points, use the command:find /var/ -size +1M
-mount -exec du -h {} \; | less
You need the following for anything over 1M :
find / -size +1000k -exec du -h {} \;
find
command is flexible and can be used to find files matching specific criteria. For more information, see the GNU Find documentation.The following are a list of files that are safe to delete:
vmware*.log
files in the virtual machine's folder. /vmimages/.
After you have determined what is consuming disk space, delete the unnecessary files:
rm
command to permanently delete files. For example:rm /var/log/oldlogfile
Should the files discovered with the du command be large and you wish not to delete the files, you may zero out the contents of a file with the standard redirect command.
Example: If file.log is 45MB and you wish to keep the file and clear all the data from the file to reduce its size, run the following command from an SSH connection to the host:
# > file.log
The standard redirect of zero input into the file will cause the file to become 0kb in size and retain its name and permissions.
Historical log files on an ESX or ESXi host may be required for reference in troubleshooting or trending. They can be compressed and archived rather than being deleted. Note, see also vmsupport files left on ESX or ESXi host fill the filesystem on which they reside.
To compress historic log files:
var/log/vmkwarning
and /var/log/vmkernel log files:tar czvf /tmp/vmkwarning-logs.tgz /var/log/vmkwarning*
tar czvf /tmp/vmkernel-logs.tgz /var/log/vmkernel.*
/var/log/messages
log files:tar czvf /tmp/messages-logs.tgz /var/log/messages.*
rm /var/log/vmkwarning.* /var/log/vmkernel.* /var/log/messages.*
/var/log/
partition for long-term storage using the command:mv
/tmp/vmkwarning-logs.tgz
/tmp/
vmkernel-logs.tgz
/tmp/messages-logs.tgz
/var/log/
Additional find command:
This command is for ESXi 4.x
find / -size +10240000c -exec vmkvsitools visorfsdu -h {} \; | less
For ESXi 5.x and later:
find / -size +10240000c -exec vmkvsitools vdu -h {} \; | less