Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jul 2009 00:17:37 -0500
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Olivier SMEDTS <olivier@gid0.org>
Cc:        freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: [SOLVED]Re: How to create ZFS on Root using MBR slices?
Message-ID:  <790a9fff0907162217m7147077eob639aa5a0c8351e@mail.gmail.com>
In-Reply-To: <367b2c980907120756k3977ec5ah4e56d76dd4cfbd52@mail.gmail.com>
References:  <790a9fff0907101159w495b644dge4a4bd81de0bda9b@mail.gmail.com> <20090710211809.GA84773@crodrigues.org> <790a9fff0907101911y7143ed4bnbb050d78ebc21558@mail.gmail.com> <790a9fff0907110606t61da8ebbufa5575d12d949ca@mail.gmail.com> <367b2c980907111603t74766651gf52310d38dc48dd2@mail.gmail.com> <790a9fff0907111855md9de566n62926c0037606514@mail.gmail.com> <367b2c980907120756k3977ec5ah4e56d76dd4cfbd52@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 12, 2009 at 9:56 AM, Olivier SMEDTS<olivier@gid0.org> wrote:
> 2009/7/12 Scot Hetzel <swhetzel@gmail.com>:
>>> Can you successfuly boot this ZFS-Only FreeBSD on MBR slices ?
>>>
>> Yes, my system has successfully booted from the ZFS-Only Root
>> filesystem as outlined in
>> http://wiki.freebsd.org/ZFSOnRootWithZFSboot. =A0I did have to set
>> exec=3Don for the /var/tmp directory, otherwise it wouldn't let pkg_add
>> run the +INSTALL scripts from the package staging area in /var/tmp.
>>
>>> I tried the zfsboot trick few months ago and it didn't work for me.
>>> And it still doesn't work, I'm stuck at the loader with no prompt. I
>>> tried both with a BSD partition (freebsd-zfs type) and without,
>>> directly on the MBR slice.
>>>
>>
>> Did it get stuck at the Boot Manager menu (F1 - Win, F2 - FreeBSD,
>> ...) or did it show that it was running /boot/loader?
>>
>> If it was running /boot/loader, you need to make sure that
>> LOADER_ZFS_SUPPORT (add it to src.conf) was used to build /boot/loader
>> =A0and installed on your system.
>>
>> Also make sure that /boot/zfs/zpool.cache was copied to your ZFS zpool
>> (i.e zroot/boot/zfs/).
>
> I did both. Here is what I did exactly :
> # cd /usr/src
> # make -j4 buildworld LOADER_ZFS_SUPPORT=3Dyes
> # make -j4 buildkernel
> # zpool destroy tank
> # gpart delete -i 2 ada0
> # gpart add -b 104856255 -s 209712510 -t freebsd -i 2 ada0
> # dd if=3D/dev/zero of=3D/dev/ada0s2 bs=3D512 count=3D64
> # gpart create -s BSD /dev/ada0s2
> # gpart add -t freebsd-zfs ada0s2
> # zpool create -R /mnt tank ada0s2a
> # zpool export tank
> # dd if=3D/boot/zfsboot of=3D/dev/ada0s2 bs=3D512 count=3D1
> # dd if=3D/boot/zfsboot of=3D/dev/ada0s2a bs=3D512 skip=3D1 seek=3D1024
> # zpool import -o altroot=3D/mnt tank
> # zfs create tank/freebsd
> # zpool set bootfs=3Dtank/freebsd tank
> # zfs create -V 2G tank/swap
> # zfs set org.freebsd:swap=3Don tank/swap
> # zfs set checksum=3Doff tank/swap
> # make installworld DESTDIR=3D/mnt/freebsd/
> # make installkernel DESTDIR=3D/mnt/freebsd/
> # make distribution DESTDIR=3D/mnt/freebsd/
> # cp /boot/zfs/zpool.cache /mnt/freebsd/boot/zfs/
> # cp /boot/loader.conf /mnt/freebsd/boot/
> # cat << EOF >> /mnt/freebsd/boot/loader.conf
> zfs_load=3D"YES"
> vfs.zfs.prefetch_disable=3D"1"
> vfs.root.mountfrom=3D"zfs:tank/freebsd"
> EOF
> # touch /mnt/freebsd/etc/fstab
> TODO : tmpfs
> # cat << EOF > /mnt/freebsd/etc/rc.conf
> zfs_enable=3D"YES"
> EOF
> # zfs unmount tank
> # reboot
>
> I don't use the FreeBSD boot manager but grub. Loader does not output
> anything, and I can't abort it with a key. I tried with a GPT
> partition scheme on a USB key and it worked, but I couldn't manage to
> get it working with MBR slices. With or without BSD partitions inside
> the slice.
>
Oliver,

Going through your steps, I don't see either tank and tank/freebsd
being set to legacy:

zfs set mountpoint=3Dlegacy tank
zfs set mountpoint=3Dlegacy tank/freebsd

At first, I only set tank/freebsd to legacy, but it wouldn't mount the
tank/freebsd as the root filesystem.  When I changed tank to legacy,
the system mounted tank/freebsd as the root filesystem when booted.

Scot



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff0907162217m7147077eob639aa5a0c8351e>