LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-28-2007, 12:16 PM   #1
lbrownne
LQ Newbie
 
Registered: May 2007
Distribution: RHEL 5
Posts: 6

Rep: Reputation: 0
dd command ...duplicated the extended partition but not subsequent partitions?


Problem with the "DD" command and extended partitions:



On a Dell Precision 690n workstation with RHEL 5 installed.
I am trying to "DD" the SAS drive /dev/sda to /dev/sdb. Both drives are of the same size.

When I dd the drives the first three primary partitions are "created" as well as an extended partition. However, the extended partition ie: /dev/sdb5 with the mount point of / is not duplicated "created" on the target drive.

ie:

Disk /dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 13515 108358425 83 Linux
/dev/sda3 13516 14025 4096575 82 Linux swap / Solaris
/dev/sda4 14026 17849 30716280 5 Extended
/dev/sda5 14026 17849 30716248+ 83 Linux

*Only /dev/sda1 through /dev/sda4 are copied to /dev/sdb...
/dev/sda5 isnt created when the "dd" command is issued?

Does anybody know about "DD" and issues with replicating the extended partitions on a drive?

Thanks for your assistance.
 
Old 12-28-2007, 12:37 PM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Show us the "fdisk -l" again but including the device sdb
 
Old 12-28-2007, 12:50 PM   #3
lbrownne
LQ Newbie
 
Registered: May 2007
Distribution: RHEL 5
Posts: 6

Original Poster
Rep: Reputation: 0
I tried to "dd" the /dev/sda5 to the /dev/sdb5 after the individual command...with problems.
however: the /dev/sdb partitions look like this after the initial
dd if=/dev/sda of=/dev/sdb command was run
also tried the above command with the conv=notrunc,noerror options.....same results.

Disk /dev/sdb: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 25 200781 83 Linux
/dev/sdb2 26 13515 108358425 83 Linux
/dev/sdb3 13516 14025 4096575 82 Linux swap / Solaris
/dev/sdb4 14026 17849 30716280 5 Extended

------------
left out is the /dev/sdb5 partition?
 
Old 12-28-2007, 03:41 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
My initial reaction would be how do you convince us that the cloning has been completed and reached the end of the disk?

dd should be run with
Code:
dd if=/dev/sda of=/dev/sdb bs=32256
This gives one full track in each transfer. Therefore the number of record in and out can be verified to 4551580.

I don't know which Linux you are using but the size of the transfer is given in modern Linux, i.e.146.8Gb. The number in the bs= parameter times the number of record in and out should equal exactly your hard disk size.

Using bs=32256 with both sda and sdb as internal disk the transfer speed should be 40Mb/s. Thus 150Gb should take about an hour. Since you have been using a block size only 1/63 (no bs= parameter makes dd to defaul to bs=512 bytes) and can take several hours.

My point is unless you let dd run its full course you and obtain the record in and out declared at the end you may not be cloning the full disk.
 
Old 12-31-2007, 11:51 AM   #5
lbrownne
LQ Newbie
 
Registered: May 2007
Distribution: RHEL 5
Posts: 6

Original Poster
Rep: Reputation: 0
I tried the dd command again using the:
bs=32256 as the block size option.

the results are this:
dd: reading 'dev/sda': input/output error
2870382 +1 records in
2870382 +1 records out
92587053056 bytes (93Bb) copied

I ran the command with the "time" command
and it took 3162.8 seconds to complete
29.3 MB/s

I did a e2fsck on all the ext3 partitions on the /dev/sda drive and
it came back clean. What could be causing the input/output errors?

-Thanks
 
Old 12-31-2007, 02:06 PM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
dd works at a hardware level and does not touch the filing system.

It was interrupted after 2870382 records each 32256 bytes have been cloned. Thus about 93Gb of data was transferred before the hard disk could no longer be read. This is a classic case of a hard ware failure, possibly by a corrupted area in the platter. Say if a dust particle is trapped at the read/write head and scratched the disk at a certain location. dd will make the controller to re-read it but the operation will be abandoned after repeated failures.

In such a case the lesser spinning of the hard disk the better. I think the next step is to try the ddrescue which will avoid bad sectors to recover the rest of the sectors. It will not work if the disk is in a bad shape. 

I think the fsck checks the integrity of the filing indexing system, kind of the content page, and does not know if some pages have been disfigured.

Last edited by saikee; 12-31-2007 at 02:08 PM.
 
Old 12-31-2007, 06:43 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,485

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
I've never seen the sense of using dd for cloning. And this is a classic reason why.
Set up the new disk, and copy the data over. I tend to use "cp -a ...", but there are plenty of options.
The important thing is that this is a filesystem function - read a file, copy it over there.
Keep doing it till done. You'll *know* when there's a problem (and which disk), and generally which file as well.
Also has the side benefit of having the option to change the target filesystem type if needed.

"dd" has it's uses (I use it a lot), but backup ain't one of them.

To the original question, only the 4 primary partitions (including the extended) are defined in the partition table. The logicals are a linked list within the extent defined by the extended. You never got that far.
 
Old 12-31-2007, 07:46 PM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
syg00,

With all due respect, when a disk cannot be read at a hardware level by dd it is also having difficulties of being read by any filing command of any operating system.

The filing command of cp, tar etc depends on the information pass on by the hard disk controller. At the moment the hard disk controller is having difficulty to read the "1" and "0" of the disk!

Last edited by saikee; 12-31-2007 at 07:47 PM.
 
Old 12-31-2007, 07:50 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,485

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
The fsck worked - the bad patch may not even be part of an allocated file.
It which case I don't care in the slightest.
 
Old 01-02-2008, 01:58 PM   #10
lbrownne
LQ Newbie
 
Registered: May 2007
Distribution: RHEL 5
Posts: 6

Original Poster
Rep: Reputation: 0
How was the bs= value calculated?
from the command:
dd if=/dev/sda of=/dev/sdb bs=32256

also:
I was unable to get much infomation regarding the dd_rescue command.
What is the command syntax I would use when issuing dd_rescue ?
 
Old 01-02-2008, 02:27 PM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
The 32256 = 512 bytes times 63 sectors. Thus it is one complete track. One can use the default value 512 bytes but it is a lot slower.

ddrescue differs from dd by not stopping when there is a corrupted sector and will attempt to try the next one instead. There are many sources of information on how to use it, as the normal dd command applies. Have a look at this one. I have not had a need to use it so far but have seen favourable reports of its use when all other methods fail.

In Linux one can also use hdparm command to slow down the DMA mode access speed to improve the reliability of the reading process.
 
Old 12-09-2009, 08:12 AM   #12
hamidreza2000us
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
if you want to extend a parition for virtual system image just try:
dd if=/dev/zero of=system.img bs=1M seek=$1 count=$2

in that system.img is your image file
$1 is size of current file system (can be obtained via du -hs *)
$2 is amount of hard drive that you want append
 
  


Reply

Tags
command, dd


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extended partitions? Location of partitions? General Linux - Hardware 13 05-03-2006 03:01 PM
extended partitions pixellany Linux - General 4 03-28-2006 03:05 PM
What is command to create logical drive in extended Partition ozy777ozy Fedora 1 09-08-2004 03:43 AM
What can extended partitions be used for? imemyself Linux - Hardware 4 02-29-2004 07:55 PM
setting up a linux partition and primary/extended partitions joemamma Linux - Newbie 6 02-23-2003 02:47 PM


All times are GMT -5. The time now is 09:42 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration