Re: [SOLVED]Re: How to create ZFS on Root using MBR slices?

From: Olivier SMEDTS <olivier_at_gid0.org>
Date: Sun, 12 Jul 2009 16:56:35 +0200
2009/7/12 Scot Hetzel <swhetzel_at_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.  I did have to set
> exec=on 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
>  and 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=yes
# make -j4 buildkernel
# zpool destroy tank
# gpart delete -i 2 ada0
# gpart add -b 104856255 -s 209712510 -t freebsd -i 2 ada0
# dd if=/dev/zero of=/dev/ada0s2 bs=512 count=64
# gpart create -s BSD /dev/ada0s2
# gpart add -t freebsd-zfs ada0s2
# zpool create -R /mnt tank ada0s2a
# zpool export tank
# dd if=/boot/zfsboot of=/dev/ada0s2 bs=512 count=1
# dd if=/boot/zfsboot of=/dev/ada0s2a bs=512 skip=1 seek=1024
# zpool import -o altroot=/mnt tank
# zfs create tank/freebsd
# zpool set bootfs=tank/freebsd tank
# zfs create -V 2G tank/swap
# zfs set org.freebsd:swap=on tank/swap
# zfs set checksum=off tank/swap
# make installworld DESTDIR=/mnt/freebsd/
# make installkernel DESTDIR=/mnt/freebsd/
# make distribution DESTDIR=/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="YES"
vfs.zfs.prefetch_disable="1"
vfs.root.mountfrom="zfs:tank/freebsd"
EOF
# touch /mnt/freebsd/etc/fstab
TODO : tmpfs
# cat << EOF > /mnt/freebsd/etc/rc.conf
zfs_enable="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.

Olivier


-- 
Olivier Smedts                                                 _
                                        ASCII ribbon campaign ( )
e-mail: olivier_at_gid0.org        - against HTML email & vCards  X
www: http://www.gid0.org    - against proprietary attachments / \

  "Il y a seulement 10 sortes de gens dans le monde :
  ceux qui comprennent le binaire,
  et ceux qui ne le comprennent pas."
Received on Sun Jul 12 2009 - 12:56:37 UTC

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