Synopsis:
These notes describe the general process for manually installing FreeBSD onto a GPT-partitioned hard disk.
Prerequisites:
- FreeBSD 8.1 RELEASE memstick image, written to a USB flash drive, or
- FreeBSD 8.1 RELEASE dvd1 image written to a DVD-R. (memstick and dvd1 images contain both a Fixit environment and the installation distfiles)
Process:
- Boot from the FreeBSD install DVD or USB stick and run the Fixit environment.
- Create new partition table on ad0 using GPT scheme:
- Add 'freebsd-boot' partition to contain boot code ('-s' argument specifies partition size in 512 byte blocks):
- Write Protective MBR to sector 0 of disk and gptboot code into freebsd-boot partition
- Add 'freebsd-swap' partition:
- Add appropriately sized 'freebsd-ufs' partitions for /, /var, /usr and /home filesystems (I use swap-based tmpfs for /tmp)
- List our partition table so far
- Format freebsd-ufs partitions (p3 will be the root partition so softupdates are not enabled with '-U')
- Mount partitions under /mnt:
- Install FreeBSD distribution to mounted filesystems:
- Copy GENERIC kernel to expected location:
- Create a new fstab
- The hard disk now contains a minimal, unconfigured FreeBSD installation and should be bootable. Exit the Fixit environment, exit Sysinstall and reboot. Remove the CD while the machine resets.
- FreeBSD should boot up cleanly. Perform basic configuration steps:
- Set root's password
- Create /etc/rc.conf, setting hostname, network interface configuration, sshd_enable, etc
- Set timezone by copying appropriate timezone file from /usr/share/zoneinfo/*/ to /etc/localtime
- Create non-root user account
# gpart create -s GPT ad0
# gpart add -t freebsd-boot -s 128 ad0
# gpart bootcode -b /dist/boot/pmbr -p /dist/boot/gptboot -i 1 ad0
# gpart add -t freebsd-swap -s 8388608 ad0
# gpart add -t freebsd-ufs -s 2097152 ad0 # gpart add -t freebsd-ufs -s 2097152 ad0 # gpart add -t freebsd-ufs -s 41942040 ad0 # gpart add -t freebsd-ufs ad0
# gpart show ad0 => 34 312581741 ad0 GPT (149G) 34 128 1 freebsd-boot (64K) 162 8388608 2 freebsd-swap (4.0G) 8388770 2097152 3 freebsd-ufs (1.0G) 10485922 2097152 4 freebsd-ufs (1.0G) 12583074 41942040 5 freebsd-ufs (20G) 54525114 258056661 6 freebsd-ufs (123G)
# newfs ad0p3 # newfs -U ad0p4 # newfs -U ad0p5 # newfs -U ad0p6
# mount /dev/ad0p3 /mnt # cd /mnt # mkdir var usr home # mount /dev/ad0p4 /mnt/var # mount /dev/ad0p5 /mnt/usr # mount /dev/ad0p6 /mnt/home
# export DESTDIR=/mnt # cd /dist/8.1-RELEASE # for dir in base catpages dict doc info lib32 manpages; do (cd $dir; ./install.sh); done # cd kernels # ./install.sh GENERIC # cd src # ./install.sh all
# cd /mnt/boot # rmdir kernel # cp -Rp GENERIC kernel
# cd /mnt/etc # vi fstab /dev/ad0p3 / ufs rw 1 1 /dev/ad0p4 /var ufs rw 2 2 /dev/ad0p5 /usr ufs rw 2 2 /dev/ad0p6 /home ufs rw 2 2 /dev/ad0p2 none swap sw 0 0