Difference between revisions of "Advanced Installation Topics/9.2"

From PC-BSD Wiki
Jump to: navigation, search
(Using a Custom Partition Layout)
(Dual Booting)
Line 1: Line 1:
=== Use PC-BSD Installer to Install FreeBSD ===
=== Use PC-BSD Installer to Install FreeBSD ===
=== Disk Encryption ===
=== Disk Encryption ===
=== Dual Booting ===
When setting up a dual boot or a [http://en.wikipedia.org/wiki/Multi_boot multi boot] system, it is best to first backup any important data, and to fully investigate what boot manager you will use.
'''Please note:''' none of these procedures are guaranteed to work. If performed incorrectly, you might render some of your systems unbootable or you might lose data. Always make a backup first!!!
You may also find the following tutorials handy:
* [http://sas-spidey01.livejournal.com/215000.html HOWTO boot FreeBSD, Linux, and Windows XP with GAG, GRUB, LILO, and BootEasy]
* [http://www.clearchain.com/blog/posts/freebsd-windows-vista FreeBSD & WINDOWS VISTA]
==== FreeBSD Boot Manager ====
During the installation of PC-BSD, you will be given the option to install the FreeBSD boot manager. If you plan to use or install a Linux distro on the same computer you are installing PC-BSD, be sure to install the FreeBSD boot manager. Even if you don't plan on using this boot manager, this is a necessary step as it will install the boot blocks needed by other boot managers. This section demonstrates both the FreeBSD boot manager as well as other freely available alternatives.
'''Note:''' if you plan to use the Windows boot manager, do not select the FreeBSD boot manager when installing PC-BSD. If you have already overwritten the Windows boot manager by mistake, see the section on [[#Recovering Windows Boot loader after installing PC-BSD | Recovering Windows Boot loader after installing PC-BSD]]'''.
The FreeBSD boot manager is a [http://en.wikipedia.org/wiki/Chain_loading chain loader] that typically occupies sector 0 of a disk, which is known as the [http://en.wikipedia.org/wiki/Master_boot_record Master Boot Record] (MBR).
The FreeBSD Boot Manager is also referred to as boot0 or "boot easy".
'''Example Boot Menu:'''
F1    FreeBSD
F5    Drive 1
Default: F1
Please note that recent versions of Windows have been found not to work with the FreeBSD boot manager as Windows requires the Windows Boot Manager to be installed in the MBR. If you wish to dual boot with Windows, For please refer to the [[#EasyBCD | EasyBCD]] section.
For information on understanding and using the FreeBSD boot manager, please refer to this section of the [http://www.freebsd.org/doc/handbook/boot.html FreeBSD Handbook].
For more information regarding the FreeBSD boot process, refer to the following man pages:
* [http://www.freebsd.org/cgi/man.cgi?query=boot0cfg boot0cfg]
* [http://www.freebsd.org/cgi/man.cgi?query=boot boot]
* [http://www.freebsd.org/cgi/man.cgi?query=bsdlabel bsdlabel]
* [http://www.freebsd.org/cgi/man.cgi?query=boot.config boot.config]
==== GAG, The Graphical Boot Manager ====
[http://gag.sourceforge.net/ GAG] is a versatile boot manager, capable of booting many different operating systems. After downloading and unzipping GAG, burn the cdrom.iso to a CD.
When you reboot the machine with the GAG CD inserted, select the option to Install GAG. You can then select S to set up GAG and choose to add the PC-BSD operating system to the GAG menu.
'''NOTE:''' If you are dual-booting with Linux, GAG requires that either grub or lilo be installed in the / or /boot partition of the Linux system.
==== Grub ====
Many Linux distros use grub as the boot loader. This section shows you how to add PC-BSD to an existing grub menu. You may also find the PCBSD FAQs on using [http://faqs.pcbsd.org/index.php?action=artikel&artlang=en&cat=16&id=10 Grub in Linux to boot PC-BSD] and [http://faqs.pcbsd.org/index.php?action=artikel&cat=1&id=9 How can I use Grub in PC-BSD to manage several operating systems?] to be helpful.
While booted into the Linux system, use the grub command line tool to list all devices that can be seen by grub's drivers. This will help you workout what drive options to use when setting the root option in the examples below.
$ '''sudo grub'''
grub> ls
grub> quit
There are two versions of grub that are in use. To see which version your Linux distro is using:
grub> '''grub --version'''
If the version number is less than 2, see [[#Adding PC-BSD to Grub Version 1 | Adding PC-BSD to Grub Version 1]]. If the version number is 2 or higher, see [[#Adding PC-BSD to Grub Version 2 | Adding PC-BSD to Grub Version 2]].
===== Adding PC-BSD to Grub Version 1 =====
Here is an example of adding PC-BSD to a Linux distro that is using grub version 1:
title  PCBSD 8.1
root  (hd0,1)
kernel /boot/loader
* '''Title:''' This will be the text that is shown in the boot menu and can be anything that makes sense to you.
* '''Root:''' The root of the partition containing PC-BSD. In the above example, PC-BSD is installed on the first hard disk (hd0) and on the first partition (,1). Start counting your hard disk from zero (e.g. disk 0 for the first hard disk, disk 1 for the second hard disk) and your partition from one (e.g. 1 for first partition on that disk, 2 for second partition, etc.)
* '''Kernel:''' Used to load the primary boot image. For FreeBSD and PC-BSD, always use /boot/loader.
For more information on using grub version 1, refer to the [http://www.gnu.org/software/grub/manual/legacy/grub.html Grub Legacy Manual].
===== Adding PC-BSD to Grub Version 2 =====
If your Linux distro is using grub version 2, the entry would now look like this:
title  PCBSD 8.1
root  (hd0,1,a)
kernel /boot/loader
Here are some examples of more complex grub version 2 entries:
'''To set some sysctl values when loading the kernel:'''
menuentry "PCBSD (FreeBSD) 8.1" {
  insmod ufs2
  set root=(hd0,3)
  kfreebsd /boot/kernel/kernel
  set KFreeBSD.vfs.root.mountfrom=ufs:dev/label/rootfs0
  set KFreeBSD.vfs.root.mountfrom.options=rw
'''To use the specified drive UUID:'''
First, at a command prompt in the PC-BSD system, determine the UUID with this command:
# '''/usr/local/sbin/grub-probe -d /dev/ad4s1 -t fs_uuid'''
Then, use that UUID in the grub menu entry:
menuentry "FreeBSD ad4, direct" {
  insmod ufs2
  set root=(hd0,1,a)
  search --no-floppy --fs-uuid --set 4b22f9090565ab77
  kfreebsd /boot/kernel/kernel
  kfreebsd_loadenv /boot/device.hints
  set KFreeBSD.vfs.root.mountfrom=ufs:/dev/ad4s1a
  set KFreeBSD.vfs.root.mountfrom.options=rw
'''To use ZFS on GPT Partition:'''
zfs set mountpoint=legacy on all datasets on ${ZPOOL} and manage mountpoints in ${ZFSDATASET-INSTALLATION}/etc/fstab
menuentry "FreeBSD install in ${ZFSDATASET-INSTALLATION} (i.e. 8.1-RELEASE-amd64) on ${ZPOOL} (i.e. zroot)" {
          insmod zfs
          # search for ${ZPOOL}
          search -s -l zroot
# Load kernel of FreeBSD, kfreebsd /${ZFSROOTDATASET}/${ZFSDATASET-INSTALLATION}@/boot/kernel/kernel [http://www.freebsd.org/cgi/man.cgi?query=boot&sektion=8 (-aCcDdghmnPpqrsv)]
          kfreebsd /8.1-RELEASE-amd64@/boot/kernel/kernel
          kfreebsd_module_elf /8.1-RELEASE-amd64@/boot/kernel/opensolaris.ko
          kfreebsd_module_elf /8.1-RELEASE-amd64@/boot/kernel/zfs.ko
# Loading kernel modules (${VAR}_load="YES") here, /boot/loader.conf isn't processed
#        kfreebsd_module_elf /${ZFSDATASET-INSTALLATION}@/boot/kernel/${VAR}.ko
          kfreebsd_module /8.1-RELEASE-amd64@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
          set kFreeBSD.vfs.root.mountfrom=zfs:zroot/8.1-RELEASE-amd64
# Loader Tunables (${TUNABLE}="variable" -> set kFreeBSD.${TUNABLE}=variable)
After a Grub2 configuration change you need to run '''update-grub''' as the superuser or '''sudo update-grub'''.
For more information please refer to the [http://grub.enbug.org/Manual Grub 2 manual]
==== Dual Boot with Windows Using EasyBCD ====
[http://neosmart.net/dl.php?id=1 EasyBCD] was developed by the non-profit NeoSmart Technologies to make modifying the Windows Boot Loader easier.
EasyBCD can be used to set up dual-boots between Windows and  Linux, BSD, or Mac OS X.
To prepare the system for dual-booting PC-BSD and Windows, follow these steps:
* 1: Using partitioning software, prepare at least 2 primary partitions.
* 2: Install Windows first.
* 3: In the second primary partition install PC-BSD. Don't check the boot loader option. This will prevent the install from interfering with the Windows boot loader.
* 4: When the install is finished, reboot into Windows.
* 5: In Windows, download the latest version of EasyBCD.
* 6: Run EasyBCD. Add an entry for your BSD partition. Go to the Linux/BSD Tab (older version might only read Linux for the tab) and from the dropdown menu options select FreeBSD and the relevant partition / drive.
==== Recovering Windows Boot loader after installing PC-BSD ====
Windows users often end up overwriting their Windows boot loader, thus losing access to Windows and only being able to boot into PC-BSD. This happens when the boot loader option is checked during the installation of PC-BSD. It is recommended that you first recover your Windows boot loader and then use the EasyBCD instructions above to setup a boot option for PCBSD.
If you are using XP, use the [http://www.ehow.com/how_4891476_reinstall-xp-bootloader.html  Windows XP instructions]. If you are using Vista, use [http://www.ehow.com/how_5127739_restore-vista-boot-manager.html How to Restore Vista Boot Manager].

Revision as of 08:22, 1 October 2010

Use PC-BSD Installer to Install FreeBSD

Disk Encryption

Personal tools