Ok, so I want to install the newly released FreeBSD 8.0 and only have ZFS partitions.
Questions I had that I am answering here for you:
- Does Sysinstall support ZFS?
No. You have to install manually using Fixit.
- Can I boot off a ZFS partition?
Yes, you can. Takes some effort to set it up though.
- Is it easy?
No, it isn’t easy it is hard. Unless you have used FreeBSD for some time, then it is just tedious and not really easy or hard.
- Is there a guide?
Yes, it is here:
But hopefully by the time I am done, the best guide will be this post.
Ok, so here it goes, I am following this guide: http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition
I am going to improve upon it and try to make it newbie proof and not skip steps in my guide when this guide skips steps. Why am I making it newbie proof? I don’t know, you would think if you are doing ZFS you aren’t a newbie, but who knows. Better safe than sorry.
Steps for How to install FreeBSD 8.0 using only ZFS partitions?
Step 1. Creating a bootable ZFS Filesystem
- Download the FreeBSD 8 DVD ISO from here: http://www.freebsd.org/where.html
Ok, so this isn’t exactly a download link, but it takes you to where you choose your architecture. Click on the [ISO] link next to your Architecture type.
If you are a newbie and don’t know your architecture, you probably want i386. If you just bought a new 64 bit machine then you want amd64.
Ok, so the actually link you want is the one that looks as follows:
For amd64 – 8.0-RELEASE-amd64-dvd1.iso.gz
For i386 – 8.0-RELEASE-i386-dvd1.iso.gz
- Extract it as it is zipped.
- Burn the ISO to DVD disk (or if you are using VMWare just point your VM’s CD-ROM at the ISO).
- Boot off the FreeBSD 8 DVD and let it boot all the way up.
- Choose your country/region.
You should now be at the Sysinstall Main Menu. Remember, we cannot use Sysinstall because it doesn’t yet support ZFS. (I am hoping for a new installer over fixing this old one.)
- Choose Fixit. You will be promted to Please choose a fixit option.
- Choose CDROM/DVD.
You are now at a Fixit command prompt. And if you are following the wiki guide, you are only at that guide’s step 3. Create MBR disk
- Create an MBR disk by running the following command:
However, what the guide assumes you already know is that
ad0is the name of your hard drive and can be different for each installation. I am installing on VMWare using SCSI and the name of my hard drive is
da0. So I would run:
You can find out your by looking at a directory listing of /dev if you are familiar with common names, otherwise, you can start a Standard install and see what name is used when you get to the Disk label editor section of the install.
I am going to use da0 or ad0 in the rest of my document interchangeably, so you need to remember to always use the correct disk name for your drive.
- Run the following command to show the information for your disk
There are two columns of numbers. The first column number is a start block for the slice and the second is the size in blocks for the slice. 63 is the start of every first slice. However, the end of a slice is variable depending on the size of your hard drive.
A slice is not exactly a partition. On FreeBSD you first create a Slice and then you create your partitions on your slice. The next steps will show you have to do both.
- Create a new Slice using the entire disk.
Obviously the guy who wrote the wiki I am following already had two slices for windows, so he must have been dual booting. I am assuming that you are not dual booting and that you are installing a new server and you plan to use the entire disk.
To create a slice using the entire disk, run this command replacing the value after the -s with the value you saw when you ran the previous command.
It will output something like “da0s1 added”. If you look at the da0s1 string, it makes sense. da0 (your disk name) s1 (slice 1 – the slice you just created).
- Now lets create our slice. No, I am not sure why you have to both add the slice and create the slice, but I am sure there is a good reason.
- Lets make our slice the active slice. Sounds like this is only sometimes needed. Better to do it and not need it than to not do it an find out you need it.
You can run the gpart show da0 command again to make sure it is set as active.
- Look at the slice.
Again, you will have two rows of numbers. This time the first number is 0 and the second number is the size of the slice.
We want at least two partitions, one for
/and one as a swap partition. So we need to determine how much space we want for the
swappartition. I want 3 GB.
Now we have to convert the desired size from GB to sectors.
1 kilobyte = 1024 bytes or 2 sectors (Sectors are normally 512 Bytes)
1 megabyte = 1024 kilobytes
1 gigabyte = 1024 megabytes
So to get the number of sectors in 1 GB, we need to use the following equation:
Gigabytes in Sectors = NumberOfGB * numberOfMBInAGB * NumberOfKBInAMB * NumberOfSectorsInAKB
1 GB in sectors = 1 * 1024 * 1024 * 2 = 2097152
3 GB in sectors = 3 * 1024 * 1024 * 2 = 6291456
So take the total size of your slice in sectors and subtract 6291456 and you will have the size of your
/partition. And our
swappartition will be 6291456.
- Create your
- Create the
- Load the ZFS kernel module.
- Create your zpools.
- Install the boot manager.
- Install ZFS boot.
Yeah we are done with step 1. Stay tuned for step 2 and step 3 coming.
… I am back for round 2…er uh…step 2 that is.
Step 2. Installing FreeBSD to the ZFS filesystem
Ok for those of you who skipped the details above, I am reading this wiki:
My intention is to make a more thorough and newbie proof version of this wiki. So here we go, diving into step 2.
- Create the ZFS hierarchy.
Wow, this is going to be a lot of tedious typing. You know, while FreeBSD didn’t make an installer for all this, how hard would it have been to create a couple of scripts and include them on the CD so this would be easier.
Warning! There is only one line that might catch a newbie off-guard. Every other line you can type in as is but this one.
On FreeBSD this is how you setup your network card to use FreeBSD. However, while my card is
em0, not all cards are em0. Run the ifconfig command on FreeBSD to see your card type and replace
em0 with the type for you card.
Step 3 – Finish
I followed the guide almost exactly except I had to do a cd / before unmounting. So I added that command where it needs to be, so this should be very newbie proof.
- Run these commands.
I made some mistakes but finally got it to work.