[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wrong partition identifier for HFS
From: |
Curtis Gedak |
Subject: |
Wrong partition identifier for HFS |
Date: |
Thu, 25 Feb 2010 10:22:29 -0700 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
When an "hfs" partition is created on a msdos disk, the partition
identifier is set to "0x83". The correct value for an HFS partition is
"0xAF".
The identifier "0xAF" is used by Apple for MacOS X file systems HFS or
HFS+ on Intel.
Following is a link to a list of partition identifiers, a set of
commands to demonstrate the problem, and a proposed patch to fix this
problem.
Regards,
Curtis Gedak
A) LIST OF PARTITION IDENTIFIERS
A list of partition identifiers for the "msdos" disk label can be found at:
http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
B) EXAMPLE COMMANDS TO DEMONSTRATE THE PROBLEM
$ parted -s /dev/sdb mklabel msdos
$ parted -s /dev/sdb mkpart primary hfs 63s 96389s
Warning: The resulting partition is not properly aligned for best
performance.
$ fdisk -l -u /dev/sdb
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00019a96
Device Boot Start End Blocks Id System
/dev/sdb1 63 96389 48163+ 83 Linux
$
C) PROPOSED PATCH TO FIX INCORRECT HFS PARTITION IDENTIFIER
From b68394f22924d52c834bfd0c6865b4e5de5a03ea Mon Sep 17 00:00:00 2001
From: Curtis Gedak <address@hidden>
Date: Thu, 25 Feb 2010 16:08:59 -0700
Subject: [PATCH] dos: set hfs partition identifier to proper value
The correct value for an "hfs" partition identifier is 0xAF.
Previously the partition identifier was incorrectly set to 0x83.
---
libparted/labels/dos.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index dce35b2..69c177c 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -86,6 +86,7 @@ static const char MBR_BOOT_CODE[] = {
#define PARTITION_LINUX 0x83
#define PARTITION_LINUX_EXT 0x85
#define PARTITION_LINUX_LVM 0x8e
+#define PARTITION_HFS 0xaf
#define PARTITION_SUN_UFS 0xbf
#define PARTITION_DELL_DIAG 0xde
#define PARTITION_GPT 0xee
@@ -1354,7 +1355,9 @@ msdos_partition_set_system (PedPartition* part,
|| !strcmp (fs_type->name, "hpfs")) {
dos_data->system = PARTITION_NTFS;
dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0;
- } else if (!strcmp (fs_type->name, "sun-ufs"))
+ } else if (!strcmp (fs_type->name, "hfs"))
+ dos_data->system = PARTITION_HFS;
+ else if (!strcmp (fs_type->name, "sun-ufs"))
dos_data->system = PARTITION_SUN_UFS;
else if (is_linux_swap (fs_type->name))
dos_data->system = PARTITION_LINUX_SWAP;
--
1.6.6
- Wrong partition identifier for HFS,
Curtis Gedak <=