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
3 Answers
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?
-
because he doesn't want boot information or partition data on his USB disk.– user1931Dec 21, 2009 at 7:05
-
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. Dec 21, 2009 at 9:17
-
@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.– akiraDec 21, 2009 at 9:25
-
@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 :)– akiraDec 21, 2009 at 9:28
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?
-
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. Dec 23, 2009 at 6:52
-
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...– NealDec 23, 2009 at 12:28
-
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) . Dec 24, 2009 at 11:05
-