At the time of writing this post I must say that I feel like a hero! That feeling is wonderful you know, when someone has a problem with their computer and not a simple but a HUGE one and you are able to repair em you turn to be that people hero.
Today my friend Avaco12 made a little mistake while installing bootcamp on her iMac, she left her external (200GB) disk connected, and when Windows asked her where to put the new Partition she accidentally selected her preciousus external drive, when she realized it was already too late, windows had already destroyed the partition table on her disk. She had 1 HFS parition and 1 FAT. She was crying because she said she had her entire life on that disk, so she asked me for help and I started researching what could I possibly do to repair the disk or at least retrieve her data.
There are plenty of solutions out there, some of them are really expensive, and people on the forums are not very happy with them so I wanted to look at little more into the issue and I came across this solution called TestDisk which is an Open-Source Multi-platform solution for repairing disk partitions. I gave it a try and awesomely I managed to fix the disk using TestDisk and the pdisk utility.
When I called Avaco12 to tell her that I fixed her data she was so happy she couldn’t stop smiling she told me I was her Hero and so that’s how I felt, the process wasn’t easy specially because noone talks about how pdisk works on Mac OS X.
Here’s how I did it , hope it works for you.
1.- I downloaded TestDisk from their official site :http://www.cgsecurity.org/wiki/TestDisk
2.- I opened the terminal and surfed to where I downloaded and unziped TestDisk
3.- I issued the command ‘sudo ./testdisk’ it indetially promped me to make my terminal bigger =P, after doing so It displayed me a simple disclaimer and then a notice telling me that TestDisk could Log all the activity if I wanted to. I selected Yes and continued.
4.- On the screen it will display you all the Disk it detects connected to your Mac select the one that got damaged partition tables and press Enter. Take note of which drive you selected, in my case I chosed /dev/rdisk1 (rather than /dev/disk1)
5.- Next screen select the menu Analize, it will probbly display you and error telling you the block 0 couldn’t be read, just hit enter on the ‘Quick Analize’ option
6.- ATTENTION: TestDisk will quickly search for partitions on the disk and display you information about it on your disk. Take note of the information it will display you, since you’ll need it to repair the disk later on with pdisk.
Here’s a screenshot of what I got:

Note: if you try to repair your partition table with TestDisk it will fail since that function is not yet implemented.
7.- you can now exit TestDisk. The next steps are what distinguish a child from a Men
8.- Issue the command ‘sudo pdisk /dev/rdisk1′ (where /dev/rdisk1 should be the same name you chosed on step 4). If you type the command ‘c’ and hit enter it will tell you the following:

9.- That’s completely normal. Now type ‘i’ and it will display you some affirmations about block sizes and such, just hit enter:

10.- Now we are going to need the info from Step 6. type the command ‘c’ and press enter, it will ask you to type down where your first partition starts, how long it is and how you want to name it. repeat this step for every partition you have.

11. Now if you are completely sure you wrote down everything correctly (like I did) just type down ‘w’ and hit Enter, It will prompt you to confirm just say yes (y)
12. type ‘q’ to quit the application and go see for yourself if your disk appears now in Finder. If it does, go to Step 13. else try disconnecting your external hard disk and reconnecting it. After Mac OS X 10.6.7 it is suggested that you restart your machine and reconnect the disk. If this fails try again from step one. Don’t worry about rewriting the partition table it doesn’t harm your data.
13. You are a hero, no matter if it’s your own disk, you just saved your data!
Congratulations, and I hope this information is usefull to you !
You can buy me a drink if you’d like to share your joy
Feel free to contact me with any problems you get at : perro.hunter@gmail.com
cheers !

Random comment
Worked like a charm thanks man !
This is the sort of advice that should be on late night television- but wait there is MORE! Retrieve ALL of your data NOW- no File Carving- no rebuilding Indexes, no FSCK, simply put- its PDISK and its on a mac near you!
(Sorry- complete and absolute file recovery can cause extreme excitement and euphoria)
Hi dog hunter!
I would kiss you if I can! I’ve just recovered a partition that Partition Magic (from a boot cd) dreaded up! It “fixed” an error, and the driver never worked again. I found that the problem was a wrong Partition Table, and your explanation was quite helpfull. Althouth, I was able to do everything from TestDisk! Yeah, its true. After a QuickSearch, I have set the right Partition Types (which the program have correctly detected) and selected the program to write the partition table. The program told me to reboot, and voila! (using a disk formated as GUID with a unique partition as HFS+)
Long live the hunt!
Holy god, you are my hero right now! Bootcamp snuffed my partition table, but the world has been made right again!!! THANK YOU!!!!!!
I manually fucked up my 500gb backup drive when attempting to make Windows 7 read NFS+ drives, and I thought I had lost it all when OS X didn’t seem to read it.
Thanks to you, and TestDisk, I got my data back! I have never been this happy in a long time!
Thank you!
thanks, this worked great. Windows 7 hosed my HSF partition cause it initiated the disk. I tried various tools nothing worked. Followed your step and everything worked, the only thing that i needed to do was scan for my partition a bit it didnt show up in the first quick scan
You are da man! My 1T external became unreadable and unrepairable after an app crashed while copying files. Your procedure worked like a charm.
Thanks for your help. That was excellent. I accidently overwrote my partition table when I connected my osx exernal drive to a XP system and lost all my data. Now it is back …. thanks goodness. Cheers
Does anyone know how do fix the Mac partition from the Windows partition? I already have the log from TestDisk.
Hey Randy ! you could try to use your OS X Installation disc, just insert it, when you get the the main menu, on the apple menu go to Utilities> terminal, and from there use pdisk
! plz tell me if this worked
cheers
testing comments agian
Great info, thanks. I was wondering if it could be done for HFS+.
One thing though, your first screen shot, 36.png, just takes me to the main blog page when I click on it or try to open it in a new tab.
Thanks again for the great tutorial though.
@jim: hey Jim, I’ve fixed that broken link
sorry I’m transitioning the blog to a new platform.
Cheers
Hi!
Thanks for the tutorial, it really helped me… but unfortunately, I couldn’t retrieve my partition
All the steps until pdisk worked like a charm. But pdisk, after hitting command “i” tells me the disk is busy and cannot access it. Any ideas how solve this ??
Config: Mac intel dual core (2007) / external HFS+ HD (WD)
Thanks for you help!
Alex
So happy to find this post- gives me hope that I may recover from my hasty mistake (plugging Mac/HFS drive into Windows 7)…
I got Testdisk working, and I was able to “Analyse” my rdisk1. Then when my options are “Quick Search” or “Backup”, either option causes the program to freeze. The log file shows “read err: Resource busy” (preceded by buffer addresses) a ton of times until I quit Testdisk. (I let it run for a few hours last night; no difference)
I was able, however, to view the partition map scheme from Testdisk, so I tried your method in Pdisk.
upon starting pdisk, I get:
“pdisk: Can’t read block 2 from partition 3
pdisk: Can’t read block 2 from partition 5
Edit /dev/rdisk1-”
… and then I can go through the commands. But my results diverge from above:
command ‘i’ –> “map already exists. do you want to reinit?”
command ‘c’ –> when I do the big partitions, I get the “Can’t read block x…” errors again.
Any wisdom?
THANKS. happy 4th.
I’ve had to have TestDisk run a deep search and now I have way too many choices for deleted partitions. Great. We’ll see how this turns out. Good to hear that people out there are getting their data back.
@Mrsupersirk
The issue you are facing is most likely the need to unmount the drive in question before you can perform low-level operations on it. You can open up DiskUtility and click on the drive you are working with and then click the ‘unmount’ button on the tool bar. You could also run the command ‘diskutil diskX unmount’ if you are already in the terminal.
Hi, thanks for the advice. Disk utility took it upon itself to destroy the partition map for my external Hd, I’m currently trying this method as nothing else I was able to find seems to have any suggestions for the issue – hopefully this will work. I was just wondering how long it ought to take pdisk to perform the remapping? (I have a 2TB drive – process is still working and I’ll leave well enough alone for awhile). I’m just looking for a ballpark figure so that I may know whether to assume that it has failed or not.
AMAZING!!!! IT WORKED!!! THANKS FOR THIS, YOURE AWESOME
hi, i did it but now the disk is not readable by my mac!
help!!!!!!!!!!!
THANK YOU VERY MUCH!!! I could fix my partition table. It was damaged because I used windows to create a new volume. Will never do it again.
Thank you! without your helpful instruction I would not have been able to fix it and rescue my movies and games.
Perro,
I tried to access pdisk from the terminal under the Snow Leopard disc and it said it was an unknown command.
Any thoughts?
Thanks
Mosi
Most of the replies I send are through email
please leave your real email address
Hello Perro, i send an email with screenshots to your gmail. can you let me know whether you received my email?
kind regards,
Arjan
Thank you for sharing with us your knowledge. you are the best
thank you very much! It perfectly worked… I recovered a partition with 250 GB of data which disappeared due to a corrupted partition table!
I had upgraded my macbook with a bigger harddisk, with a little help from clonezilla. Bit when I tried to resize the partition with Disk Utility I got an error: “mediakit reports partition (map) too small”
I tried to follow this:
http://info.michael-simons.eu/2010/11/19/migrate-os-x-to-a-bigger-hard-disk/
but I wrote something wrong, and puff! Gone partiotion table ! Hello completely wrong partition table !
Then I downloaded the latest version of testdisk to a usb drive, restarted my macbook with an ubuntu live disk and ran the testdisk in a terminal.
I mounted the usb (mount /dev/sdb1 /media/usb), ran the testdisk utility from the usb stick (in my case testdisk_static), followed your instructions untill step 6.
Then for some awesomeness ! The latest version of testdisk now supports the option to write the partition table for you, based on what it finds analysing the drive ! So I simply choose the “write” option, rebooted and everything worked again !
Thank you so much
Hi Perro,
I have same problem as your friend facing, after follow your instruction i have facing some problem on the Pdisk command after i run the testDisk, I am using Mac OS X Lion. Is it anyway to retreive back my files in my external hardisk? Thanks.
it’s worked for me !!! Thank you very very much!!!!!!!
@差点要哭出来了… 不小心删除一个mac分区… 找了几个mac数据恢复软件.. 都木有成功恢复, 有的恢复了文件但不能打开…折腾2天了….
今无意中搜索到这篇文章…. 然后又根据这篇文章提供的信息找到英文原版(有图片).
然后… 冒着生命危险参考着原版完成了生平第一次分区表恢复… 更重要的是.. 好几十G的数据终于又失而复得… 真的太感动鸟~ 特意登录来拜谢~
Thanks so much for your tutorial, you are very kind and a gentleman through and through
Restored my sisters macbook external drive.
Thanks to the author of this guide, he just saved my 2TB external drive, of which yesterday I wipe out its partition map.
I wanted to erase a USB key with Disk Utility, but I was so stupid to select the wrong drive… a couple of second after I realized the error and detached the cable, but the partition map was gone…
Interestlyng, I had to follow a slightly different procedure, because my external drive is formatted with an EFI-GPT map, and not APM.
I followed this guide, but when I tried to create an Apple Partition Map with pdisk it always failed with the error “the map is not bight enough”.
Since APM max size is 2TB, it looks like that my drive is slightly bigger, at least to make pdisk and APM fail.
If someone is interested in make some calculation, this was the output of testdisk:
Disk /dev/rdisk1 – 1999 GB / 1862 GiB – CHS 3905656832 1 1
Partition Start End Size in sectors
P Mac HFS 409640 3905394647 3904985008
Because of this, I had to use the ‘gpt’ command to create a new GTP partition map:
sudo gpt create /dev/rdisk1
sudo gpt add -b 409640 -s 3904985008 -t hfs /dev/rdisk1
As you can see it’s very similar to pdisk, and you need the same information: first block and length in blocks.
After this, I have reconnected the drive to my mac and it worked again. Thanks again to the author, I wouldn’t have find this solution without this guide!
One final notice, now even if the Finder and Disk Utility both can see the 2TB HFS partition, Disk Utility is unable to repair the GPT map because it can’t find any partition.
It looks like that I haven’t perfectly recreated the GPT, but it’s good enough to copy all the files on another drive.
BIG THANKS !!!!! it worked perfectly for me too
Mmh, para algo asi, no es mas sencillo usar explode()?
VirtualBox destroyed my 2TB external HD along with my 18,000+ family photos… My wife and I were devastated. The HD would come back with an error “Unable to read/ Unknown partition” and “initialize/reformat/ignore messages. Data recovery service quoted me $3000.00 to retrieve my data. After hours trying to use TestDisk I came across your article. With pdisk, I was getting an error about map size… I ran TestDisk again, this time choosing “WINDOWS/VISTA option”… TestDisk told me I needed to set my headers to 32… which I did.. I then was able to “Write” the new partition using “WINDOWS/VISTA” format even though my HD was formatted for mac. A reboot was required but… YEEEEEHAAA my HD is BACK FROM THE DEAD!!! Thank you so much for your article. Without it, I wouldn’t have found out the issues… Thanks from a very relieved novice mac user… using terminal for the first time… and pdisk…
Ahhh! Thank you! ¡Muchas gracias! ¡Eres asombroso!
hey man, got in to trouble!
i have a 500 gb HDD from a lacie EDmini HFS partition on which i fried the usb so i had to access the data your way.
I plugged the HDD in a G4 mac and use the terminal.
everything completed like a charm but the disk did not initialize after restart
i had 5 partitions but none could be accessed.
help…
Hi!
i’ve been trying to use your method but it doesn’t do any good for me. here’s what i did to screw my life up: completely in a hurry and without any kind of attention i used an “erase” command on disk utility that apparently did not erase the partition, only ALL of the data in it. when i try to recover the partition using your method it only shows me an empty partition…
what am i doing wrong?
thanks a lot man.
running lion.
best!
@Andre, you erased the disk my friend. That is not a partition problem, you just wiped it.
Try data recovery progs, but really, it’s gone.
Hi there,
i tried to re-partition one of existing partition on external hard drive through Disk Utility
after that, some error message appeared and then i restart the mac, and found that my partitions all gone
now i’m trying to use TestDisk, but after i select my error hard drive, the TestDisk just froze and do nothing. i tried to wait, but nothing seems to be happening.
can you help, please ?
my entire data is on that hard drive
Thanks a Lot..
Aldy
THANKS A MILLION !
worked like a charm!
I am a hero!
And so are you. Un millón de gracias!
Btw: I love you transparent terminal windows that allow us to see through
YOU SAVED MY LIFE! THANK YOU THANK YOU and THANK YOU!!
I bought you a beer
Hey i try this but i have partition which is HFS n NTFS on my 1TB external HD. but its only choose HFS in the first choice. How i can use it for my HFS n NTFS in the same time when quick analyze…or i must do this twice…..1st HFS n after i repeat again for NTFS???
Hi,
I am a hero as well, looks like the dragon I fight is too tough for me though
At step 10. when I write the numbers on every of 4 partitions, it says “the map is not big enough” each time.
And when I try to write it down (with ‘w’) it says: “The map has not been changed.”
Any clues on that one guys?
I have a 500 GB disk that only had one partition on it, the “Macintosh HD”. It’s a clean install of Mac OSX Snow Leopard, so I don’t know whether the EFI stuff is on an extra partition. Anyway, when I analyze it with testdisc (version 6.13), it can’t find any partition to repair (is it correct to select “Mac”?
It says:
Bad MAC partition, invalid block0 signature
read_part_mac: bad DPME signature
When I select Analyze, it slowly counts up the cylinders and after half an hour, I’m still stuck at 00%, but it can find some stuff:
Disk /dev/rdisk1 – 500 GB / 465 GiB – CHS 976773168 1 1
Analyse cylinder 7208960/976773167: 00%
HFS 4121592 980222935 976101344
HFS 4122752 980224095 976101344
HFS 4123776 980225119 976101344
HFS 4126584 980227927 976101344
HFS 4128264 980229607 976101344
HFS 4130200 980231543 976101344
HFS 4132592 980233935 976101344
HFS 4137616 980238959 976101344
HFS 4142720 980244063 976101344
HFS 4146816 980248159 976101344
HFS 4151464 980252807 976101344
HFS 4158352 980259695 976101344
HFS 4164920 980266263 976101344
HFS 4172128 980273471 976101344
All I need is the info from Step 6 so I can enter it into pdisk. Is there any way to get it without scanning the hard drive for weeks?
@FAM, I found the solution to your problem. I too was experiencing the error, “the map is not big enough” and couldn’t rebuild my partition map.
I found this site: http://forums.macrumors.com/archive/index.php/index…/t-1140673.html and followed his instructions to a T. (the critical instructions are in the next 2 paragraphs)
“First, you’ll need to figure out the disk number of the hard drive. If you’re booted from the machine (rather than a different machine, using the drive as an external), it’s going to be /dev/disk0. The following will rewrite the partition table to near-default (possibly a little bigger primary volume):
sudo dd if=/dev/zero of=/dev/disk0 bs=512 count=10 conv=sync,noerror
sudo gpt destroy /dev/disk0
sudo gpt create /dev/disk0
sudo gpt add -i1 -b40 -s409600 -tC12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
sudo gpt add -i2 -b409640 -t48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
(I typed in the commands EXACTLY as he specifies – just be sure you know the correct name of your disk. Mine was just like he shows /dev/disk0 My disk was connected externally to my working MBP)
Once I finished entering the last command in Terminal, the disk immediately mounted on my desktop.
Next, I tried to use Disk Utility to repair it like he mentions, but it failed. I then used DiskWarrior and THAT finished up the repair just as he said.
My disk works fine!! It mounts no problem. No data lost.
Amazing!!! Thanks for such great advice. A true Hero
Hi,
I have some trouble with my Macintosh HD… can’t boot any more
I used test disk as discribed bellow… but wenn I run
pdisk /dev/disk0 (or /dev/rdisk0) I get the following message:
pdisk: can’t open file ‘/dev/disk0′ for writing (Resource busy)
I started my Macbook Air (first gen) from USB-Stick with Snow Leopoard on it and run test disk via terminal an disk as well
I need a help. I’m trying to expand my boot camp windows partition, but I converted my disk to a dynamic disk accidentally. Now my entire disk in my iMac is a dynamic disk, and I’m not able to boot to OS X. How can I revert the process without the loss of data? I’m able to boot Windows 7 but I don’t know how to resolve this problem without losing all my data in mac partition. I tried use TestDisk but I don’t understand how to use it especially when choosing which drive/partition and partition type. I’m not sure of it.
Thanks for your help
Clear, simple instructions let me recover after disk utility on PPC wiped the partition map when I tried to manipulate a drive with multiple partitions with different filesystems on them.
Thanks for posting this. Saved me 630Gb of data.
Hi, Please help me, my 1TB drive can not read, I have on it from Time Machine backups,
I used a test drive and wrote me this: Bad MAC partition, invalid signature block0
read_part_mac: bad signature DPME
thanks for any help
Just a remdinder I answer most of the comments via email
so you should use your real email on the comments hehe
cheers
After step 9. there is “can’t open file ‘/dev/rdisk0′ for writing (Resource busy) similar to @Mrsupersirk. I’ve tried also ‘gpt’. Nothing. Please help……
Im having the same problem as Jakob at the part where it scans the drive but shows 16% after nearly a day. Is there any hope left or could i just map the whole drive as one partition? It only had one when the data was lost.
this is great! but i have a problem. i am trying to repair a g-tech g-speed q and it is setup as a RAID array. it has four drives and they all show up when i analyze. i did just pick one of them and tried to follow the instructions to completion but then i run into the “the map is not big enough” error.
so, does it matter what drive i pick of the four? i saw the instructions from @drew )http://forums.macrumors.com/archive/index.php/index…/t-1140673.html) but before i do that i want to be sure i know which disk to select of the four that are showing up.
thanks!!
Hello and thank you so much for your help!
I have an issue though – when I get to step 9, my command terminal says: “can’t open file … for writing (permission denied)
It seams even using the sudo command that I can’t write restored partition to the drive? I have been searching for over a day now trying to recover this drive and I don’t know what to do… if you have any insights that could help I would appreciate it insanely… thank you again!
I’m having the same problem as some, where it’s taking a ridiculous amount of time to scan the disk. I opened the Console and it shows hundreds of read errors per second. I just left testdisk running overnight and it was still at 00%
If my partition used to be GUID, it’s considered Intel, correct?
I have this problem, but there’s not a response in any comments:
pdisk: can’t open file ‘/dev/disk0′ for writing (Resource busy)
please help!
I respond most of the comments via email
HOLY MOTHER OF GOD THIS WORKED!!!!! I cannot believe it! I had tried different softwares at $100 each all claiming to be able to restore lost partitions (and sure they would DETECT the lost partitions but there was no hope of actually been able to RESTORE them!) but none of them did anything like this! Literally when I finished all the above steps my entire hard drive (1 Tb Lacie) was restored with everything EXACTLY the way it was before the hard drive crashed!
I cannot thank you enough – seriously you are a life saver and just made my week!
Keep up the good work!
Cheers
!
!
Hi,
i think bootcamp windoz has blew up my partition scheme, so i tried your steps, but now i’m getting the same error as some people described. The “pdisk: can’t open file ‘/dev/disk0′ for writing (Resource busy)”
plz, help…
You guys shouldn’t be using /dev/disk0 as that’s probably the main disk in which your OS X is running, you should be using something different such as disk1, disk2 and so on…
cheers
testing
Man, you are my hero!!! I tried every kind of recovery software, i’ve also bought DataRescue3 for Mac, didn’t work, but now i have 70% of my partitions restored, i don’t know what happened with the other 30%, but it’s already perfect. Thank you so much, brazilian regards, Rodrigo Maia.
Tnx to the author and tnx to Fam: on my 2TB hard disk i have repait partition table with gpt command
Thanks MAN! It worked on my HFS partition!
For a strange reason disk utility saw it as unallocated space….
Just one problem…
I had two NTFS partitions together with HFS with windows and after following your guide those partitions are unavailable…
and disk utility seems to see them as HFS partitions….
any suggestions?
Once again THANK YOU!!
Friends, please help.
I do not know how to solve this problem. I drive RAID0 array, 8TB. TestDisk gives the following parameters:
/dev/rdisk3 – 8001GB/7452 GiB CHS 2743214502 1 1
START END Size
P EFI System 40 409639 409600
P Mac HFS 648264 15628092823 15627444560
By doing everything as the instructions on the page, an error pops up:
“The map is not big enough”.
How to perform the entire process, step by step.
Stress eats me because I have important files.
Please help.
Chris
You are AWESOME! Certainly my HERO!
Your tutorial did the trick mate! Thank you so SO much!!
It worked a treat!!!
PS.
Just a word of warning for others in case they are thinking of using other recovery software. I bought Disk Drill in a panic buy yesterday. It recovered the files, took 17 hours and they did not have ANY filenames and NO folder structure! What a useless piece of software! I had 300,000 files with no names!!! Utter rubbish!
Hi, I have the same RESOURCE BUSY problem, can you help me please?
Help please.
I am in a similar position I started formatting my back up drive by accident, here is what I started with:
2TB WD external
- 500GB (A) up front partitioned in ExFAT
- 1.5TB (B) partitioned in Mac OS Extended (Journaled)
I accidentally starting erasing the 1.5TB using MS-DOS (FAT) and pulled the plug seconds after initiating the process. So far I have been able to verify that most of the data is still there from what I could tell utilizing (EaseUS Mac Data Recovery Wizard) I am now utilizing the TestDisc to try and repair the partition. Any help with this issue would be greatly appreciated
Thanks in advance
you are an uber hero. One you were a hero to your friend, then two you were a hero to people you don’t know. Then three: you gave us the power to be heros too.
Good work!
Hi.
I did exactly what @Barry (2012-03-13) did.
and I have done the testDisk scan AND deep scan, and now I have a lot of options as per @ (Noahness 2011-07-07.)
I am just wondering if I should copy and enter ALL these info, or if I should enter every-other one, since there are some duplicates on these results.
I have copied and pasted the screen results below, I’d really appreciate your guidance!
Disk /dev/disk1 – 2000 GB / 1863 GiB – CHS 390702916811 Partition Start End Size in sectors >D EFI System 40 409639 409600 [EFI] P EFI System 46 409645 409600 [EFI] P Mac HFS 445649963 819998940 374348978 [7] D Mac HFS 819998937 1194347914 374348978 [7] D Mac HFS 828521845 1912924457 1084402613 [] P Mac HFS 841226752 2795728924 1954502173 [F]
Structure: Ok. Use Up/Down Arrow keys to selectpartition. Use Left/Right Arrow keys to CHANGE partition characteristics: P=Primary D=Deleted Keys A: add partition, L: load backup, T: change type, P: list files Enter: to continue
O gerenciador de discos do windows 7 (via bootcamp) alterou o tipo das partições do meu mac, onde todas ficaram inutilizadas. Tentei diversas ferramentas, inclusive o proprio TestDisk, mas as dicas complementares deste blog salvou meus dados. Valeu demais!
I’m having the same problem with resource busy. I’m booted from the Snow leopard install disc. HFS+ partition table won’t boot after re-imaging with clonezilla. Any ideas?
Thanks.
hi…i’ve got a little problem with my WD 2TB hard disk…it’s full of my data, photo and video but when i try to copy come files, an error -36 appers from the finder…this happend only with some files, not all…i’ve tried to repair with disk util,but nothing works, the error -36 still apper…tried to fix with partedmagic, but nothing went well…so i want to try to fix the partiton that maybe solve the error -36 from the finder and i read this article..
So, I only want to know one thing: the pdisk command will delete all my data(documents,photo,video) or it will preserve them and fix the partition!?
thanks for the reply…please help me folks!
Hi,
As I can’t boot OS X and I don’t have a recovery disk right now, can you tell me what is the linux equivalent of pdisk? Also, will it work on an MBR formatted disk?
Thanks.
Hi,
As I can’t boot OS X and I don’t have a recovery disk right now, can you tell me what is the linux equivalent of pdisk? Also, will it work on an MBR formatted disk?
Thanks.
Need a little help here, Im stuck right after Step 7, apparently I am not a “man” haha. When I close Testdisk and enter “sudo pdisk /dev/rdisk1″ into Terminal, and I get “Floating point exception”. Any help would be appreciated, I have over 500gigs that I need to recover, and it took me 5 days to run Testdisk!
This is definitely the most helpful site I have seen about using TestDisk and pdisk, and is really helping me.
I have the same problem as Jay, I get
pdisk: can’t open file ‘/dev/disk1′ for writing (Permission denied)
after entering i.
Funny, because last night it worked, I was getting the place to enter First block, but I just went back to TestDisk one more time to check the figures, and this time it is different.
Also, does it matter if you analyse/try to restore disk1 rather than rdisk1.
Many thanks.
Hi I am having the same “can’t open file ‘/dev/rdisk1′for writing (Resource busy)” error at step 9. What do I do here? Also, can you tell me the difference between disk1 and rdisk1? I selected rdisk1 as you did, but I’m not sure why.
I am trying to recover an exFAT partition that disappeared after doing an Apple update. The first (HFS+) partition still works fine – it has Lion and applications. The exFAT was my data partition, and then I had unpartitioned space for a future BootCamp partition. Now DiskUtility shows the Lion partition and then a MS-DOS(FAT) partition called DISK1S4 taking up the rest of the space on the drive.
I have attached it to a different Mac to do this, so I am not booting from the drive I am trying to repair.
Thanks so much!!
I got around the Resource Busy problem by going to Disk Utility and unmounting the partition. Then the command worked.
However, now in step 10, I get
Command (? for help): c
First block: 40
Length in blocks: 409600
Name of partition: EFI System Partition
requested base and length is not within an existing free partition
Bad size
Am I supposed to skip the EFI System Partition, or what? I know the numbers are correct, because I had copied and pasted the info to TextEdit and copied and pasted the values from there.
1 P EFI System 40 409639 409600 [EFI System Partition]
2 P Mac HFS 409640 684101047 683691408 [MacIntoshHD]
3 P Mac Boot 684101048 685370583 1269536 [Recovery HD]
4 P MS Data 781971456 1465147391 683175936 [Data]
A physical block is 512 bytes:
A logical block is 512 bytes:
size of ‘device’ is 1465149168 blocks (512 byte blocks):
new size of ‘device’ is 1465149168 blocks (512 byte blocks)
This post is a potential lifesaver.
But please would would you update the main body of the text to include the warning about having to use gpt instead of pdisk on disks with GPT partition tables?
I followed your instructions to try to recover a 3TB drive which Disk Utility said needed to be initialised, including using pdisk to do the recovery (because I hadn’t read as far as the post from Fam on
2011-10-23).
Unfortunately although pdisk had failed with the partition map not big enough error, it had converted the partition scheme to APM.
And then the gpt command wouldn’t add partitions or create a new map (not even with the -f force options) or destroy the existing map.
Eventually I found this reference http://apple.stackexchange.com/questions/17845/how-do-i-change-a-disk-partition-map-scheme-from-mbr-to-guid-partitions-table
which said that iPartition http://www.coriolis-systems.com/iPartition.php was able to change the partition scheme (including from APM to GPT).
Luckily I had purchased iPartition some time ago so I gave it a try.
After setting the partition scheme back to GPT, I used the gpt instructions above to add back the partitions based in the information that testdisk had displayed.
Now all my partitions seem to be readable again.
Amazing!
I have managed to get to step 7. When I try to “Issue the command ‘sudo pdisk /dev/rdisk1′” in Terminal Password: pops up
Nothing I have tried works.
I have never used Terminal before and fear I’m not entering the command at the right place.
Analyse on TestDisk says:
Disk /dev/disk1 – 1000 GB / 931 GiB – 1053525168 sectors
Analyse cylinder 262144/1953525167: 00%
Read error at 260160/0/1 (lba=260160)
The external HD is a Lacie and I use a MacBook Pro older model. I would be eternally grateful for any help you can provide. Thank you so much for your time!
Hi Perro
I have a similar problem to George Hickman (2012-07-18), I enter the numbers just as they are but it tells me they are a bad size.
Edit /dev/rdisk1 -
Command (? for help): c
First block: 943125381
Length in blocks: 730761324
Name of partition: Lacs SG
requested base and length is not within an existing free partition
Bad size
Command (? for help): c
First block: 1803089310
Length in blocks: 842665196
Name of partition: Lacs SG 2
requested base and length is not within an existing free partition
Bad size
Command (? for help):
What am I doing wrong? or what can I do differently?
Thanks so much for your time and help
Hi L Cox,
Try using /dev/disk1 instead of /dev/rdisk1 it might work, have you confirm with disk utility that you are using the right disk?
Thank you!!!! I nearly lost 12 years of my work, which I stupidly kept storing for the past 2 years at Iomega external HD without additional backup. Apparently if you forget to unmount an external HD under Mac OS it could damage HD’s partition table. That’s exactly what happened this evening, when my incidentally knocked off a USB cable [arrrhhhhh]. After re-inserting the HD back I saw that scary message “the disk you inserted was not readable”. Following your suggestions I managed to get all my data back. THANK YOU FOR SHARING THIS WITH THE WORLD!
really thanks sir…
you save my life… however i use difrent method… but you inspired me… you are real hero…
thanks
Hi Perro
I am attempting your instructions but when I get to step 4, the Seagate GoFlex 4TB drive does not appear. I just see the imac’s hard drive. On the terminal it mentions that I should be the root user. I assume I am. There are no other drives connected at this time. What can I do to have Testdisk detect the damaged disk? It appears on system profiler.
Many thanks!
John
Hye Perro,
I tried to do exactly what you wrote down. Im having some difficulties though. I know that my WD hard drive used to be MAC OS Extended (Journaled), and I connected it to windows 7 via bootcamp yesterday and i guess thats when everything went wrong. Some of the messages that appear on the terminal was that the is not writable. when i chose the dev/rdisk1 one option, i chose apple mac partition, but no partition was shown. When i chose the option NONE though, there is a partition that says
“P Unknown Start 0 end 429463199″….
Does that mean everything in my hd has been deleted? Im kinda stuck at there… I still tried using that pdisk command though, since i have the start block and end block values, but when i tried calling for the commands, the commands could not be found..
Any idea on this?
Many thanx….
Ary…
Hi Perro,
Thanks for the info. I have run into a problem though and it doesn’t seem to be working for me. The first time I ran through the process the screen shots were similar to yours but nothing happened.
So I tried again and the following times the testdisk screen showed me more partitions at the beginning, before analyzing the partition (partition map, etc). I could still do the steps. Once analyzed and in terminal, the info changed from what it showed in step 8 before. It woulnd’t say that there is no valid block.
I can still go through the steps, but it asked me to initialize first.
I do and still no success.
Any help or ideas would be appreciated.
I am working on a 16gb flash drive. I ejected it from my computer, the icon disappeared from the desktop and then i removed it but when i plugged it in to my laptop i got the error message.
Thanks
Yes, I can confirm, you’re a Hero!!!
Seriously, this was actually soooo easy compared to waiting hours upon hours for those pay-for apps to scan and analyse. Ok, so some of them give you the volume names but then that costs $90+
The problem I had was a home made RAID Box using a SATA Raid Bridge board from SPAN.com (http://www.span.com/product/Firewire800-USB2-eSATA-Bridge-Board-UFS-DSATA210-PLX-Oxford-OXUFS946DSE-LQCG-chip-for-2x-SATA-HD-Normal-RAID~34369).
I previously had a pair of 500Gb SATA drive in RAID-0 as a backup/temp storage location while I was shuffling files around various machines and external disks.
My Mac Mini’s hard drive starting failing (S.M.A.R.T Attribs. showing issues and machine slowing with lockups too). So I used the Bridge Controller board with another SATA drive to backup the Mini – but I needed to change the Mode of the board from Raid-0 to ‘pm’ (Just a Bunch Of Disks – JBOD) as there was just one drive connected. After completing the backup, I forgot what the previous setting was and the board re-initialise the pari of 500Gb disks!
After hours of downloads and testing apps. – I’m a cheapskate as it shouldn’t be that difficult to rebuild a partition table with the right tools – my Google Foo got refined and I found this blog after reading about TestDisk.
So, with the AppleXSoft app’s scan results, I could match the partitions listed by TestDisk by size (length / 2 / 1024 / 1024 = Size in Gb .. first /2 is 512 byte per sector). Then I named the partitions I re-created with the names listed by AppleXSoft’s app. …or used ‘n’ from TestDisk’s menu to change them from ‘One’, ‘Two’ and ‘Three’, then wrote the changes to the disk. Bare in mind, if you had spaced in the partition names, you need to enclose it with double-quotes. e.g. “Recovery HD”
Once again, thank you Perro, faultless – just a shame TestDisk doesn’t write to HFS+ and still need to use pdisk. Incidentally, it’s back on Mac OS X Mountain Lion – I read Apple apparently removed it, or maybe the Migration Assistant copied it from my old MacBook Pro which initially had Leopard followed by Snow Leopard and Lion OS Upgrades).
Hi, can I use this guide on Ubuntu or it is only for Mac?
Thanks a lot!
Hey man,
I recently had my USB 1 TB external hard drive get unplugged accidently, and since then I’ve had the “unreadable” error on my MacBook. I tried out this application, and while I’m not the most handy using Terminal, your walkthrough was perfect. The only thing is, it didn’t work. And I’ve tried now maybe four times. I was wondering if there was any further help you have to give as I want to try to recover what’s on this drive before just abandoning ship. Thank you again!
That simple? LoL!
Hi Perro Hunter,
Same issues with the others
“requested base and length is not within an existing free partition”
tried both rdisk1 and disk1
It worked the first time but half way down entering it I missed a number in the partition start so had to start over.. now its happening every time.
all I did was quit terminal and start over.
Any idea?
Maybe the resource stayed open, try re-entering the partition table with pdisk
Work perfectly. Thank you so much!
I’m glad
You just saved my life. Thank you very much.
You are very welcome
I’m also running into problems at Step 9.
“pdisk: can’t open file ‘/dev/disk1′ for writing (Permission denied)”
I’ve tried /dev/disk1 as well as /dev/rdisk1
Also, ‘sudo pdisk’ returns “pdisk: Can’t read block 0 from ‘/dev/disk1′”
Has anybody been able to solve this yet?
Does the drive makes noises?
It makes pretty much the same noises as a healthy drive, nothing out of the ordinary! I “lost” the partitions on the drive after I had to forcefully power off my mac because it froze, so I am assuming the drive isn’t dying from old age.
Im also having this problem:
“pdisk: can’t open file ‘/dev/disk1′ for writing (Permission denied)”
I also tried with /dev/rdisk, same error..
Any solution to that?
Have you tried using sudo? are you sure it’s disk1?