Using bsdinstall for an additional drive

Michael Sierchio kudzu at
Sun Dec 8 19:11:48 UTC 2013

I think it's worth the effort to try to understand gpart et al.

If you have a new disk, DISK=ad4, for example

# remove any possible existing data at beginning and end of disk (this
is just an example)

offset=`diskinfo $DISK | awk '{ print $4 - 131072 }'`
dd if=/dev/zero of=/dev/$DISK bs=64k count=1
dd if=/dev/zero of=/dev/$DISK bs=64k seek=$offset

The following is for a boot drive, with some fixed ideas about
partitions, but is possibly useful as an example.  The assumption here
is alignment to 64k boundaries. If you don't need a bootable drive,
just skip the parts for that.  You could create one big partition, if
that's what you want, with just the last bit.

# create partition table
gpart create -s gpt ${DISK}

# add boot partition
# p1
gpart add -t freebsd-boot -l boot -s 64k ${DISK}

# put boot code in boot partition
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ${DISK}

# add 1G root, make sectors aligned
# p2
gpart add -t freebsd-ufs -l root -a 64k -s 1G ${DISK}

# add 2G swap
# p3
gpart add -t freebsd-swap -l swap -a 64k -s 2G ${DISK}

# add 1G tmp
# p4
gpart add -t freebsd-ufs -l tmp -a 64k -s 1G ${DISK}

# add 2G var
# p5
gpart add -t freebsd-ufs -l var -a 64k -s 2G ${DISK}

# add 2G opt
# p6
gpart add -t freebsd-ufs -l opt -a 64k -s 2G ${DISK}

# add remainder of disk for usr
# p7
gpart add -t freebsd-ufs -l usr -a 64k ${DISK}

On Sun, Dec 8, 2013 at 10:25 AM, Doug Hardie <bc979 at> wrote:
> I have a running 9.2 system that I need to add another drive to.  With sysinstall it was easy (once you understood it) to add a new drive.  However, I have not figured out how to do that with bsdinstall.  I don't want to experiment much as the running system would take forever to rebuild.  Is there a way to do this without affecting the existing system?
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list