LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-26-2013, 08:15 AM   #1
Anubis
Member
 
Registered: Mar 2002
Location: /dev/null
Distribution: Ubuntu - Fedora - or whatever works or gets handed to me.
Posts: 119

Rep: Reputation: 15
How to verify two drives have identical data?


This is the situation:
I am using two SD cards each with a single partition EXT2.
I would need to verify/compare that both have the exact same data.
The SD card is to be used in an embedded device as the boot media and storage running a tweaked Linux OS. I do not have access to the device where it is going to be used.

What would be the most successful way to compare both?
cmp ?
diff ?
Generating a md5sum of the partition?

Any pointers would be greatly apreciated.
Thank you however replies.
 
Old 04-26-2013, 08:42 AM   #2
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
If you cloned the partition as is, then you could use 'cmp'.

If you copied the files onto the partition, then you would have to md5sum all the files.
 
Old 04-26-2013, 11:33 AM   #3
Anubis
Member
 
Registered: Mar 2002
Location: /dev/null
Distribution: Ubuntu - Fedora - or whatever works or gets handed to me.
Posts: 119

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by H_TeXMeX_H View Post
If you cloned the partition as is, then you could use 'cmp'.

If you copied the files onto the partition, then you would have to md5sum all the files.
Hi and thanks for taking the time to reply H_TexMeX_H, What parameters would you use what what output do you believe I should get from the commands.

I have run the cmp command before but if you have real world experience using it I would like to know what I should expect and if there are any tips you could provide on the possible results. For example if I get a or b exits from the command that would mean issues could be due to x y or z.
 
Old 04-26-2013, 12:59 PM   #4
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
If the two images are identical, cmp will not produce any output to stdout and will return success.

If the two images differ, cmp will either say that the files differ at a byte offset, or it may say EOF on one of the images if it shorter than the other, and it will return an error code as well.

For the md5sums, I would generate a main sha1sum (or md5sum) at the top directory using a command like:
Code:
find /mnt/tmp -type f -print0 | xargs -0 sha1sum > /tmp/sha1sum.sha1
Do the same for the other partition (to a different output file), and use diff to see any differences.
 
Old 04-26-2013, 07:46 PM   #5
jefro
Guru
 
Registered: Mar 2008
Posts: 11,539

Rep: Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404
You should find it easy to get a usb to flash adapter to mount these on almost any computer to test these.

I stole these

rsync --delete -n -aPc /disk1/ /disk2/

cmp -l /path/to/first.img /path/to/second.img

http://serverfault.com/questions/242...es-be-compared


However in both you could get a problem where the files may not work as expected. I might be tempted to take a dd image of them both and see what the md5 is for each. If identical flash drives with no errors they should prove to be the same. Md5 should be a bit faster than cmp but I'd guess the file sizes are pretty small.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
autofs local map files identical but not identical to automount jwaldram Linux - Server 2 10-26-2012 10:35 AM
[SOLVED] Booting with identical drives Woodsman Linux - Hardware 4 09-04-2010 12:24 AM
Does scp verify data sent? glenn69 Linux - Newbie 3 04-28-2010 08:13 AM
udev rules fail on identical sata hard disk drives xushi Linux - Hardware 5 01-03-2008 01:49 AM
Is there any way to verify the freespace on the available physical drives during setu sairndain Mandriva 2 11-13-2005 02:35 PM


All times are GMT -5. The time now is 03:37 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration