From owner-freebsd-current@FreeBSD.ORG Thu Oct 22 01:16:37 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33D05106568F for ; Thu, 22 Oct 2009 01:16:37 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id E3B408FC14 for ; Thu, 22 Oct 2009 01:16:36 +0000 (UTC) Received: from [192.168.1.4] (adsl-154-198-93.ard.bellsouth.net [72.154.198.93]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n9M1GY2H084936 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 21 Oct 2009 21:16:34 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Aristedes Maniatis In-Reply-To: <4ADE995A.8080009@ish.com.au> References: <4ADE995A.8080009@ish.com.au> Content-Type: text/plain Organization: FreeBSD Date: Wed, 21 Oct 2009 20:16:28 -0500 Message-Id: <1256174188.2309.22.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC, SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: freebsd-current@freebsd.org, Jurgen Weber Subject: Re: gpart, bsdlabel and fdisk X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2009 01:16:37 -0000 On Wed, 2009-10-21 at 16:17 +1100, Aristedes Maniatis wrote: > We are setting up a FreeBSD system from scratch and wanting to understand the new gpart utility. Our goal is to create a ZFS bootable install (mirror). In the past our approach has been to: > > 1. fdisk (allocate entire disk) > 2. partition (1Gb UFS boot partition, swap and rest empty for ZFS) > 3. set up ZFS [1] Make sure that your loader has zfs support. Setting LOADER_ZFS_SUPPORT="YES" in make.conf will take care of it. gpart create -s GPT gpart add -t freebsd-boot -s 128 gpart add -t freebsd-swap -s XXX[mg] gpart add -t freebsd-zfs gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 [I committed a patch that will set the active flag when you install bootcode, but it is only in -CURRENT so far. zpool create [mirror, raidz] ... If you want more than a single root filesystem: zfs create You will need 3 other steps... Now, install FreeBSD. I generally bootstrap from a running system, so I just stick the disks in and "make installworld DESTDIR=/pool && make installkernel DESTDIR=/pool" followed by a "mergemaster -i -D /pool" You need to install a cache in /boot/zfs/zpool.cache on the new filesystem. I generally do this by setting "zpool set cachefile=/tmp/.cache and then copying that to /boot/zfs/zpool.cache. After that, I usually set "zfs set mountpoint=legacy " which will unmount the filesystem. The gpart piece is really easy, once you get the hang of it... Setting up zfs root on a new machine is mostly tricky because you need to make sure that you have a working loader. robert. > Now we want to understand how to avoid the bootable UFS partition (which causes us some grief), but there is very little information about gpart as the tool to do it. I've found various guides (eg [2]) but am a little underwhelmed by the documentation, especially with magic commands like this as part of the set up: > > echo 'a 1' | fdisk -f - /dev/ad4 > > It appears that gpart is largely replacing fdisk and bsdlabel. > > * is this the future for FreeBSD and we should use gpart from here on? Are the old tools deprecated? > > * we tried to reinstall the machine with some 7.2 CDs but the gparted disks caused fdisk to crash. Is this expected? > > * is the result of using gpart completely different to the bsdlabel/fdisk we've known? Are the partitions on disk quite different? > > * is there some source of good documentation out there other than the man page for gpart? > > * has the MBR changed now with gpart? > > > Thanks > > Ari Maniatis > > > [1] https://www.ish.com.au/solutions/articles/freebsdzfs > [2] http://outpost.h3q.com/patches/manageBE/create-FreeBSD-ZFS-bootfs.txt -- Robert Noland FreeBSD