Date: Wed, 21 Oct 2009 20:16:28 -0500 From: Robert Noland <rnoland@FreeBSD.org> To: Aristedes Maniatis <ari@ish.com.au> Cc: freebsd-current@freebsd.org, Jurgen Weber <jurgen@ish.com.au> Subject: Re: gpart, bsdlabel and fdisk Message-ID: <1256174188.2309.22.camel@balrog.2hip.net> In-Reply-To: <4ADE995A.8080009@ish.com.au> References: <4ADE995A.8080009@ish.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <disk> gpart add -t freebsd-boot -s 128 <disk> gpart add -t freebsd-swap -s XXX[mg] <disk> gpart add -t freebsd-zfs <disk> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 <disk> [I committed a patch that will set the active flag when you install bootcode, but it is only in -CURRENT so far. zpool create <pool> [mirror, raidz] <disk> <disk> ... If you want more than a single root filesystem: zfs create <filesystem> 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/<poolname>.cache and then copying that to /boot/zfs/zpool.cache. After that, I usually set "zfs set mountpoint=legacy <pool>" 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 <rnoland@FreeBSD.org> FreeBSD
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1256174188.2309.22.camel>