Image of grog
Greg's setting up disks with gpart
Greg's diary
Greg's home page
HOWTO index


This is roughly what I do to create a new system disk. The sizes can change.

DRIVE=ada1    # Note that you *must* omit the /dev/
gpart destroy -F $DRIVE
# Create GPT
gpart create -s gpt $DRIVE
# p1
gpart add -s 64k -t freebsd-boot $DRIVE
# Install boot loader.  Note that -i is the partition number :-(
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 $DRIVE
# First root file system, p2
gpart add -s 40g -t freebsd-ufs $DRIVE
# Swap, p3
gpart add -s 20g -t freebsd-swap $DRIVE
# Second root file system, p4
gpart add -s 40g -t freebsd-ufs $DRIVE
# /home file system, p5
gpart add -t freebsd-ufs $DRIVE
gpart show $DRIVE

File systems

To find out the parameters of an existing file system, run dumpfs -m. Don't trust everything it says.

DRIVE=/dev/ada1    # This time we need the /dev/
newfs -O 2 -j -L root ${DRIVE}p2
newfs -O 2 -j -L root2 ${DRIVE}p4
# For /home we need many strange parameters
# -L: set label
# -O 2: UFS 2
# -U: Enable soft updates
# -a 64: maxcontig
# -b 32768     block size
# -d 32768     max extent size
# -e 4096      blocks per cylinder group
# -f 4096      frag size (automatic)
# -g 131072    average file size
# -h 64        average number of files in a directory
# -i 131072    Inode density (average file size)
# -j           Set SU journalling
# -k 1152      Space for metadata blocks
# -m 8         Percentage free space (8 is default)
# -o space     Optimize for space, OR
# -o time      Optimize for time
newfs -L home -O 2 -U -a 64 -b 32768 -d 32768 -e 2048 -f 4096 -g 131072 -h 64 -i 131072 -j -k 1152 -o time ${DRIVE}p5
# old eureka:/home:
# newfs -O 2 -U -a 4 -b 32768 -d 32768 -e 4096 -f 4096 -g 131072 -h 64 -i 131072 -k 9008 -m 8 -o time -s 5787132776 /dev/ada1p2

Greg's home page Greg's diary Greg's photos Copyright

Valid XHTML 1.0!

$Id: gpart.php,v 1.3 2019/02/09 04:03:02 grog Exp $