Saminnet-Search Article Wiki Forum Blog SNS Cloud
ESXi disk verify

  • Data-Articles
    • Slower CKD stage (3) Wed12,16:41pm

      Having your kidneys work 窶 even a little 窶 can help you feel better and live longer. If you can slow your CKD, you can delay the need for treatment of kidney failure. The types of changes you might make to help your heart or the rest of your body will help your kidneys, too. Here are some things you can do 窶 or avoid 窶 to protect your kidneys: r Blood Sugar In The Target Range.…

      Read More...

ESXi disk verify

hecking disk space usage on the ESX/ESXi service console partitions

To check the free space on an ESX/ESXi service console partitions:

  1. Open a console to the ESX/ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and 5.0 (1017910).
  2. Type df -h.

    For ESX, you see output similar to:

    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]#

    Note: The partitions shown are from a default installation of an ESX host. If you have modified the partition configuration, the output may appear differently.

    For ESXi, you see output similar to:

    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-5921bfa8-03ea-001e0be916ba
    vfat 285.9M 135.5M 150.4M 47% /vmfs/volumes/3c3693e8-f77a642a-1910-5c6bdcb26d3a
    vfat 4.0G 2.7M 4.0G 0% /vmfs/volumes/4d71190d-190fbdb0-ff95-001e0be916ba
    vfat 249.7M 102.0M 147.7M 41% /vmfs/volumes/474ef17b-e05aa697-c0fe-f8c0bde4916e
    vfat 249.7M 4.0k 249.7M 0% /vmfs/volumes/51aa187c-89f6786d-a281-5b966197c73c

  3. 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.

  4. When you have finished reviewing the output, type logout and press Enter to exit the system.

Checking disk space usage on a VMFS volume of an ESX/ESXi host

To check the free space on a VMFS volume of an ESX/ESXi host:

  1. Open a console to the ESX/ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and 5.0 (1017910).
  2. Determine the free disk space on each filesystem using the command:

    vdf -h

    The output appears similar to:

    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-b31110fd-43d5-00127994e616
    68G 47G 20G 69% /vmfs/volumes/San_Storage
    /vmfs/volumes/45b5eb1a-808343db-ecab-00114335854b
    26G 9.7G 16G 36% /vmfs/volumes/Local_Storage

    Note: The partitions shown are dependent on the VMFS volumes you have defined and presented to the ESX or ESXi host.

  3. 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. If a VMFS volume is full you cannot create any new virtual machines and any virtual machines that are using snapshots may fail.
  4. When you have finished reviewing the output, type logout and press Enter to exit the system.
Notes:
  • Another useful command is 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.
  • du -h is not available on ESXi 4.x. Reference the find commands in Identifying large files on an ESX or ESXi host to list the largest files.

</dir>

For related information, see Troubleshooting a datastore or VMFS volume that is full or near capacity (1003412).

Identifying large files on an ESX or ESXi host

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:

  • The /vmimages/ directory is used to store operating system install files such as the VMware Tools or other ISO files.
  • The /var/core/ and /root/ directories are used to store crash files for on the service console and the VMkernel.
  • The /var/log/ directory is used to store the majority of the logs for the ESX host.
  • The /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
Note: This command is not available on ESXi 4.x and ESXi 5.0.

If you are unable to determine what is consuming the disk space, use the find command to locate all files matching a given criteria.
For example, to find files within / that are larger than 10MB without traversing mount points, use the command:
find / -size +10M -exec du -h {} \; | less

To find files within /var/ that are larger than 1MB without traversing mount points, use the command:
find /var/ -size +1M -mount -exec du -h {} \; | less

Notes:

  • The -mount option to the find command is not available in ESXi.
  • The parameters for ESXi 5.0, 5.1 and 5.5 are different. For more information, see below.
-size N[bck] File size is N (c:bytes,k:kbytes,b:512 bytes(def.)).
+/-N: file size is bigger/smaller than N
-print Print (default and assumed)

You need the following for anything over 1M :

find / -size +1000k -exec du -h {} \;

Note: The find command is flexible and can be used to find files matching specific criteria. For more information, see the GNU Find documentation.
The preceding link was correct as of April 05, 2013. If you find the link is broken, provide feedback and a VMware employee will update the link.

Deleting unnecessary files

The following are a list of files that are safe to delete:

After you have determined what is consuming disk space, delete the unnecessary files:

  1. Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and 5.0 (1017910).
  2. Use the rm command to permanently delete files. For example:

    rm /var/log/oldlogfile

    Caution: If you delete a file, there is no way to recover it. Therefore, use caution when deleting files. If you are unsure about deleting a specific file, contact VMware Support for assistance. If a system file is removed inadvertently, it may cause damage to your ESX or ESXi host that can require a re-installation of the software.

Zero out a log file

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.

Archiving old files

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 (1026359).

To compress historic log files:

  1. Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and 5.0 (1017910).
  2. Compress the old log files.

    In ESX, run these commands to compress the old 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.*

  3. In ESX and ESXi, run this command to compress the old /var/log/messages log files:

    tar czvf /tmp/messages-logs.tgz /var/log/messages.*

  4. Remove the source files using the command:

    rm /var/log/vmkwarning.* /var/log/vmkernel.* /var/log/messages.*

  5. Move the new archive files back to your /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/


Related Information

For more information on the recommended partition sizes, see the Datastore Partitioning section of the Installation and Upgrade Guide for your version of ESX/ESXi.

Additional find command:

find / -size +10240000c -exec vmkvsitools visorfsdu -h {} \; | less

Add comment


Articles by Date

TweetTweet Share on LinkedInShare on LinkedIn Share on Google+Google+ Submit to RedditReddit Publish on WordPress WordPress Send emailSend email