LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-01-2016, 07:55 AM   #1
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
MD5 of thumb drive is different than MD5 of image dd'ed onto it


I have tried both these commands. (The file is intended for this purpose.)
Code:
dd if=file.img of=/dev/sdb bs=1M
dd if=file.img of=/dev/sdb
Then I check the md5sum:
Code:
md5sum /dev/sdb
dd if=/dev/sdb bs=1M | md5sum
dd if=/dev/sdb | md5sum
In all cases the md5sum of the device is the same, but it's different from that of the file.

Shouldn't they match?
 
Old 06-01-2016, 08:25 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
No. For example if the size of the image file is smaller then the flash drive you would expect the sum to be different because the dd command will not overwrite the entire drive.

The typical use for md5sum is to verify the integrity of the downloaded file. If the calculated sum matches the posted value then the file has not been changed due to the transfer process.
 
Old 06-01-2016, 10:40 AM   #3
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Original Poster
Rep: Reputation: 145Reputation: 145
Ah! Good point.

This works. The count is the size of the file divided by 512. The result is the same as for the original file.
Code:
sudo dd if=/dev/sdb count=990915 | md5sum
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Image on thumb drive smturner1 Arch 3 09-26-2012 08:23 PM
md5 or dgst -md5 openssl bayanaa Linux - Newbie 1 05-26-2012 04:59 AM
need help unpacking hmac-md5 hash into md5 hash lynx5 Programming 3 02-02-2008 04:06 PM
difference between md5 shadow and md5 elsewhere? whysyn Linux - Security 5 12-11-2007 10:11 AM
using iso.md5 and iso.md5.asc Tyir Linux - Newbie 3 07-10-2004 11:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration