Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Feb 2012 14:25:52 -0500
From:      Kurt Lidl <lidl@pix.net>
To:        Gavin Mu <gavin.mu@gmail.com>
Cc:        freebsd-sparc64@FreeBSD.org
Subject:   Re: sparc64/165025: [PATCH] zfsboot support for sparc64
Message-ID:  <20120212192552.GA55852@pix.net>
In-Reply-To: <201202121530.q1CFU8fH047653@freefall.freebsd.org>
References:  <201202121530.q1CFU8fH047653@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 12, 2012 at 03:30:08PM +0000, Gavin Mu wrote:
> The following reply was made to PR sparc64/165025; it has been noted by GNATS.
> 
> From: Gavin Mu <gavin.mu@gmail.com>
> To: Marius Strobl <marius@alchemy.franken.de>
> Cc: bug-followup@freebsd.org
> Subject: Re: sparc64/165025: [PATCH] zfsboot support for sparc64
> Date: Sun, 12 Feb 2012 22:59:12 +0800
> 
>  >> Known Limitations:
>  >> 1. only zpool on a whole disk is supported, zfs boot from zpool in VTOC8 partitions may not work.
>  >
>  > Uhm, are you sure you didn't have (the remnants) of a VTOC label on
>  > the disk? I'd expect the firmware to refuse to boot from a disk not
>  > having one.
>  Sorry, it is my fault not writing this here. A fake VTOC8 label is
>  still required, and it is not conflict with zpool on the whole disk,
>  since ZFS reserved the first 8KB block unused. the VTOC8 table and
>  boot1 (or zfsboot) code can be in this 8KB block. command `zpool
>  create` will not destroy the VTOC8 table and the boot1 code.
>  >
>  >> 2. boot from mirror/raidz is not supported due to limited dev environment.
>  >
>  > Could you also tackle these remaining bits or at least describe what
>  > it would take to support booting from a zpool in a VTOC label, mirror
>  > and raidz?
>  I do not have enough hardware to test booting from mirror/raidz disks,
>  so I focus only on booting from one single disk in this PR.
>  The default zfs_dev.dv_init() traverse all possible disks and
>  slices/partitions to find all zpool vdev, I simply changed the
>  behavior to read from one single disk only then it is easy to know
>  which zpool should be used to boot (there will be only one). To
>  support booting from mirror/raidz, all disks/slices must be traversed
>  and it is needed to decide which zpool to boot.
>  
>  booting from a zpool in VTOC8 label should be possible for me to do
>  dev/test, I need a little more VTOC8 knowledge and will try it later.
>  >
>  >>
>  >> >How-To-Repeat:
>  >> NA.
>  >> >Fix:
>  >> generic steps:
>  >> 1. build zfsboot and zfsloader
>  >> 2. create zpool on your disk
>  >> # zpool create tank /dev/<your disk, ie. ada0>
>  >> 3. export the zpool
>  >> # zpool export tank
>  >> 4. install zfsboot
>  >> # dd if=boot1 of=/dev/<your disk, ie. ada0> bs=512 skip=1 oseek=1 conv=notrunc
>  >
>  > Assuming there is a VTOC8 label, this could also be done using `gpart -b`,
>  > no?
>  Yes, but I think we should keep the zpool exported, otherwise this
>  command may fail.

I think you actually want to do this:

gpart bootcode -p /boot/boot1 ${disk}

There isn't really "boot0" type code for sparc64, as you know, but
there is partition code ("boot1").

I think the introduction of booting from ZFS on sparc64 hardware
is a very exciting development.  I had just recently gone through
the process of installing FreeBSD 9.0 onto a mostly ZFS sparc64
setup -- just using UFS for the boot filesystem.  One of the things
that I worked out was how to do it all with 'gpart' and not having
to rely on "sunlabel", "dd", etc...  Ironically, the day after I
figured out most of this stuff, there as a pointer to a guide written
in German that explained a bunch of it posted to the mailing list:

http://lists.freebsd.org/pipermail/freebsd-sparc64/2011-November/008112.html

Anyway...

for disk in da0 da1
do
    for i in 1 2 4 5 6 7
    do
        gpart delete -i $i ${disk}
    done
    gpart destroy ${disk}
    gpart create -s vtoc8 ${disk}
    gpart add -t freebsd-ufs -s 1g ${disk}
    gpart add -t freebsd-swap -s 16g ${disk}
    gpart add -t freebsd-zfs ${disk}
    # put bootcode at start of root partition
    gpart bootcode -p /boot/boot1 ${disk}
done

[ then stuff about setting up the gmirror etc]

-Kurt



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