Jump to content

Imaging one drive to another


Recommended Posts

I'm preparing to "clone" my xbox hdd to a hdd my friend intends to use in his xbox. There are several ways mentioned to do this, but when I saw a tutorial for doing it with Linux my choice was clear! :wink:

 

Anyway, both drives are 120GB, but likely slightly different block sizes overall I'm sure. I haven't seen his drive yet. Anyway, the tutorial creates 1GB image files with the intention of inspecting them, or transferring them elsewhere, but the author mentioned the idea that you should be able to do a clone with the following script..

Again, with file size limits, the blocks/sectors may need to be copied in chunks.



You could dd something like this:



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 count=n



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=n count=n



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=n*2 count=n



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=n*3 count=n



: :



: :



etc.



Replace n for the count and skip options with the correct block numbers similar to the image script.

What I am wondering here is if anybody sees any reason this would not work, and whether I could keep the "n" and define it's value prior to the sequence? Or, if not, can I do something like 1000516608*2 ..*3 ..*4, etc.

Typically as Aru knows I'd like a push in the right direction, but here I am hoping to just get exactly what changes I might need to make as I will likely be performing this operation under time constraints and have so many other projects I should be working on.. :oops:

 

...as always.. Any help is greatly appreciated! :mystismiles:

Link to comment
Share on other sites

What I am wondering here is if anybody sees any reason this would not work, and whether I could keep the "n" and define it's value prior to the sequence?  Or, if not, can I do something like 1000516608*2 ..*3 ..*4, etc.

I cannot help you in the first part of your question because I don't have expertise on it, so lets go to the last part:

 

Yes, you can define the value of n and run it as:

n=1000516608



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 count=$n



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=$n count=$n



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=$(echo "$n*2"| bc) count=$n



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=$(echo "$n*3"| bc) count=$n



: :



: :

 

Or, better, in case you know the iteration limit, you can do it as:

n=1000516608

limit=10 #or whatever



dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 count=$n

for (( i=1; i<=$limit; ++i )); do

    dd if=/dev/hd2 of=/dev/hd1 ibs=512 obs=512 skip=$(echo "$n*$i"| bc) count=$n

done

 

Note: the "bc" command is needed because the resulting number is too high to be handle directly by bash aritmetic expansion

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...