Re: ZFS: amd64, devd, root file system.

From: Pawel Jakub Dawidek <pjd_at_FreeBSD.org>
Date: Mon, 9 Apr 2007 11:43:19 +0200
On Mon, Apr 09, 2007 at 03:17:23AM +0200, Pawel Jakub Dawidek wrote:
> 3. It is now possible to have root file system on ZFS. You would still
>    need UFS for your /boot/ file system.

Let me explain how this suppose to work.

You have ad0 disk. Create one slice covering entire disk:

	# fdisk -BI /dev/ad0

Initialize BSDlabel:

	# bsdlabel -wB /dev/ad0s1

Edit your label and create small (like 256MB-512MB) 'a' partition and
use the rest for 'd' partition:

	# bsdlabel -e /dev/ad0s1

'd' partition will be used for ZFS:

	# zpool create tank ad0s1d

Create UFS file system on /dev/ad0s1a and copy /boot/ directory in
there:

	# newfs /dev/ad0s1a
	# mount /dev/ad0s1a /mnt/tmp
	# cp -Rp /boot/* /mnt/tmp/

Note that there is no /boot/ directory on ad0s1a yet. This is one of the
two possibilities. You now need to create symlink:

	# cd /mnt/tmp
	# ln -s . boot

From what I checked our loader should handle symlinks just fine.
This will allow us to mount /dev/ad0s1a on /boot directory and use it as
usual.

Another option is to:

	# cp -Rp /boot /mnt/tmp/

and in the future mount /dev/ad0s1a on eg. /bootdisk and create symlink:

	# ln -s bootdisk/boot /boot

All in all, you should see your kernel when you do:

	# ls -l /mnt/tmp/boot/kernel

Now don't forget to add zfs_load="YES" to /mnt/tmp/boot/loader.conf.

Ok, you also need to tell your loader where your root file system is.
You can do it by adding:

	vfs.root.mountfrom="zfs:tank"

to /mnt/tmp/boot/loader.conf or you can create /mnt/tmp/etc/fstab file
with one entry only:

	tank	/	zfs	rw	0	0

On your ZFS file system, your /etc/fstab should contains the line above
and:

	/dev/ad0s1a	/boot	ufs	rw	0	0

(and everything else, ie. your swap and other file systems)

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd_at_FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Received on Mon Apr 09 2007 - 07:43:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:08 UTC