LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-06-2013, 12:38 AM   #1
shadowbox12
Member
 
Registered: Mar 2010
Posts: 52

Rep: Reputation: 3
dd and Advanced Format drives


While troubleshooting some script problems, I noticed dd was giving very different results on an Advanced Format drive vs my old drive. Both drives should be identical, bootable copies with the only difference the sector size.

dd if=/dev/sda of=/test.dd bs=512 count=63
hexdump test.dd | nl
Replace drive, reboot, repeat.

On both drives the file test.dd reads as 32k, however a hexdump shows vastly different results. On the old drive 35 lines of hex are shown, but on the new drive 860+ lines of hex are shown. How can both files be the same size?

It worries me because I use dd a lot and want to know it is reading/writing the correct blocks and offsets. Even if I assume there should be 4x as much data on the Advanced Format drive due to a sector sie of 4096 vs 512 860 is more than 4x the size of 35. It just doesn't make sense.

Last edited by shadowbox12; 08-06-2013 at 12:39 AM.
 
Old 08-06-2013, 01:01 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
So the two files (test.dd) had the same size. That is ok.
35 lines of hex data are definitely less than 32k, you should check it
 
Old 08-06-2013, 10:47 AM   #3
shadowbox12
Member
 
Registered: Mar 2010
Posts: 52

Original Poster
Rep: Reputation: 3
That's true that 35 lines is less than 32k, but I'm not sure how hexdump deals with null characters. I think it simply omits them, so there is probably 31k of 0x00. The question is why is it different on the other drive?
 
Old 08-07-2013, 01:38 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
yes, you can use hexdump -v to avoid omitting lines (see man page, it will skip printing identical lines)
So about your first question: dd works as it was expected, dumped 32k. The next question: why are they different. But why should (the content of the beginning of a disk) be identical at all?
Probably one of them contains a boot loader and the other one not.
 
Old 08-07-2013, 04:36 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Look at the drive with a hex viewer maybe to see what data is where and why.
 
  


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
Create a RAID 5 array with advanced format drives marcelvl Linux - Newbie 2 06-23-2013 11:45 AM
Partition table on Advanced Format drives amroth Linux - Hardware 4 01-02-2012 01:36 PM
Advice on Western Digital 'Advanced Format' hard drives telemeister Slackware 24 09-04-2010 11:21 PM
Advice on Western Digital "Advanced Format" hard drives under linux telemeister Linux - Hardware 5 03-02-2010 12:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:10 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