Gjournal

From TykWiki
Revision as of 14:24, 22 February 2009 by Tykling (talk | contribs)
Jump to navigationJump to search

Journaling system partitions on the boot disk

Sysinstall doesn't currently have a way to install FreeBSD to a journaled device. You will need to create extra partitions to contain the journals in the partitioning part of the sysinstall process. The handbook does not recommend journaling small file systems, so /usr and /var are candidates for journaling on a default partition scheme. The recommended approach is to create extra swap partitions to contain the journals in sysinstall, and after the installation is completed to remove the extra swap partitions from /etc/fstab so they won't be used for swap, and reboot. You need one journal partition per partition you want journaling enabled on, so in the default case two extra swap partitions should be created. The size depends on the expected load on the file system, not the size of the file system. A very busy file system needs to have a journal 3.3x the size of available system memory. More on journal sizes [here]. So, step by step:

  1. Install FreeBSD as you normally would, but create an extra swap partition per partition you want journaled. After the install remove the extra swap partitions from fstab. Also add
  2. Use the following approach for each partition you want journaled, substituting the device names for your own of course. In this example the data partition normally mounted on /var is ad0s1d and the journal partition is da0s1e:

Start journaling da0s1d using da0s1e as the journal partition:

gjournal label -f da0s1d da0s1e

Enable journaling on the new filesystem, and disable soft updates:

tunefs -J enable -n disable da01sd.journal

Mount the new journaled filesystem:

mount -o async /dev/da0s1d.journal /var

All that remains is to change the entry for /var in /etc/fstab to point to the new journaled device /dev/da0s1d.journal. Remember to also add async to the mount options, so they read rw,async instead of just the default rw.