Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As a 2 decades of MS-Windows user I have switched to Mac OS X a month ago. And my knowledge is not enough to fix my big problem which I encountered yesterday and my brand new MBPro is dead now.

I installed Win-7 x64 on Boot Camp. My mistake at first is I have allocated very little space to Windows from my precious SSD disk. Yesterday I have tried to increase the Boot Camp partition from 80GB to 250GB. What exactly I did is;

  1. Started in Windows 7, taken a full Windows system backup into an external USB Disk.

  2. Switched to OS X and created a disk image (dmg) from my existing Boot Camp partition (Using Std. OS X's Disk Utility) this was my second backup. Since I don't want to get in trouble with activation of all my MS Office, Windows 7, Games etc. I was planning to restore one of those to my New Windows with larger disk capacity.

  3. in OS X, I have erased the Boot Camp partition (disk0s4) and enlarged the master HFS+ partition (disk0s2) to maximum physical disk capacity (~750GB) using Disk Utility

  4. Started Boot Camp and performed a clean copy of Windows x64 and this time I have given a disk size of 268GB for the new Boot Camp partition (simply; 250GB to Boot Camp, 500GB to OS X)

  5. Standard installation went well. Windows installation asked for product key, I skipped this and started new Windows for the first time. I shut it down and restart in OS X.

  6. Now the first of the series of the problems that eventually ended up with the death of my MBPro is coming up, Disk Utility refused to restore from DMG file (ref. step 2 - image was created from previous Windows partition so it is NTFS!) to new pysical Boot Camp partition (also NTFS). It said something like both disks were not identical or something like that. I checked the block sizes etc. Both was 512kb. I googled and found an alternative way to restore and skipped Disk Utility and switched to terminal window. Executed dd if=dmg of=disk04s to copy content of backup DMG file to new Boot Camp partition. Needles to say, Windows didn't start up, a black screen appeared and the worst thing is when I started in OS X, Disk Utility was showing only 80GB for the Boot Camp partition (which has to be 268). The capacity was overwritten by the previous partition's image file and all of a sudden I happen to lost 250-80=170GB.

  7. I decided to go with the other option to install a clean windows and use Windows7@s Backup/restore. To be able to do this I needed to start over and delete the Boot Camp partition again and resized the master HFS volume to its Max (of 768) as I already did in step 3-4.

  8. Started Boot Camp, this time Boot Camp gave me an error saying 'Can't install Boot Camp to multiple partitioned disk'. I already knew that Boot Camp requires a single OS X (HFS) partitioned disk so he can manage the partition table withing his screens. I was amazed with this error cause I knew that I already removed the last Boot Camp partition and resized the main HFS partition to its maximum.

  9. The golden shot, I have restarted my OS X. And it never came back. Thanks God, my repair partition was still healthy so I booted with command+r in repair mode. Now I have terminal windows open. I have run diskutil list and I couldn't believe the thing I saw, Boot Camp (or Disk Utility not sure) has changed the type of my primary OS X partition to MS-DOS (Fat 32) I guess, it says 'Microsoft Basic Data'.

I've been desperately looking for a way to change the corrupted type of my existing primary HFS+ partition (I know all my data is healthy and waiting for me if I could manage to reach them)

Here's the outputs of diskutil list:

/dev/disk0

 :  TYPE NAME                    SIZE       IDENTIFIER

0:      GUID_partition_scheme                        *751.3 GB   disk0

1:                        EFI                         209.7 MB   disk0s1

2:       Microsoft Basic Data                         750.4 GB   disk0s2

3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1

 :                       TYPE NAME                    SIZE       IDENTIFIER

0:     Apple_partition_scheme                        *1.3 GB     disk1

1:        Apple_partition_map                         30.7 KB    disk1s1

2:                  Apple_HFS Mac OS X Base System    1.3 GB     disk1s2

/dev/disk2

 :                       TYPE NAME                    SIZE       IDENTIFIER

0:                            untitled               *524.3 KB   disk2

(*I cleared the rest as they're irrelevant with various mount points of repair disk)

And df:

Filesystem    512-blocks    Used Available Capacity iused ifree %iused  Mounted on

/dev/disk1s2     2464464 2223200    216624    92%  280978 27078   91%   /

devfs                399     399         0   100%     691     0  100%   /dev

/dev/disk2          1024     288       736    29%      34    92   27%   /Volumes

/dev/disk3          1024     280       744    28%      33    93   26%   /private/var/tmp

/dev/disk4          1024     312       712    31%      37    89   29%   /private/var/run

/dev/disk5          1024     280       744    28%      33    93   26%   /System/Installation

/dev/disk6          1024     528       496    52%      64    62   51%   /private/var/db

/dev/disk7         12288    3304      8984    27%     411  1123   27%   /private/var/folders

/dev/disk8          4096     832      3264    21%     102   408   20% /private/var/root/Library

/dev/disk9          2048     288      1760    15%      34   220   13%   /Library/ColorSync/Profiles/Displays

/dev/disk10         1024     336       688    33%      40    86   32%   /Library/Preferences

/dev/disk11         1024     312       712    31%      37    89   29%   /Library/Preferences/SystemConfiguration

/dev/disk12         2048     280      1768    14%      33   221   13%   /Library/Keychains

/dev/disk13s1   15600632  283400  15317232     2%       0     0  100%   /Volumes/GPARTED

BTW, I have the OS X Mountain Lion with latest updates (10.8.x).

Until now, I have tried GParted (made a bootable thumb-drive, it didn't run, it has frozen in keyboard selection screen), I have tried TestDisk, it didn't run either, simply returned an error code, made a search about gpt, fdisk etc. but couldn't find any information that's worth to try.

So I'm here and waiting for an answer from you guys, can you suggest me any direction to go, a tool to use to fix my existing partition with the wrong file system type?

share|improve this question

1 Answer 1

You can try using the undocumented adjust function of the asr command. It can change the filesystem type label, without actually changing the data.

In your case, the appropriate command would be:

sudo asr adjust --target /dev/disk0s2 --settype "Apple_HFS"

This of course assumes that your underlying data hasn't been damaged, but as far as I'm aware, it's your best shot.

Once you get to a working state again, I would suggest backing up your data and doing a re-install from scratch, as it sounds like your partition table may have some issues.

share|improve this answer
    
Just a quick note: originally I mistakenly entered disk0s4 as the target, it should of course be disk0s2. –  robmathers Dec 18 '12 at 14:09
1  
After changing the windows partition on BootCamp (to reduce the install partition in size, and create another one), the boot loader of my macbook stopped recognizing the HFS partitions. This command fixed that :D –  Bruno Lopes Nov 4 '13 at 0:45
    
Thank you!! This undocumented adjust feature saved my bacon, after the undocumented feature of the OS X Yosemite installer made my Mac unbootable (but left the Win 8.1 bootcamp bootable.) –  Jared Thirsk 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.