Bug 483402 - bad msftres flag
bad msftres flag
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: parted (Show other bugs)
10
All Linux
low Severity medium
: ---
: ---
Assigned To: Joel Andres Granados
Fedora Extras Quality Assurance
: Reopened, Triaged
: 510476 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-31 15:45 EST by Alexey Kuznetsov
Modified: 2009-12-16 09:07 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-12-16 09:07:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
parted-f11.patch (991 bytes, text/plain)
2009-05-23 10:14 EDT, Alexey Kuznetsov
no flags Details

  None (edit)
Description Alexey Kuznetsov 2009-01-31 15:45:27 EST
On my system i unable to remove msftres flag from my partition. I have Macbook Pro with tree os installed: osx, f10, windows. After i play with parted i tried to set different flags on my windows/linux parition but msftee all times come back.

[axet@axet-laptop i386]$ sudo parted /dev/sda
GNU Parted 1.8.8
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA FUJITSU MHW2120B (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags       
 1      20.5kB  210MB   210MB   fat32        EFI        boot, hidden
 2      210MB   34.4GB  34.2GB  hfs+         Leopard                
 3      34.6GB  96.8GB  62.2GB  ext3         Fedora     msftres     
 4      96.9GB  120GB   23.1GB  ntfs         Windows 7              

(parted) set 3 ms off
(parted) p                                                                
Model: ATA FUJITSU MHW2120B (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags       
 1      20.5kB  210MB   210MB   fat32        EFI        boot, hidden
 2      210MB   34.4GB  34.2GB  hfs+         Leopard                
 3      34.6GB  96.8GB  62.2GB  ext3         Fedora     msftres     
 4      96.9GB  120GB   23.1GB  ntfs         Windows 7              

(parted)                                                        


I tried to analyze problem. As you can get in wikipedia here is a several guids available for different partition type.

http://en.wikipedia.org/wiki/GUID_Partition_Table

Here useful information:

msftres E3C9E316-0B5C-4DB8-817D-F92DF00215AE

boot C12A7328-F81F-11D2-BA4B-00A0C93EC93B

linux/windows data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7


i tried to fix msftree flag by hands, and everyting going to works fine.

[root@axet-laptop ~]# hexedit /dev/sda
00000400   28 73 2A C1  1F F8 D2 11  BA 4B 00 A0  C9 3E C9 3B  (s*......K...>.;
00000410   81 A8 24 AF  75 A2 25 46  8D AD FC 4D  FA E5 DE 6F  ..$.u.%F...M...o
00000420   28 00 00 00  00 00 00 00  27 40 06 00  00 00 00 00  (.......'@......
00000430   01 00 00 00  00 00 00 00  45 00 46 00  49 00 00 00  ........E.F.I...
00000440   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000450   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000460   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000470   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000480   00 53 46 48  00 00 AA 11  AA 11 00 30  65 43 EC AC  .SFH.......0eC..
00000490   88 FA 3C 3A  5C 2E EA 4D  A4 53 B7 A2  7C AA E4 09  ..<:\..M.S..|...
000004A0   28 40 06 00  00 00 00 00  27 40 02 04  00 00 00 00  (@......'@......
000004B0   00 00 00 00  00 00 00 00  4C 00 65 00  6F 00 70 00  ........L.e.o.p.
000004C0   61 00 72 00  64 00 00 00  00 00 00 00  00 00 00 00  a.r.d...........
000004D0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
000004E0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
000004F0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000500   A2 A0 D0 EB  E5 B9 33 44  87 C0 68 B6  B7 26 99 C7  ......3D..h..&..
00000510   8E 92 E5 FD  F1 F2 67 41  96 95 FA 13  78 4F FF 39  ......gA....xO.9
00000520   AB 4A 06 04  00 00 00 00  36 79 44 0B  00 00 00 00  .J......6yD.....
00000530   00 00 00 00  00 00 00 00  46 00 65 00  64 00 6F 00  ........F.e.d.o.
00000540   72 00 61 00  00 00 00 00  00 00 00 00  00 00 00 00  r.a.............
00000550   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000560   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000570   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
00000580   A2 A0 D0 EB  E5 B9 33 44  87 C0 68 B6  B7 26 99 C7  ......3D..h..&..
00000590   C4 0D 90 C4  C0 51 46 41  B3 D5 13 8B  2C BB 62 92  .....QFA....,.b.
000005A0   47 65 48 0B  00 00 00 00  C0 37 F9 0D  00 00 00 00  GeH......7......
000005B0   00 00 00 00  00 00 00 00  57 00 69 00  6E 00 64 00  ........W.i.n.d.
000005C0   6F 00 77 00  73 00 20 00  37 00 00 00  00 00 00 00  o.w.s. .7.......

[root@axet-laptop ~]# gptsync /dev/sda

Current GPT partition table:
 #      Start LBA      End LBA  Type
 1             40       409639  EFI System (FAT)
 2         409640     67256359  Mac OS X HFS+
 3       67521195    189036854  Basic Data
 4      189293895    234436544  Basic Data

Current MBR partition table:
 # A    Start LBA      End LBA  Type
 1              1       409639  ee  EFI Protective
 2         409640     67256359  af  Mac OS X HFS+
 3       67521195    189036854  83  Linux
 4 *    189293895    234436544  07  NTFS/HPFS

Status: Tables are synchronized, no need to sync.

[root@axet-laptop ~]# 


After it i tried to fix parted source and get patch here. And in code, parted revert msftres flag in some unknown for me reason. Here is it:

diff -ur parted-1.8.8/libparted/labels/gpt.c parted-1.8.8.new/libparted/labels/gpt.c
--- parted-1.8.8/libparted/labels/gpt.c	2009-01-31 23:33:06.000000000 +0300
+++ parted-1.8.8.new/libparted/labels/gpt.c	2009-01-31 23:33:00.000000000 +0300
@@ -1299,29 +1299,6 @@
 		return 1;
 	}
         
-	if (fs_type) {
-		if (!strncmp (fs_type->name, "fat", 3) == 0
-		    || !strcmp (fs_type->name, "ntfs") == 0) {
-			gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
-			return 1;
-		}
-		if (!strncmp (fs_type->name, "hfs", 3) == 0) {
-			if (!guid_cmp (gpt_part_data->type,
-				       PARTITION_APPLE_TV_RECOVERY_GUID)
-			    || gpt_part_data->atvrecv) {
-				gpt_part_data->type =
-					PARTITION_APPLE_TV_RECOVERY_GUID;
-			} else {
-				gpt_part_data->type = PARTITION_APPLE_HFS_GUID;
-			}
-			return 1;
-		}
-		if (strstr (fs_type->name, "swap")) {
-			gpt_part_data->type = PARTITION_SWAP_GUID;
-			return 1;
-		}
-	}
-
 	gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
 	return 1;
 }
Only in parted-1.8.8.new/libparted/labels: gpt.c~



After applying those patch parted start to work correctly. Probably error inside those bad if. Please explain for me why here is strange "!strcmp || !strcmp"

Also i unable to remove msftree flag from my windows/ntfs partition.

check this out plz!
Comment 1 Alexey Kuznetsov 2009-01-31 16:04:52 EST
that is common problem, check google:

http://www.google.com/search?q=clean+msftres
Comment 2 Alexey Kuznetsov 2009-01-31 16:12:11 EST
also interesting (in confirm to comment 1):

[root@axet-laptop axet]# parted /dev/sda
GNU Parted 1.8.8
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA FUJITSU MHW2120B (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags       
 1      20.5kB  210MB   210MB   fat32        EFI        boot, hidden
 2      210MB   34.4GB  34.2GB  hfs+         Leopard                
 3      34.6GB  96.8GB  62.2GB  ext3         Fedora                 
 4      96.9GB  120GB   23.1GB  ntfs         Windows 7              

(parted) set 3 ms off                                                     
(parted) p                                                                
Model: ATA FUJITSU MHW2120B (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags       
 1      20.5kB  210MB   210MB   fat32        EFI        boot, hidden
 2      210MB   34.4GB  34.2GB  hfs+         Leopard                
 3      34.6GB  96.8GB  62.2GB  ext3         Fedora     msftres     
 4      96.9GB  120GB   23.1GB  ntfs         Windows 7              

(parted) set 4 ms off                                                     
(parted) p                                                                
Model: ATA FUJITSU MHW2120B (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags       
 1      20.5kB  210MB   210MB   fat32        EFI        boot, hidden
 2      210MB   34.4GB  34.2GB  hfs+         Leopard                
 3      34.6GB  96.8GB  62.2GB  ext3         Fedora     msftres     
 4      96.9GB  120GB   23.1GB  ntfs         Windows 7  msftres     

(parted)
Comment 3 Alexey Kuznetsov 2009-05-23 10:04:09 EDT
problem persist in fedora 11. if no body want to understand how good it is,  please just apply my patch.
Comment 4 Alexey Kuznetsov 2009-05-23 10:14:37 EDT
Created attachment 345197 [details]
parted-f11.patch

patch for f11 package (parted-1.8.8-17.fc11.i586)
Comment 5 Joel Andres Granados 2009-06-12 08:35:01 EDT
You patch was not applied as you sent it but I have corrected the logic on those if statements.  To test pls go to http://koji.fedoraproject.org/koji/taskinfo?taskID=1405593.  This is one of the scratch builds that I have done of upstream parted and its making its way to rawhide (in a week or so).
Feel free to reopen if the issue persists.
Comment 6 Keshav Amburay 2009-07-10 13:03:59 EDT
Check out https://bugzilla.redhat.com/show_bug.cgi?id=510476

The "Microsoft Reserved" Partition in GPT is needed only for conversion from a
basic disk to dynamic disk in Windows. Otherwise it is not at all needed and
according to Microsoft, any FAT(16,32 etc..) or NTFS partition(s) should be
"Basic Data Partition" if they have to be accessible in Windows and Mac (Linux
allows access even to a msftres partition).

Think of it like the 128 MB gap between partitions imposed by Mac OS X's Disk
Utility in GPT disk for future usage which cannot be anticipated at present.
Microsoft creates this partition for any future usage similar to the 128 MB
gap.

The above mentioned code in libparted assumes that any FAT or NTFS partition
must be marked as Microsoft Reserved (the same way any HFS partition must be
marked Apple_HFS), but this is not correct.

This bug can be corrected by either deleting the above lines or by modifying
them as follows :-

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


What is a Microsoft Reserved Partition?

The Microsoft Reserved Partition reserves space on each disk drive for
subsequent use by operating system software. GUID Partition Table disks do not
allow hidden sectors. Software components that formerly used hidden sectors now
allocate portions of the Microsoft Reserved Partition for component-specific
partitions. For example, converting a basic disk to a dynamic disk causes the
Microsoft Reserved Partition on that disk to be reduced in size and a newly
created partition holds the dynamic disk database.

Will end users see the Extensible Firmware Interface System Partition,
Microsoft Reserved Partition, and OEM-specific partitions?

The user won't see these partitions exposed in Windows Explorer, nor is any
recognized file system exposed to legacy programs such as Context Indexing. The
Extensible Firmware Interface System Partition, OEM-specific, and other
unrecognized partitions will be visible only in the Disk Management MMC
snap-in.

What partitions are mounted by default by Windows?

Windows exposes only basic data partitions. Other partitions with FAT file
systems may be mounted, but not exposed (only programmatically). Only basic
data partitions are assigned drive letters or mount points.

The Microsoft Reserved Partition (and any partitions that are created from the
Microsoft Reserved Partition) could have recognizable file systems; none are
exposed.

What happens when a basic disk is converted to dynamic?

For a drive to be eligible for conversion to dynamic, all basic data partitions
on the drive must be contiguous. If other unrecognized partitions separate
basic data partitions, the disk cannot be converted. This is one of the reasons
that the Microsoft Reserved Partition must be created before any basic data
partitions.

The first step in conversion is to separate a portion of the Microsoft Reserved
Partition to create the configuration database partition. All non-bootable
basic partitions are then combined into a single data container partition. Boot
partitions are retained as separate data container partitions. This is
analogous to conversion of primary partitions.

Retrieved from http://support.microsoft.com/kb/302873 - FAQ about GPT Disk
Architecture
Comment 7 Joel Andres Granados 2009-07-13 08:45:06 EDT
(In reply to comment #6)
> Check out https://bugzilla.redhat.com/show_bug.cgi?id=510476
> 

So the problem in this bug and in 510476 is the same.  I will dup 510476 and reopen this one, which has more information, to have just one point to handle this issue.
Comment 8 Joel Andres Granados 2009-07-13 08:45:46 EDT
*** Bug 510476 has been marked as a duplicate of this bug. ***
Comment 9 Keshav Amburay 2009-07-13 09:37:53 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > Check out https://bugzilla.redhat.com/show_bug.cgi?id=510476
> > 
> 
> So the problem in this bug and in 510476 is the same.  I will dup 510476 and
> reopen this one, which has more information, to have just one point to handle
> this issue.  

This bug does not have anything to do with AppleTV Partitions or anything else related to Fedora appletv support patch. This bug occurs because some parted developer, at some point of time, misunderstood the real need for Microsoft Reserved Partitions in GPT and added the mentioned code in gpt.c file thinking that any FAT or NTFS partition should be by default marked as msftres, which is exactly opposite to what Microsoft claims and How Windows deals with FAT and NTFS partitions in GPT. This is just a 128 MB reserved (for future use) space for converting basic disks to dynamic discs and tasks similar to that by Windows compensating for the absence of Hidden Sectors in GPT.
Comment 10 Keshav Amburay 2009-07-13 10:03:00 EDT
To Joel Andres Granados:-
              
Since you are also one of the main parted developers, correct this problem in main Parted GIT repository so that it is solved once and for all, instead of just creating a patch for Fedora's Parted src-rpm package.

Also try out this software - GPT fdisk

http://rodsbooks.com/gdisk/ and http://sourceforge.net/projects/gptfdisk/

This software has some very good features like setting any arbitary partition type GUID for a GPT partition, converting a disk from MBR (or msdos disklabel) to GPT without loss of data etc. It is a full-fledged GPT editor for all non-filesystem related tasks (it does not include filesystem related functions).

GNU Parted is good for things like filesystem resizing etc. But for things like manipulating the Partition type GUID, Partition Unique GUID, Disk GUID, and other GPT header and the Partition table related data (not related to the contents of the partitions - filesystems), GNU Parted fails most of the time. 

Although it will take a lot of time to integrate its features into GNU Parted, please include atleast the arbitary Partition type GUID option as soon as possible. It is a very important feature which, according to me, should be present even in a bare-minimum GPT related tool. This is particularly useful for people who are struck up with partitions like that of NetBSD and like Windows Recovery (WinRE) whose GUIDs parted does not contain by default. See http://en.wikipedia.org/wiki/GUID_Partition_Table for a whole list of Partition Type GUIDs. And please integrate these features into main Parted repository, not just for Fedora.

Thank you.
Comment 11 Joel Andres Granados 2009-07-14 07:33:35 EDT
keshav:

Thx for the link and explinations.  I'll get to this as soon as I can.
Comment 12 Maciej Żenczykowski 2009-07-31 16:30:26 EDT
Keshav: thanks for the link to gdisk.  It just saved me... I created a new partition in mac os x, and mistakenly formatted it as vfat, then dd'ed over another hfs+ formatted disk onto it.  Couldn't figure out how to get it to get detected as hfs+, so I ran parted from a boot cd, and eventually ended up with msftres flag set and couldn't get rid of it.  Eventually used gdisk to manually set the GUID to mac/hfs+.  Problem solved.
Comment 13 Maciej Żenczykowski 2009-07-31 16:31:09 EDT
(oh, and the problem is present in F11 as well, since I used an F11 install dvd)
Comment 14 Keshav Amburay 2009-09-04 07:27:27 EDT
Why is this bug not yet corrected? The exact cause of the problem has already been shown.
Comment 15 Keshav Amburay 2009-09-04 07:35:38 EDT
Also why there is no activity in Parted's GIT repository for a long time? Please read the parted bug list (apart from the mailing list) mentioned in Parted website. There are lots of bug reports in that but there is not even a single reply from a parted developer to any of them.
Comment 16 Joel Andres Granados 2009-09-08 10:01:33 EDT
(In reply to comment #15)
> Also why there is no activity in Parted's GIT repository for a long time?

The Git repo for parted is moving along as expected, there is stuff going into next and master is being left alone for now.  Can you be more specific?

> Please read the parted bug list (apart from the mailing list) mentioned in
> Parted website. There are lots of bug reports in that but there is not even a
> single reply from a parted developer to any of them.

Are you referring to parted-bug list?  There were some 10 bugs that were outstanding from previous months.  I tried to address them all and 1.9.0 came out with a lot of fixes from that list.  Can you also be more specific?  Which bugs are you referring to?

(In reply to comment #14)
> Why is this bug not yet corrected? The exact cause of the problem has already
> been shown.

Doing lots of things at the same time.  If you have a patch, I would really appreciate it!!!
Comment 17 Keshav Amburay 2009-09-08 12:32:30 EDT
I am referring to these bugs and other bugs in these pages 

http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/186
http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/215
Comment 18 Keshav Amburay 2009-09-25 07:52:09 EDT
This bug has been corrected in GNU Parted GIT repository http://git.debian.org/?p=parted/parted.git (as on 25th September 2009).
Comment 19 Bug Zapper 2009-11-18 05:56:18 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 20 Keshav Amburay 2009-12-04 05:59:12 EST
This bug has been corrected in Parted v2.0 Beta. I am unable to change the Fedora version number to 12 or rawhide. I suppose this bug report should be open untill fedora repository bring out Parted v2.0 rpm package. I request someone to change the Fedora version number to 12 or rawhide here. Thank you.
Comment 21 Hans de Goede 2009-12-16 09:07:04 EST
This bug is also fixed in parted-1.9.0, which we have been shipping for a while, closing.

Note You need to log in before you can comment on or make changes to this bug.