View Single Post
  #1   (View Single Post)  
Old 21st May 2017
comet--berkeley comet--berkeley is offline
Real Name: Richard
Package Pilot
 
Join Date: Apr 2009
Location: California
Posts: 154
Default Linux bug mounting FreeBSD partitions

My MBR formatted disk drive has Linux, OpenBSD and FreeBSD in separate partitions.

When Linux starts up and tries to recognize FreeBSD subpartitions, it always fails with this message:

sda3: <bsd:bad subpartition - ignored ...

Linux has no trouble with the OpenBSD subpartitions:

sda2: <openbsd: sda16 sda17 sda18 ...

FreeBSD subpartitions use relative block addresses whereas OpenBSD and NetBSD use absolute block addresses.

Here is a patch to Linux to adjust the FreeBSD partitions:
Code:
--- a/block/partitions/msdos.c  2015-12-27 18:17:37.000000000 -0800
+++ b/block/partitions/msdos.c  2015-12-29 10:44:25.813773357 -0800
@@ -300,6 +300,8 @@ static void parse_bsd(struct parsed_part
                        continue;
                bsd_start = le32_to_cpu(p->p_offset);
                bsd_size = le32_to_cpu(p->p_size);
+               if (memcmp(flavour, "bsd\0", 4) == 0)
+                       bsd_start = bsd_start + offset;
                if (offset == bsd_start && size == bsd_size)
                        /* full parent partition, we have it already */
                        continue;
Update 2017-05-29: This is now fixed in Linux-4.12-rc3 thanks to Christoph Hellwig and Jens Axboe and of course Linus.
__________________
When you see a good move, look for a better one.
--Lasker

Last edited by comet--berkeley; 30th May 2017 at 04:36 PM. Reason: Fixed in Linux-4.12-rc3
Reply With Quote