Uthman
Uthman

Reputation: 9807

Copying sectors?

Is there a script i can use to copy some particular sectors of my Harddisk?

I actually have two partitions say A and B, on my Harddisk. Both are of same sizes. What i want is to run a program which starts copying data from the starting sector of A to the starting sector of B until the end sector of A is copied to the end sector of B.

Looking for possible solutions...

Thanks a lot

Upvotes: 3

Views: 12234

Answers (3)

janneb
janneb

Reputation: 37208

If you want to access the hard drive directly, not via partitions, then, well, just do that. Something like

dd if=/dev/sda of=/dev/sda bs=512 count=1024 skip=XX seek=YY

should copy 1024 sectors starting at sector XX to sectors YY->YY+1024. Of course, if the sector ranges overlap, results are probably not going to be pretty.

(Personally, I wouldn't attempt this without first taking a backup of the disk, but YMMV)

Upvotes: 4

Hennie
Hennie

Reputation: 21

I am not sure if what you are looking for is a partion copier. If that is what you mean try clonezilla.
(it will show you what exact statement it uses so can be used to find out how to do that in a script afterwards)

Upvotes: 1

Daniel Bauke
Daniel Bauke

Reputation: 1218

How about using dd? Following copies 1024 blocks (of 512 bytes size, which is usually a sector size) with 4096 block offset from sda to sdb partition:

dd if=/dev/sda1 of=/dev/sdb1 bs=512 count=1024 skip=4096

PS. I also suppose it should be SuperUser or rather ServerFault question.

Upvotes: 11

Related Questions