Using MD5sum to verify the integrity of copied files
search cancel

Using MD5sum to verify the integrity of copied files

book

Article ID: 344339

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

This article provides details about using MD5sum to verify the integrity of files that have been copied over a network, or between local disks.

 

Environment

ESX
vCenter

Resolution

To use MD5sum to verify the integrity of copied files:
  1. On the server that the files are being copied from, create an MD5 digest for each of the files that it is required to verify the integrity of. Create an MD5 value for just one file, or for many files at a time. To collect all the digests and put them into a text file, run the following command from the ESX service console:

    # md5sum * > files.md5
  2. Once the files have been copied over to the destination server, copy the .md5 file into the same directory that contains the files that it is required to verify the integrity of, and run the following command to check the files that are listed in the .md5 file:

    # md5sum -c files.md5

    If the output is similar to the following, then the MD5 digest on the destination matches that of the source:

    server-flat.vmdk OK
    server.vmdk OK
    server.vmx OK

    If the output is similar to the following, then the MD5 digest on the destination does not match that of the source, which indicate corruption during the file transfer:

    server-flat.vmdk FAILED
    md5sum: WARNING: 1 of 1 computed checksums did NOT match
Alternatively, the MD5 digest can be compared by manually running these commands on both the source and destination of the copy:
  • To create an MD5 value for one file, run the following command:

    # md5sum server.vmx
    d41d8cd98f00b204e9800998ecf8427e server.vmx
  • To create an MD5 value for all files in the current directory, run the following command:

    # md5sum *
    d41d8cd98f00b204e9800998ecf8427e server-flat.vmdk
    d41d8cd98f00b204e9800998ecf8427e server.vmdk
    d41d8cd98f00b204e9800998ecf8427e server.vmx

 

Additional Information

If sha256hash is required, please refer to KB: How to Get Hash of a File for SHA256 and/or MD5