How do skip MBR & partition table while doing dd of a partition

3

1

I need to copy a SATA partition to external usb partition , both partitions are same in size but total disk size are different , i want to copy only the data and not concerned about boot sector and so don't want copy the SATA partition info in to USB disk. So in dd command , is skipping 1 block ( skip=1) is enough?. Thanks

linuxnewbie

Posted 2009-12-21T06:40:56.307

Reputation: 81

Answers

3

the mbr is the first 512 bytes of the device. checking 'man dd' you will find, that you can use 'skip=BLOCKS' to skip some bytes at the beginning of the input:

% dd if=IN_DEVICE ibs=512 skip=1 of=OUT_DEVICE

but in general i dont think thats a good idea, if you 'just want the data' ... because you copy only part of the filesystem etc. why dont you copy the data from filesystem to filesystem?

akira

Posted 2009-12-21T06:40:56.307

Reputation: 52 754

because he doesn't want boot information or partition data on his USB disk. – John T – 2009-12-21T07:05:44.297

Thanks. Actually i am try to copy simultaneously to multiple drives, so i can't do copy such. This is for default 512 block size,Suppose if i mentioned the bs=8M , then it will skip first 8Mbits correct?.How do skip first 512 byte still keep copy block size 8M or some other value. – linuxnewbie – 2009-12-21T09:17:57.663

@john: copying from filesystem to filesystem does not transfer boot- or partion information. it's obvious why he does not want that. i just stated that i dont think its a good idea to do the whole copying via dd and transfer 'part' of a filesystem (the first x bytes of a ntfs/ext3/whatever partition) over to another place and then the end of the filesystem does not match the end of the partition. – akira – 2009-12-21T09:25:19.580

@linuxnewbie: well, you can tell dd to 'obs=8M' which specifies the 'output buffer size'. for skipping just the first 512bytes and then increase the 'ibs' again: i dont think thats possible with dd. but obviously you could write a nifty .c progra which does that :) – akira – 2009-12-21T09:28:23.083

1

I may be being an idiot here, but can't one just use dd on the partition rather than the disk, so use if=/dev/sda1 of=/dev/sdb1 rather than if=/dev/sda of=/dev/sdb skip a bit.

And is it necessary to use dd anyway; to copy only the data, why not use the copy command 'cp', rsync, a flie browser or any other way of copying data rather than the raw disk data?

Neal

Posted 2009-12-21T06:40:56.307

Reputation: 8 447

well, will try it out. Thanks. But can't use any other option , "cp, rsync, etc.." due to large size(~80GB) of files and want to copy multiple drives at a time. – linuxnewbie – 2009-12-23T06:52:04.633

But isn't dd going to take longer? It has to copy every byte from one partition to the next whereas other programs will just copy the data... – Neal – 2009-12-23T12:28:07.940

Let me know , is any program ( linux /win) can copy large data ( 60 - 80 GB) to multiple drives simultaneously ( parallel copy from one source to multiple destinations , of local disks not thru network - by multicast) . – linuxnewbie – 2009-12-24T11:05:33.747

Not that I know of, perhaps you should ask that as a new question. – Neal – 2009-12-24T14:29:07.533

0

Yes. If you haven't played around with it, the default is 1 block (512 bytes).

John T

Posted 2009-12-21T06:40:56.307

Reputation: 149 037