Difference between revisions of "Advanced Installation Topics/9.2"

From PC-BSD Wiki
Jump to: navigation, search
(Install PC-BSD Over a Network)
(Using a Custom Partition Layout)
Line 1: Line 1:
=== Use PC-BSD Installer to Install FreeBSD ===
=== Use PC-BSD Installer to Install FreeBSD ===
=== Disk Encryption ===
=== Disk Encryption ===
=== Using a Custom Partition Layout ===
The "Detected Hard Drives" field lists the disks that PC-BSD has found during boot up, from which one needs to be selected. If you want PC-BSD to use the entire disk, for instance if you don't have any other operating systems on your PC, and no separate partition is used to store documents, you can check the "Use entire disk" option underneath to use all disk space of your hard disk drive. Be very careful when you select "Use entire disk" as it will overwrite all partitions!
In FreeBSD, and hence PC-BSD, each partition has a code in front of them, such as /dev/ad0s1, which is the path to the device (dev) file. [http://www.freebsd.org/doc/en/books/handbook/book.html#DIRSTRUCTURE Naming convention] is as follows:
* ad0 or da0 means "first drive"
* ---s1 means the first "partition" or slice in FreeBSD vocabulary
FreeBSD, starts counting disk drives from "0", and starts counting partitions from "1". Here are a few examples:
* /dev/ad0s1 — First drive, first partition
* /dev/ad1s1 — Second drive, first partition
* /dev/da0s3 — First drive (SCSI), third partition
* /dev/da1s1 — Second drive (SCSI), first partition
You also need to select the partition on which you want to install PC-BSD. If you already have more than one partition, all of them will be listed under the "Partition Selection" box. Select the one you want to use.
If Microsoft Windows is already installed and if you wish to have PC-BSD on the same computer, check the "Install the PC-BSD bootloader" option. The next time your computer boots up, a welcome screen will allow you to select which operating system you want to use. If you wish to use only PC-BSD on your computer or if you already have a Unix-based operating system installed with a bootloader such as Grub, GAG or Lilo, uncheck this option to keep your existing bootloader. When Windows is installed after PC-BSD, the FreeBSD bootloader will be overwritten and PC-BSD will be unbootable, which can be easily fixed. More information on the boot process, the FreeBSD bootloader and troubleshooting can be found [http://www.freebsd.org/doc/en/books/handbook/book.html#BOOT here].
If you want to make a custom partition layout mark the corresponding checkbox (recommended for advanced users only).
'''Figure X-XX:'''
'''Figure X-XX:'''
If you marked the checkbox for a custom partition layout, you may now edit the partition layout to your needs.
On the partition editing screen  the BSD disk partitions can be customised. PC-BSD (and FreeBSD) have two levels of partitioning:
* Regular partitions, also known as "Slices" by FreeBSD (ie: C:, D:, etc...);
* Sub-partitions invisibles by non-BSD systems, and known as "Partitions" by FreeBSD (ie: /boot, /var, /home, etc....)
You can keep all your mount points under "/", or you can spread them across several partitions or disks, or even across raid arrays for maximum performance. At the very least, you need a "/" partition with enough room for your files (4GB+) and a SWAP partition for virtual memory. Typically, SWAP space is advised to be set twice as big as your amount of RAM. This is not always necessary, for instance if you have 1GB of RAM, 1 GB of SWAP is probably sufficient for ordinary users. More information and examples check the "[http://www.freebsd.org/doc/en/books/handbook/book.html#INSTALL-STEPS Allocating Disk Space]" from the FreeBSD Handbook.
For more security, you can check the "Use Encrypted Swap Space" option, which will not leave any passwords or credit card numbers visible in your swap space. Swap Space Encryption can also at a later stage be turned of or off with the Services Manager.
=== Dual Booting ===
=== Dual Booting ===

Revision as of 08:19, 1 October 2010


Use PC-BSD Installer to Install FreeBSD

Disk Encryption

Dual Booting

When setting up a dual boot or a 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:

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.

The FreeBSD boot manager is a chain loader that typically occupies sector 0 of a disk, which is known as the 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 section.

For information on understanding and using the FreeBSD boot manager, please refer to this section of the FreeBSD Handbook.

For more information regarding the FreeBSD boot process, refer to the following man pages:

GAG, The Graphical Boot Manager

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.


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 Grub in Linux to boot PC-BSD and 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. If the version number is 2 or higher, see 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 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 (-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 Grub 2 manual

Dual Boot with Windows Using EasyBCD

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 Windows XP instructions. If you are using Vista, use How to Restore Vista Boot Manager.

Personal tools