disk partitioning with gmirror + gpt + gjournal (RFC)

Alfred Bartsch bartsch at dssgmbh.de
Tue Oct 18 07:05:01 UTC 2011


I am going to use the following paritioning scheme on our servers and
programmers' workstations running FreeBSD 8 (system disk):
physical drive - geom_mirror - geom_part_gpt - journaled UFS
with separate boot and swap partitions.
Partition names and sizes are taken from our environment - Your
requirements may vary.
Main design goal: minimization of data recovery time after unclean
shutdown - using software raid-1.

Installation steps of a (bootable) system disk (after cleaning):
note: <disk0>= first disk device, <disk1>= second disk device,
      gm0= first gmirror, gm1= second gmirror, etc.

label the disk
# gmirror label -b load -F gm0 <disk0>
# gpart create -s GPT mirror/gm0

create boot partition
# gpart add -t freebsd-boot -s 128 mirror/gm0
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 mirror/gm0
note: if installing from CD/DVD, bootcode is in /dist/boot/pmbr

create the swap partition
# gpart add -t freebsd-swap -s 4200M mirror/gm0

create the journal partitions
# gpart add -t freebsd-swap -s 1G mirror/gm0
# gpart add -t freebsd-swap -s 2G mirror/gm0
# gpart add -t freebsd-swap -s 2G mirror/gm0
# gpart add -t freebsd-swap -s 2G mirror/gm0

create the (journaled) data partitions:
root partition
# gpart add -t freebsd-ufs -s 1G mirror/gm0
# gjournal label mirror/gm0p7 mirror/gm0p3
note: IMHO journal size doesn't need to exceed data size

var partition
# gpart add -t freebsd-ufs -s 4G mirror/gm0
# gjournal label mirror/gm0p8 mirror/gm0p4

usr partition
# gpart add -t freebsd-ufs -s 16G mirror/gm0
# gjournal label mirror/gm0p9 mirror/gm0p5

home partition (covers remaining disk space)
# gpart add -t freebsd-ufs mirror/gm0
# gjournal label mirror/gm0p10 mirror/gm0p6

create the UFS file systems (with labels):
# newfs -L fbsdroot -J mirror/gm0p7.journal
# newfs -L fbsdvar  -J mirror/gm0p8.journal
# newfs -L fbsdusr  -J mirror/gm0p9.journal
# newfs -L fbsdhome -J mirror/gm0p10.journal

mirroring the disk:
gmirror insert gm0 <disk1>

/etc/fstab could then look like
# Device            Mountpoint  FStype  Options          Dump    Pass#
/dev/mirror/gm0p2   none        swap    sw               0       0
/dev/ufs/fbsdroot   /           ufs     rw,noatime,async 1       1
/dev/ufs/fbsdhome   /home       ufs     rw,noatime,async 2       2
/dev/ufs/fbsdusr    /usr        ufs     rw,noatime,async 2       2
/dev/ufs/fbsdvar    /var        ufs     rw,noatime,async 2       2
=====================================================================


Some questions:
Is this disk configuration valid and robust? (I've just started testing)
Are there any other proposals - usable as "best known practice", I
didn't find a complete setup so far?

As the journal size primarily depends on writing speed, needed journal
sizes will necessarily grow in the future, because each journal
partition must be able to hold all possible changes at a given time
interval (10 seconds?). So physical journal size has to be adjusted
during migration onto faster hardware (SSD).
I would then preferably use just one (suitable) journal partition for
multiple data partitions. Could this feature be added to gjournal with
an appropiate amount of work?

Are there any comments on or additions to these topics?
-- 
Alfred Bartsch
Data-Service GmbH


More information about the freebsd-geom mailing list