Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Nov 2013 11:50:10 +0100
From:      Polytropon <freebsd@edvax.de>
To:        s m <sam.gh1986@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: how install two freebsd9.2 on one disk?
Message-ID:  <20131117115010.e13431a3.freebsd@edvax.de>
In-Reply-To: <CAA_1SgF0qwgSLu3J4E3PtuCsvqMMJJDoUb24v2FXhapKgv7k0A@mail.gmail.com>
References:  <CAA_1SgF0qwgSLu3J4E3PtuCsvqMMJJDoUb24v2FXhapKgv7k0A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 17 Nov 2013 13:51:07 +0330, s m wrote:
> for some reason, i want to install two freebsd9.2 OS on one SSD. is it
> possible??

Of course.



> i have problem in partitioning my disk for two OS. you know
> there is just one ada0 which can be partitioned.

If you're using the (recommended) partitioning method GPT, you
need to create several partitions, e. g.

	ada0p1 = boot code
	ada0p2 = OS installation #1 /
	ada0p3 = OS installation #1 /usr
	ada0p4 = OS installation #1 /home
	ada0p4 = OS installation #2 /
	ada0p5 = OS installation #2 /usr
	ada0p6 = OS installation #2 /home

Use labels to get rid of possible confusion with the disk
devices. Name the /, /var, /usr partitions (or only the /
partitions if you don't do any further partitioning) so you
can conclude which one belongs where, e. g.

	ada0p2 label "os1root"
	ada0p3 label "os1usr"
	ada0p4 label "os1home"
	ada0p4 label "os2root"
	ada0p5 label "os2usr"
	ada0p6 label "os2home"

Use those labels in /etc/fstab instead of the device names.

The FreeBSD Handbook covers this topic in detail:

http://www.freebsd.org/doc/handbook/install-steps.html

http://www.freebsd.org/doc/handbook/disks-adding.html

http://www.freebsd.org/doc/handbook/configtuning-disk.html

http://www.freebsd.org/doc/handbook/geom-glabel.html

You'll also find excellent additional documentation here:

http://www.wonkity.com/~wblock/docs/html/disksetup.html

If you decide to use the (legacy) partitioning method MBR, you
would first create two slices and then partition them accordingly
for the two OS installations, e. g.

	ada0s1  = slice for OS installation #1
	ada0s1a = OS installation #1 /
	ada0s1d = OS installation #1 /usr
	ada0s1e = OS installation #1 /home
	ada0s2  = slice for OS installation #1
	ada0s2a = OS installation #2 /
	ada0s2d = OS installation #2 /usr
	ada0s2e = OS installation #2 /home

Note you could also use dedicated disks here (if you only have
one partition per slice, the slices "becomes" the partition,
as like ada0 = ada0c would be the whole disk, ada0s1 = ada0s1c
would be the whole 1st slice). This is not trivial, but simple.
But you need to understand "traditional stuff" well. :-)

As you're probably initializing the SSD with UFS, keep in mind
that you can apply certain optimizations to make the SSD have
a long and happy life. :-)

	# newfs -m 0 -i 16384 -b 16384 -f 2048 -l -L os1root ada0s1
	# newfs -m 0 -i 16384 -b 16384 -f 2048 -l -L os2root ada0s2

This is just an example which somehow corresponds to the legacy
partitioning method mentioned above. You need of course to set
the parameters to _your_ intended way of use!




> if i define more partitions on ada0, can i use some of them for the first
> OS and the others for second one?

That would be the basic idea.

If you want to share a /home partition, that is also possible,
e. g. ada0p5 label "home" can be mounted from both installations
similarly (identical entry in /etc/fstab).



> if yes, how can i manage booting? 
> how and where should i install boot manager in order to manage them in
> booting time??

The boot manager would be installed into the first partition
(active partition) where the BIOS boots into. From there on,
the "next" partition will be selected for loading the kernel
and starting the OS.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131117115010.e13431a3.freebsd>