Hi, a bug has been reported to the Debian BTS[1] about breaking hidden FAT partitions that seems relate to libparted. Ben Hutchins prepared a patch to have parted preserve hidden fat partitions[2], but it is unclear whether that behaviour is ideal in all situations, so we (Otavio asked me to forward this because he is busy enough with his other Debian work to delegate forwarding this) would appreciate if you could offer some comment on the problem and/or the proposed solution.
Kind regards T. 1. http://bugs.debian.org/491797 2. in the bug log[1], also attached for your convenience -- Thomas Viehmann, http://thomas.viehmann.net/
Here's a patch for this. I constructed a table with two FAT partitions on a memory card, hid one partition by changing its type code, and then verified that fatresize would destroy the hidden partition but would leave it intact once I applied this patch to libparted. I am not going to NMU because I'm unsure whether it's generally a good idea to leave hidden partitions untouched. If it is, please apply this. Ben. #! /bin/sh /usr/share/dpatch/dpatch-run ## preserve-hidden-parts.dpatch by Ben Hutchings <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: This is an attempt to fix bug #491797. It changes the partition ## DP: rewriting code to set only the type code in entries for empty or ## DP: hidden partitions, so that hidden partitions should be preserved ## DP: so long as we don't resize another partition over them. @DPATCH@ diff -urNad parted-1.8.8.git.2008.03.24~/libparted/labels/dos.c parted-1.8.8.git.2008.03.24/libparted/labels/dos.c --- parted-1.8.8.git.2008.03.24~/libparted/labels/dos.c 2008-10-05 22:24:07.000000000 +0100 +++ parted-1.8.8.git.2008.03.24/libparted/labels/dos.c 2008-10-05 22:43:43.000000000 +0100 @@ -1148,13 +1148,17 @@ if (!table.mbr_signature) table.mbr_signature = generate_random_id(); - memset (table.partitions, 0, sizeof (DosRawPartition) * 4); - table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC); + if (table.magic != PED_CPU_TO_LE16 (MSDOS_MAGIC)) { + memset (table.partitions, 0, sizeof (DosRawPartition) * 4); + table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC); + } for (i=1; i<=4; i++) { part = ped_disk_get_partition (disk, i); - if (!part) + if (!part) { + table.partitions [i - 1].type = PARTITION_EMPTY; continue; + } if (!fill_raw_part (&table.partitions [i - 1], part, 0)) return 0; --- END ---
_______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted