dd command ...duplicated the extended partition but not subsequent partitions?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
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.
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.
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.
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!
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.