Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Clear msftres and other GPT 'flags' set by GNU parted UNIX
This hint most likely only applies to people who have installed or used Linux on an Intel-based Mac. If this is not you, you may want to stop reading now.

Anyway, if you have tried to edit a GPT partition map using GNU parted, or a utility that uses libparted, and if you're not very good about following directions (like me), you may have accidentally set some of the partition "flags" that it exposes, such as msftres or boot. I put the term "flags" in quotes because it appears that parted actually changes the partition's type in the GPT from whatever it was before to -- in the case of msftres -- a "Microsoft Reserved" partition (GUID E3C9E316-0B5C-4DB8-817D-F92DF00215AE). These can have some unintended consequences -- as I found out, setting boot on any partition besides the EFI reserved one at the beginning of the disk will make any OS X installations on that disk unbootable.

Fortunately, boot can be easily unset the same way you set it (using parted). But, when you do so, at least using the version of parted that comes with Ubuntu Gutsy, the msftres flag is set, and parted won't let you unset it no matter how many times you try. The main problem this caused for me was that the partitions marked as msftres would no longer be mounted automatically by OS X, so they didn't show up in the Finder, and they were grayed out in Disk Utility. diskutil list indeed showed their type as "Microsoft Reserved Data" or something to that effect. (I don't remember exactly, and I didn't feel like changing the type back just to do testing for this hint.)

But -- and here's the hint -- it turns out that Disk Utility will still let you (try to) mount the partition, even though it's grayed out! Just select the partition and click Mount in the toolbar. If the filesystem is one that OS X recognizes (including FAT32 or NTFS), the volume will mount successfully and you can use it in OS X once again. What's more, as you can confirm using gpt or another utility, Disk Utility rewrites the partition map for you, back to the way it should be. (Although I don't know whether it does this on mount or when you later unmount the partition(s) in question, e.g. the next time you shut down OS X). At that point, everything is good as new.

I hope this helps someone out there; much anxious Googling didn't reveal anyone else who had figured out how to unset msftres.
    •    
  • Currently 2.14 / 5
  You rated: 1 / 5 (7 votes cast)
 
[37,333 views]  

Clear msftres and other GPT 'flags' set by GNU parted | 13 comments | Create New Account
Click here to return to the 'Clear msftres and other GPT 'flags' set by GNU parted' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: 2bord on Feb 06, '08 08:27:00AM

As far as I'm concerned the disk utility is of no help either!
It just says use First Aid and try to mount again.
I have a triple boot, win partition is ntfs, but nothing helps!
When I set the boot flag for the ntfs partition it doesn't even show up in the disk utility.

any ideas?
thx



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: wm on Feb 06, '08 10:32:23AM
Unset the boot flag using parted (or GParted or whatever). I believe this will set the msftres flag, which you won't be able to clear. Then, the partition should show up in Disk Utility, but with a name like disk0s3 (instead of its normal name) and grayed out. But even so, you should then be able to mount it as described in the hint.

[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: KaniS on Mar 07, '08 08:31:06AM
The trick of using Diskutil to mount the msftres partition did not work for me (I tried at least ten times, did all possible software updates and rebooted repeatedly). I could click the mount button, but nothing would happen. The log showed "success" on mounting and that's it. The drive never appeared or became ungrey. Doing a "mount" command from the terminal showed the error "Incorrect super block."

What OSX version are you using? I'm using Tiger with all the latest software updates so I'm guessing the trick will only work in Leopard.

Even though I didn't find a solution, I thought I would post my two-day saga for getting windows working again even though OSX still doesn't see the drive. I'll end with a theoretical way to remove the msftres flag.

After disabling journaling and using gparted 1.8.8 to change the hfs+ partition from 55 to 40 gig and the ntfs from 15 to 30, windows could no longer be selected as a boot option by holding alt. OSX could still see the NTFS partition as read only and all the data seemed to be there. I found you could choose what partition to boot from in OSX, but when it tried to boot XP, it would show the XP logo on black with a progress bar as normal, then eventually show a light blue screen saying "Autochk not found" followed by simply rebooting.

At some point I went back into gparted thinking maybe there's a flag I should set, so I clicked the "boot" flag but didn't click OK. Then I thought I'd better research it before I clicked OK, but it was too late. Simply checking the box makes the change immediately (stupid). Unchecking the box sets the msftres flag which can't be cleared except by checking boot again.

In my research, I learned that osx uses a newer computer firmware API called EFI (Extensible Firmware Interface), and that EFI controls hard drive partitions using "GPT". Windows still uses old BIOS "MBR" to control partitions. gparted had updated the GPT table but not the MBR table, but I found free software called rEFIt that has a partition tool to fix that. Now booting windows didn't complain that Autochk wasn't found, it simply said no boot partition was found (or something like that).

I tried to run a repair install of winxp but when I tried to choose the NTFS partition, it said it was an unrecognized format that couldn't be read. Strange, since it showed up as "NTFS" on the list.

I searched for hours trying to learn how to clear the msftres flag but it seems to be impossible. Finally, as a last resort, I decided to use gparted to just set the "boot" flag so the msftres flag would be cleared and I was amazed that suddenly windows could boot and worked fine. The partition still doesn't show up in osx but I don't care too much about that.

I did think of one theoretical way to get rid of the msftres flag without setting the boot flag. I'm not going to go through the trouble, but I wanted to share it in case anyone wants to try it. http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp has a whole bunch of info about this whole process and discusses how you can partition your drive using the gpt tool. I was able to use free software called "Clonezilla" to copy the ntfs partition to a USB hard drive (I had to use the raw partition mode, not ntfs mode, because the ntfs partition was marked "unclean" until I finally got windows to run its checkdisk). If I then used the gpt tool to destroy and recreate the partition, theoretically I could use Clonezilla to restore the old data to the partition without changing the partition table and maybe I would have things back the way they're supposed to be.

[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: wm on Mar 11, '08 01:32:07AM

Glad you got it working eventually. Definitely don't use gparted to change the partition table, because it doesn't seem to be aware of the GPT/MBR hybrid that OS X uses to allow Windows booting. You should've used diskutil instead (if it would even let you make that change). I'm also a bit surprised that setting the boot flag made Windows boot again and didn't prevent OS X from booting (which is what it did in my case), but whatever.

I think your theoretical solution would probably work, but it might not be worth it for you at this point.

Also, it's possible that I did the procedure mentioned in the hint when booted from a different physical disk from the one that had the partition with the msftres flag set. And yeah, I was using Leopard (10.5.1 at the time).



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: KaniS on Mar 12, '08 08:05:43AM

I think Leopard is probably the key to getting the msftres flag fixed. The rEFIt tool is what let me sync the GPT/MBR tables again, and I think it's also what lets me boot either OS with the 'boot' flag set.

Isn't diskutils the program that comes with OSX? From what I've read, if you try to make any changes to partitions with that, it destroys all the data on the disk, which is what gparted avoids. If I had known about rEFIt's GPT/MBR sync utility before I clicked the 'boot' checkbox in gparted the first time, I think everything would have been fine and my NTFS partition would have remained set to "Microsoft Basic Data" or whatever Bootcamp originally set it to that lets OSX work see the partition correctly.



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: wm on Mar 21, '08 04:03:22PM

As of 10.4.6, diskutil will let you resize journaled HFS+ volumes without erasing any data, assuming the structure of the disk and the data allow it. I'm not sure if volumes with any other filesystems can be resized, though, so I'm not sure if you could have used it in this case.



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: CptSilver on Mar 16, '08 11:00:35PM
Finally, a solution that worked (for my MBP at least).
You will need:
1) rEFIt (by Christoph Pfisterer).
http://refit.sourceforge.net/
rEFIt allows to select partition/OS on boot. Its gptsync command syncs GPT to MBR and restores MBR after gparted or diskpart (below) had its way with it.

2) Modified diskpart (by Nebojsa Sabovic)
http://forum.insanelymac.com/index.php?showtopic=31562
This diskpart allows resetting msftres-flagged partition back to Microsoft Basic Data type. (As per author's words, use at your own risk.)

What to do:
a) Install rEFIt
b) Drop compiled diskpart.efi in Macintosh HD \efi\tools
c) Re-boot to rEFIt screen.
d) Go to rEFIt shell
e) Start diskpart, type the following commands:
select <zero-based disk number, usually 0>
inspect (will list partitions on selected HD, write down the msftres-cursed partition number, which will show up labeled as MSRES)
chtype <zero-based partition number> MSDATA
inspect (check that MSRES became MSDATA)
f) exit diskpart (but do not exit the rEFIt shell yet)
g) run gptsync to restore MBR

All done. Many thanks to Christoph Pfisterer (for rEFIt), and to Nebojsa Sabovic (for modified diskpart)!

[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: datagrubber on Oct 18, '08 08:46:07PM

I discovered that having more than four partitions caused my problem with the msftres flag. When I deleted a swap partition and returned to having 1: EFI, 2: HFS (Leopard), 3: ext3, and 4: NTFS (Vista) I was able to get rid of the flag. (Puppy linux doesn't really need the swap partition so I'm ok now on my MacBook Pro.)



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: zaqarov on Oct 27, '08 12:18:10PM
If you only need temporary access, as I did, just going into Terminal and entering the following commands works to mount the drive.
>sudo su
>(enter password)
>mkdir /Volumes/temp/
>mount_msdos /dev/disk1s2 /temp/ (enter the appropriate dev/disk number instead of dev/disk1s2)
good luck ;)

[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU parted
Authored by: skodabenz on Jun 24, '09 02:03:39AM

The problem is caused by the presence of the following code in (parted-source-dir)/libparted/labels/gpt.c file :

if (strncmp (fs_type->name, "fat", 3) == 0
|| strcmp (fs_type->name, "ntfs") == 0) {
gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
return 1;
}

(lines 1221 to 1224)

This code is completely unnecessary and it doesn't make sense. According to Microsoft, "Microsoft Reserved" partition is unformatted and it is as of now only used if a disk is converted from basic disc to a dynamic disc using Windows under GPT. Otherwise this partition is not needed at all for using only basic discs. Also since it is unformatted, it is not related to any filesystem whatsoever (although any partition whether it is formatted or not , can be marked as a msftres partition, but it will always remain unused by Windows unless the disc is converted to dynamic type), so marking any FAT (or vfat or FAT32 etc.) or NTFS partition as "Microsoft Reserved" is absurd. According to Microsoft, any partition used for storing Data (FAT or FAT32 or NTFS - in case of Windows) SHOULD NOT BE MARKED AS "MICROSOFT RESERVED", they should be "BASIC DATA PARTITION" only (except any FAT parttion can also be marked as EFI SYSTEM PARTITION).

If those of you who read this, compile parted on their own, I request you to simply delete the above mentioned code from gpt.c file and then compile parted. I also request parted developers to remove the above code from gpt.c file by the next version.



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU Parted
Authored by: skodabenz on Aug 22, '09 08:40:51AM

For those of you who are struck up with the "msftres" flag bug in GNU Parted try this software to correct the problem :-

[link:]http://www.rodsbooks.com/gdisk/[link:]

[link:]http://sourceforge.net/projects/gptfdisk[link:]

You need to compile this software before using it. Just download the gdisk*.tgz file, decompress it, cd into that folder, type make.

If "make" command gives an error like "g++ not found", then you need to install "GCC and, G++ or GCC-C++" depending on the package name before compiling it. Follow the Read me file in gdisk folder on how to use the software.

This software is modelled along Linux fdisk (fdisk is for MBR disks).

Usage (for correcting the msftres flag problem only) :-

Type the commands in order in a terminal :-

1. su

2. Type the root password

3. gdisk /dev/sda (or /dev/sdb or sdc etc. - check GParted for the device file name of your disk)

4. At the prompt Command (m for help): type p

Number Start (block) End (block) Size Code Name

1 62 3980213 1.9 GiB 0c01

5. Note down the numbers of the partition(s) marked msftres ( all partitions with the code 0c01).

6. At the prompt Command (m for help): type t , then at the next prompt type the partition number for which you want to remove msftres :-

Current type is 'Microsoft Reserved'

Hex code (L to show codes, 0 to enter raw code):

7. To change the partition type to "Linux/Windows data" (Basic Data Partition) type 0700 at the prompt.

Hex code (L to show codes, 0 to enter raw code): 0700

Changed system type of partition to 'Linux/Windows data'

8. Now at the prompt Command (m for help): type w . This is very important as the changes will not be made to the disk until you do this. All the changes are done by gdisk by copying the GPT table into RAM and working from there. Only this step saves the changes to the GPT table in the disk and then the program exits.

9. If at any stage you want to exit the program without changing anything in the disk, type

Command (m for help): q

Note: I did not write this program and I take no responsibility whatsoever if anything goes wrong while using this. Follow step 9 if you want to exit without making changes.

For more info go to these links :-

[link:]http://www.insanelymac.com/forum/index.php?showtopic=113754&mode=linear[link:]

[link:]http://www.insanelymac.com/forum/index.php?showtopic=31562&mode=linear[link:]

The software GPT fdisk is also available for Mac OS X. The software version at the time of writing this is 0.3.2 .



[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU Parted
Authored by: skodabenz on Sep 25, '09 08:31:47AM
This bug has been corrected in GNU Parted GIT repository
http://git.debian.org/?p=parted/parted.git (as on 25th September 2009).

[ Reply to This | # ]
Clear msftres and other GPT 'flags' set by GNU Parted
Authored by: PizzaCake on Oct 24, '09 08:49:01AM

Using gparted 0.4.4 to create a FAT 32 partition I ended up with the dreaded microsoft reserved partition. Diskutil simply gave up and crashed. Gdisk 0.5 fixed it :) I first tried changing the type of the partition but this was not enough, the partitions were still messed up. After deleting the troublesome 'reserved' partition and rebooting all prior problems were fixed including gpt and mbr syncing as verified with refit.

Note gdisk is a lot easier to use now as it asks which which partition rather than entering sector numbers.

Many thanks to the author.



[ Reply to This | # ]