Jump to content

How to copy a disk using dd command?


  • Please log in to reply
4 replies to this topic

#1
Netaro

Netaro

    InsanelyMac Protégé

  • Members
  • Pip
  • 32 posts
Although i'm using mac os x, it's rather a Linux/BSD question, so it goes there... I think.

So, as I noticed, MacOS X's Disk Utlity doesn't allow to make a copy of the whole disk, only it's partitions (which sucks, as bootloader won't be copied then.). As both my laptop's hard disk and my spare external hard disk are both seagates 320gb (one is 7200rpm, second is 5400rpm), I've decided to make a copy of my disk onto my external, as it's doing nothing at the moment. So, I'm going to use dd command. However, I've had some... bad times with dd, so I'm little paranoiac now.

As now, I'll try to do this -
dd if=/dev/disk0 of=/dev/disk1
.
But then, I don't know whether it's correct. I don't know what's the difference between /dev/diskNumber and /dev/rdiskNumber, and google found me nothing. so which one should I use? Also, what should i set as block size? Leave it blank, or set bs=512? Calculate the count value or leave it blank?

#2
oldtopman

oldtopman

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 348 posts
  • Gender:Male
  • Location:A galaxy far far away...
To copy the MBR try these.
This backs up the MBR into a file called mbr.bin
dd if=/dev/<ata drive devicename> of=/mbr.bin bs=512 count=1
This restores it.
dd if=/root/mbr.bin of=/dev/<ata drive devicename>
Your "<ata device drivename>" is disk<number>. To determine your number, check in disk utility. Click info and look at disk identifier. There should be disc<number> (as outlined here).

#3
scousi

scousi

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 308 posts

To copy the MBR try these.
This backs up the MBR into a file called mbr.bin

dd if=/dev/<ata drive devicename> of=/mbr.bin bs=512 count=1
This restores it.
dd if=/root/mbr.bin of=/dev/<ata drive devicename>
Your "<ata device drivename>" is disk<number>. To determine your number, check in disk utility. Click info and look at disk identifier. There should be disc<number> (as outlined here).


What about if it's GUID?

#4
Netaro

Netaro

    InsanelyMac Protégé

  • Members
  • Pip
  • 32 posts

<br />To copy the MBR try these.<br />This backs up the MBR into a file called mbr.bin<br />

dd if=/dev/&lt;ata drive devicename&gt; of=/mbr.bin bs=512 count=1
<br />This restores it.<br />
dd if=/root/mbr.bin of=/dev/&lt;ata drive devicename&gt;
<br />Your &quot;&lt;ata device drivename&gt;&quot; is disk&lt;number&gt;. To determine your number, check in disk utility. Click info and look at disk identifier. There should be disc&lt;number&gt; (as outlined <a href="http://www.insanelym...owtopic=220112" target="_blank">here</a>).<br />

<br /><br /><br />
Thanks guys, however, I want to make an exact copy of my disk, so that i i were to swap my external and my internal I'd see absolutely no difference.

#5
oldtopman

oldtopman

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 348 posts
  • Gender:Male
  • Location:A galaxy far far away...
Copy the partitions, you said you could do that. Make a backup of the MBR with the steps outlined. Restore it with the steps outlined.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy