Using SHA1sum to verify the integrity of copied files
search cancel

Using SHA1sum to verify the integrity of copied files

book

Article ID: 313969

calendar_today

Updated On:

Products

VMware VMware Desktop Hypervisor VMware vCenter Server VMware Education

Issue/Introduction

This article provides information on using SHA1sum to verify the integrity of files that you have copied over a network or between local disks.

Resolution

To use SHA1sum to verify the integrity of copied files:
  1. On the server, from which you are copying files, you can create a SHA1 digest for each file to verify its integrity. You can create a SHA1 value for one file or many files at a time. To collect the digests for all files in a directory and put them into a text file, run this command from the ESX service console:

    # sha1sum * > files.sha1
     
  2. When you have copied the files to your destination server, copy the .sha1 file to the directory that contains the files for which you want to verify the integrity and run this command to check the files that are listed in the .sha1 file:

    # sha1sum -c files.sha1

    Note: This check fails if the file names have changed after collecting the digests.

    The SHA1 digest on the destination matches with the source, if the output is similar to:

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


    The SHA1 digest on the destination does not match with the source, if the output is as given here, indicating corruption of one or more files during the file transfer.

    server-flat.vmdk FAILED
    sha1sum: WARNING: 1 of 1 computed checksums did NOT match
Alternatively, you can compare the SHA1 digest by manually running these commands on both the source and destination:
  • To create a SHA1 value for one file, run this command:

    # sha1sum server.vmx
    d41d8cd98f00b204e9800998ecf8427e server.vmx
  • To create a SHA1 value for all files in the current directory, run this command:

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

 



Additional Information

For more information about SHA1, see: