Problems started to appear when my laptop could not properly go in to a sleep/resume cycle, which is mentioned as normal in the freebsd handbook. not content at all... But figured that I can debug ACPI if I compile the "kernel". ha ha .... On another note, I wanted small fonts in the consoles like I had in debian and ubuntu. Again documentation concludes that I need to do a "kernel" compile. great ha... This is starting to give me a bit of a chill ("kernel compile"). In linux I was used not to touch anything with "kernal" in the title or description, let alone compile it... Hmm... freebsd handbook chapter 9 talks in detail about that and seems to be a smooth ride... Let me see... And, I wanted ZFS instead of UFS; apparently, for no good reason.
Found some help pages and blogs and forums
1. This is how to partition MBR for freebsd 8 (official).
2. This is how to partition GPT for freebsd 9 in complete command line.
3. There is a video on how to partition GPT for freebsd 9 using part command line and part standard installer.
However I wanted to install in an MBR partion using freebsd 9. The problem is freebsd 9 uses a new installer making parts of official institutions in (1) invalid. With a little merging of (1),(2) and referring to (3) all the time, I managed to come up with something that really worked. Here's how.
- Boot from CD/DVD/USB and start installer as normal. Proceed until you reach partitioning.
- Drop to "Shell" partitioning.
- In mine the disk was labelled 'ada0'. 'ada0s3' was the linux partitions and 'ada0s1' was simply the freebsd partition made during the previous installations.
- Create freebsd zfs and swap partitions. Unlike UFS partitions, no need to create separate ones for /, /usr, /var. Even swap can reside inside the zfs but was warned against that in (1). So,
gpart add -s 135G -t freebsd-zfs ada0s1 gpart add -t freebsd-swap ada0s1
My BSD partition was 145GB. So 135 for data and 10GB rest for swap.
- Then create a ZFS pool named 'zroot'. If for anything it fails add -f flag.
zpool create zroot /dev/ada0s1a
- Then create the boot properties, checksum and mount points.
zpool set bootfs=zroot zroot zfs set checksum=fletcher4 zroot zfs set mountpoint=/mnt zroot
- Now install ZFS Boot
zpool export zroot dd if=/boot/zfsboot of=/dev/ad0s1 count=1 dd if=/boot/zfsboot of=/dev/ad0s1a skip=1 seek=1024 zpool import -o cachefile=/var/tmp/zpool.cache zroot
if anything goes wrong refer to (1).
- Create the file system
zfs create zroot/usr zfs create zroot/usr/home zfs create zroot/var
Create other file system parts. Now the syntax is
zfs create (-o PROPERTY=VALUE)* MOUNT
eg. for compression(ON), exec(ON) and mount (zroot/tmp) type
zfs create -o compression=on -o exec=on zroot/tmp
Mount compression exec setuid zroot/tmp on on off zroot/usr/ports lzjb off zroot/usr/ports/distfiles off off off zroot/usr/ports/packages off off off zroot/usr/src lzjb off off zroot/var/crash lzjb off off zroot/var/db off off zroot/var/db/pkg lzjb on off zroot/var/empty off off zroot/var/log lzjb off off zroot/var/mail gzip off off zroot/var/run off off zroot/var/tmp lzjb on off - Add symbolic links to /home and set permissions for tmp
chmod 1777 /mnt/tmp cd /mnt ; ln -s usr/home home chmod 1777 /mnt/var/tmp
- Exit to standard installation.
exit
- Continue as normal and finally exit from the installation. and select LiveCD instead of Reboot.
- Login as 'root' without password.
- Copy zpool cache to file system.
cp /var/tmp/zpool.cache /mnt/boot/zfs/zpool.cache
- Edit /etc/rc.conf, /boot/loader.conf.
echo 'zfs_enable="YES"' >> /mnt/etc/rc.conf echo 'zfs_load="YES"' >> /mnt/boot/loader.conf echo 'vfs.root.mountfrom="zfs:zroot"' >> /mnt/boot/loader.conf
- register swap space in fstab
echo '/dev/ada0s1b none swap sw 0 0' >> /mnt/etc/fstab
- Unmount everything and mount again
zfs set readonly=on zroot/var/empty zfs umount -af zfs set mountpoint=legacy zroot zfs set mountpoint=/tmp zroot/tmp zfs set mountpoint=/usr zroot/usr zfs set mountpoint=/var zroot/var
- Reboot.
reboot now
And it worked...
Next... kernel compiles....