[Bug 1333462] Re: Precise: Linux partitioning tools give GPT Linux partitions wrong type code
Rafael David Tinoco
rafael.tinoco at canonical.com
Tue Jun 24 01:04:06 UTC 2014
#
# After the fix:
#
root at 12-04-precise-lts-amd64:~# parted /dev/vdb
GNU Parted 2.3
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/vdb: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary
File system type? [ext2]?
Start? 1024B
End? 1070MB
(parted) p
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 1070MB 1070MB primary
### confirming right partition type
root at 12-04-precise-lts-amd64:~# gdisk /dev/vdb
...
Found valid GPT with protective MBR; using GPT.
...
Command (? for help): p
Disk /dev/vdb: 2097152 sectors, 1024.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): BCD7AF2D-A2A1-4967-8586-D1B8999B47BE
...
Number Start (sector) End (sector) Size Code Name
1 34 2089843 1020.4 MiB 8300 primary
### 8300 = Linux filesystem
** Patch added: "precise-parted_2.3-8ubuntu5.2.diff"
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1333462/+attachment/4137754/+files/precise-parted_2.3-8ubuntu5.2.diff
** Description changed:
[Impact]
From: Rod Smith <rodsmith <at> rodsbooks.com>:
"""
This problem occurs because Linux partitioning tools (libparted and my own GPT fdisk) give Linux partitions the same partition type code GUID used by Windows for its filesystem partitions (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7). Linux has its own GUID type codes for other partition types, such as RAID, LVM, and swap space.
Linux needs its own partition type code GUID for filesystem partitions
on GPT disks, much as it has its own MBR partition type code for
filesystems (0x83 on MBR). In Windows, using the same GUID type code for
Linux partitions that Windows uses for NTFS and FAT results in Linux
partitions appearing in the list of available disks. Using a unique type
code for Linux partitions, however, hides those partitions from Windows.
This is desirable because it's easy to accidentally trash a Linux partition in Windows by double-clicking it. (Windows DOES ask before formatting it, but a user who's confused, tired, distracted, etc., could easily make the wrong choice.)
"""
As a result, the grub menu end up with a "Windows option" because os-
prober detect a ntfs partition (in /usr/lib/os-
probes/mounted/20microsoft).
[Test Case]
### commands:
root at 12-04-precise-lts-amd64:~# parted /dev/vdb
GNU Parted 2.3
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/vdb: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary
File system type? [ext2]?
Start? 1024B
End? 1070MB
(parted) p
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
- 1 17.4kB 1070MB 1070MB primary
+ 1 17.4kB 1070MB 1070MB primary
### confirming wrong default partition type
root at 12-04-precise-lts-amd64:~# gdisk /dev/vdb
...
Found valid GPT with protective MBR; using GPT.
...
Command (? for help): p
Disk /dev/vdb: 2097152 sectors, 1024.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): B6D13DE1-2825-40D4-9D21-230E5E6F6EA0
...
Number Start (sector) End (sector) Size Code Name
- 1 34 2089843 1020.4 MiB 0700 primary
-
+ 1 34 2089843 1020.4 MiB 0700 primary
+
### 0700 = Microsoft basic data
[Regression Potential]
- * not determined yet.
+ * Partitions can be wrongly set with different types but it highly
+ unlikely this potential regression would cause harm to existent/mounted
+ disks/data. Fix is based on upstream fixes being cherry-picked.
[Other Info]
* n/a
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to parted in Ubuntu.
https://bugs.launchpad.net/bugs/1333462
Title:
Precise: Linux partitioning tools give GPT Linux partitions wrong type
code
Status in “parted” package in Ubuntu:
In Progress
Bug description:
[Impact]
From: Rod Smith <rodsmith <at> rodsbooks.com>:
"""
This problem occurs because Linux partitioning tools (libparted and my own GPT fdisk) give Linux partitions the same partition type code GUID used by Windows for its filesystem partitions (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7). Linux has its own GUID type codes for other partition types, such as RAID, LVM, and swap space.
Linux needs its own partition type code GUID for filesystem partitions
on GPT disks, much as it has its own MBR partition type code for
filesystems (0x83 on MBR). In Windows, using the same GUID type code
for Linux partitions that Windows uses for NTFS and FAT results in
Linux partitions appearing in the list of available disks. Using a
unique type code for Linux partitions, however, hides those partitions
from Windows.
This is desirable because it's easy to accidentally trash a Linux partition in Windows by double-clicking it. (Windows DOES ask before formatting it, but a user who's confused, tired, distracted, etc., could easily make the wrong choice.)
"""
As a result, the grub menu end up with a "Windows option" because os-
prober detect a ntfs partition (in /usr/lib/os-
probes/mounted/20microsoft).
[Test Case]
### commands:
root at 12-04-precise-lts-amd64:~# parted /dev/vdb
GNU Parted 2.3
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/vdb: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary
File system type? [ext2]?
Start? 1024B
End? 1070MB
(parted) p
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 1070MB 1070MB primary
### confirming wrong default partition type
root at 12-04-precise-lts-amd64:~# gdisk /dev/vdb
...
Found valid GPT with protective MBR; using GPT.
...
Command (? for help): p
Disk /dev/vdb: 2097152 sectors, 1024.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): B6D13DE1-2825-40D4-9D21-230E5E6F6EA0
...
Number Start (sector) End (sector) Size Code Name
1 34 2089843 1020.4 MiB 0700 primary
### 0700 = Microsoft basic data
[Regression Potential]
* Partitions can be wrongly set with different types but it highly
unlikely this potential regression would cause harm to
existent/mounted disks/data. Fix is based on upstream fixes being
cherry-picked.
[Other Info]
* n/a
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1333462/+subscriptions
More information about the foundations-bugs
mailing list