FreeBSD and Linux shared installation

Ian Smith smithi at nimnet.asn.au
Tue Jan 21 07:36:48 UTC 2014


In freebsd-questions Digest, Vol 503, Issue 1, Message: 28
On Tue, 21 Jan 2014 06:04:05 +0100 Polytropon <freebsd at edvax.de> wrote:

 > For educational and experimental purposes, I'd like to install
 > FreeBSD along with two Linusi on a laptop. It has a 100 GB SATA
 > disk which should be sufficient. So I'm searching for important
 > advice and mentioning of pitfalls that I should avoid. I'm
 > planning to use FreeBSD 10.0, Kali Linux and Mageia. Here are
 > some problems or considerations I expect to be facing:
 > 
 > Partitioning: Does Linux support GPT, or should I better keep
 > using MBR? FreeBSD would get one slice, "DOS primary partition",
 > a common data exchange partition another one, and the Linusi
 > could do their stuff on "logical drives inside a DOS extended
 > partition", as it seems to be common over there.

I've been waiting for 'someone' to do a GPT version of boot0 for a few 
years, as otherwise even if all the OS you want to multiboot handle GPT,
you're forced to go with GRUB or some other? non-base boot loader.  So 
meanwhile, the hard work of stuffing boot0 into the 512 bytes of the MBR 
has been done and very well documented, and it's never let me down.

I've never (since OS/2 anyway) tried using the extended partition for 
bootable OSes but since the code caters for it and Olivier and others 
have reported it working, I'll assume it does :)

 > Boot manager: Can the FreeBSD boot manager (which I prefer because
 > it's simple and sufficient) recognize and distinguish the two
 > Linusi? Is there an easy way to modify its source so the display
 > is more obvious, e. g.
 > 
 > 	F1 FreeBSD
 > 	F2 Kali
 > 	F3 Mageia
 > 
 > 	Default: F1
 > 
 > instead of
 > 
 > 	F1 FreeBSD
 > 	F2 Linux
 > 	F3 Linux
 > 
 > 	Default: F1
 > 
 > which I assume would be the default? I have already briefly checked
 > the source at /usr/src/sys/boot/i386/boot0/boot0ext.S which doesn't
 > seem to have a more specific differentiation, but maybe a "custom
 > hack" could be used to disguise one of the Linusi at something else?

The short answer is 'no way'.  For one thing, boot0ext.S is a whopping 
1KB program with likely some scope for mods if you're sharp with x86 
assember, but it's never made, only boot0 and boot0sio appear in /boot 
and Makefile makes no mention .. I assume it's 'historical reference'.

As boot0.S points out, many hacky tricks have been used to squeeze it 
into the MBR and there's next to no scope for any additional code.

 > Swap: Can the two Linusi share the same swap partition? And
 > furthoermore, could FreeBSD also use that one? Note that the
 > different systems are not running at the same time, so it would
 > be nonsense to waste disk space for three "dedicated" swap
 > partitions when one is sufficient.

Can't see any problem with that, based on (limited) Debian experience.

 > Shared data partition: I'm not searching for blazing performance,
 > so I do not require the most recent ext10fs or RiceFat here.
 > The goal should be that this partition can be adressed from all
 > the operating systems. It doesn't have to be /home, instead it
 > will be mounted separately, but rw. Regarding FreeBSD, it would
 > nice to not require fuse here (base OS tools preferred).

EXT2 or 3 should be no problem, but I'm not up to date (esp wrt FUSE).  
My older Win{98,XP,2K} plus FreeBSD laptops - not that I've booted 'doze 
for years now - have used msdosfs for shared data, of course before the 
FreeBSD partition/s to keep it simple for stupid, and Linux doesn't 
mind.  Despite being slow, inefficient and trashing fine permissions and 
timestamps, everything handles it.  I also use it for shared space on 
memsticks, to readily share some files between DOS, Linux and Mac boxes.

 > My initial partitioning and sizing idea:
 > 
 > Partition	OS, subpart.	Size	Device (slice, partition)
 > --------------	--------------	------	---------------------------
 > 
 > Prim. #1	FreeBSD		55 GB	/dev/ada0s1{a,d,e,f,g}
 > 		a	/	 1 GB
 > 		d	/tmp	 2 GB
 > 		e	/var	 2 GB

I'd likely go 4GB for /var, but it depends a lot on your usage.

 > 		f	/usr	15 GB
 > 		g	/home	35 GB

Should be good.  I tend to disagree with Olivier about not having a 
separate /home, and I recall you also being a fan of dump/restore, 
something else rendered far less useful with 'everything in /', though  
I understand the utility of that approach in (increasingly common) VMs.

 > Prim. #2	swap		 5 GB	/dev/ada0s2(b?), /dev/sda2

The (b?) would imply a bsdlabel, which would get clobbered by Linux.

 > Prim. #3	common data	10 GB	/dev/adas3, /dev/sda3
 > 
 > Extend. #1
 >   log. dr. #1	Kali Linux	15 GB	/dev/sda5
 >   log. dr. #2	Mageia Linux	15 GB	/dev/sda6

>From FreeBSD accessing my old OS/2 partitions I seem to recall that 
/dev/ada0s5 is the ext drive itself, and within would be ada0s6 and s7, 
though the above nomenclature would be right from Linux' POV.

 > Would something like this work, or is there a better approach?

Should be a goer .. modulo remembering which Linux is which :)

cheers, Ian


More information about the freebsd-questions mailing list