| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View
 

How to use md5sum recursively over an complete file system

Page history last edited by Paul G. Taylor 11 years, 10 months ago

How to use md5sum recursively over an complete file system.

 

Note: This can be very useful for checking a backed up file system, checking a mounted ISO file, checking a CD or DVD after it has been burned, etc.

 

This procedure uses the 'find' function, then pipes the name and path of files found to the md5sum function to produce a text file with all the files listed by name along with their checksums. This file can then be used to check the copied files using the command 'md5sum -c md5sum.txt' from the root folder of the file system being checked. [Note, the file need not end with .txt as Linux will recognise it as a text file any way. I pefer using a suffix for my own benefit.]

 


 

Checking the md5sums of a mounted ISO image.

 

Mount the ISO file as a loop-back image.

 

PAULS:/mnt# mount -o loop /mnt/hdb6/Klikit_Linux/ISO_File/klikit-ff-0.1-5b.iso /mnt/isoimage

 

CD to the top directory where you wish to check the md5sums.

 

paul@PAULS:~$ cd /mnt/isoimage

 

Check the md5sum from the md5sum.txt file.

 

paul@PAULS:/mnt/isoimage$ md5sum -c /mnt/isoimage/md5sum.txt

 

 

Creating your own md5sum.txt file.

If you are doing a copy of your file system, and wish to verify it afterwards using the md5sums for each file, you will need to produce your own 'md5sum.txt' file. This is how.

 

First move to the root folder of the file system being copied and checked.

cd path-to-folder

 

Now invoke the find function, recursively and pipe the output to the md5sum function, collecting the output of that in the md5sum.txt file.

 

find  .  -type f   2>/dev/null  -exec md5sum {} \; >md5sum.txt

 

              [Note : I did this with another form using the 'nul' character in place of blank spaces in names, but I cannot find this at the moment.]

              [         : the '.' which means 'starting from the current directory, and all included directories.

              [         : -type f means 'all files'

              [         : 2>/dev/null keeps all error messages off the screen.

              [         : -exec md5sum {} \; calculates the md5sum for each file found, then ends.

              [         :  >md5sum.txt pipes all output to a text file called 'md5sum.txt'. You can call this file what you like.

 

 To view the output md5sum file.

 

 To view the output file in the same Konsole window, just type 'cat md5sum.txt' and hit the 'enter' key. The file will be displayed on-screen.

 

 

Verifying that files have not changed.

 

To verify that the files have not been changed, or have been copied correctly, re-run md5sum over the files with the -c switch.

 

In a Konsole window, in the root directory of the file system, first copy the md5sum.txt file to the new top folder , then type

 

md5sum -c md5sum.txt

 

This will take some time, but if you need verification it is worth the wait.

 

 

 

Checking the md5sums of a burned CD or DVD.

 

Insert the disk into the optical drive. Normally this will open a dialogue box where you can open the disk in a new window. This will mount the disk.

 

Now follow the procedure for a mounted ISO file from the second step.

 

If you have first produced the md5sum.txt file from the mounted ISO, then you can use this to check the burned disk, using the -c switch and pointing to this file, with the Konsole in the top directory of the mounted disk.

 

md5sum -c /path-to-/md5sum.txt

Comments (0)

You don't have permission to comment on this page.