DaemonForums  

Go Back   DaemonForums > Other Operating Systems > Other BSD and UNIX/UNIX-like

Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own.

Reply
 
Thread Tools Display Modes
  #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: 163
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
  #2   (View Single Post)  
Old 19th June 2017
comet--berkeley comet--berkeley is offline
Real Name: Richard
Package Pilot
 
Join Date: Apr 2009
Location: California
Posts: 163
Default

This should be now fixed in Linux 4.4.73, 4.9.33, 4.11.6 and 4.12
__________________
When you see a good move, look for a better one.
--Lasker
Reply With Quote
  #3   (View Single Post)  
Old 7th November 2017
comet--berkeley comet--berkeley is offline
Real Name: Richard
Package Pilot
 
Join Date: Apr 2009
Location: California
Posts: 163
Default Newer version of the patch.

There is a problem mounting older FreeBSD file systems using the original patch.

Here is a newer patch:

Code:
--- a/block/partitions/msdos.c.orig	2017-11-05 13:05:14.000000000 -0800
+++ b/block/partitions/msdos.c	2017-11-06 09:46:00.148228242 -0800
@@ -301,7 +301,9 @@ 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)
+		/* FreeBSD has relative offset if C partition offset is zero */
+		if (memcmp(flavour, "bsd\0", 4) == 0 &&
+		    le32_to_cpu(l->d_partitions[2].p_offset) == 0)
  			bsd_start += offset;
  		if (offset == bsd_start && size == bsd_size)
  			/* full parent partition, we have it already */
__________________
When you see a good move, look for a better one.
--Lasker
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot mount Linux ext2 partitions notooth NetBSD General 4 25th October 2015 02:54 PM
mounting UFS partitions? chessmaster OpenBSD General 0 10th February 2014 01:50 AM
Weird problem mounting RAID partitions clevershark FreeBSD General 1 12th March 2010 05:28 PM
Mounting ext2 partitions seems to fail Sunsawe FreeBSD Installation and Upgrading 2 17th June 2009 01:38 PM
Moving linux partitions out of the BSD disklabel/slice fbsduser NetBSD Installation and Upgrading 5 4th March 2009 07:07 AM


All times are GMT. The time now is 11:35 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick