When I installed FreeBSD 7.2, instead I chose the following layout...
/
/usr
... and then I moved /var and /tmp to /usr/.
And after that, symlinking: /var -> /usr/var /tmp -> /usr/tmp
Most probably there are arguments against this layout, but I prefer the advantages of having a bigger /usr partition instead of waisting space on separate /var and /tmp partitions. Another advantage is that the risk of causing a full file system on /var (for example by a big temporary file such as a kernel dump) is smaller on a big partition. Anyway, filling up the root partition with temporary files is never a good idea, so /var and /tmp should not be left on the root partition, but moved to /usr/ instead.
Boot/reboot FreeBSD into Single User Mode (boot menu option 4 on FreeBSD 7.2).
When prompted Enter full pathname of shell or RETURN for /bin/sh:
Press ENTER to enter the shell.
Then execute the following commands:
mount -u / # re-mount root partition as read-write
mount -a # mount all partitions in fstab
chflags noschg /var/empty # unset the schg flag for /var/empty
mv /var /usr/ # move /var to /usr/, be prepared for lots of ... is a socket (not copied). messages!
chflags schg /usr/var/empty # set the schg flag for /usr/var/empty
mv /tmp /usr/ # move /tmp to /usr/
cd / # prepare for symlinking
ln -s /usr/var # symlink /var
ln -s /usr/tmp # symlink /tmp
Done!
Then, either
exit # exit to multiuser mode
or
reboot # reboot the system
to start using /usr/var and /usr/var.
Note:
The schg flag is used to assure that nobody, not even root, will modify a file or directory.
Use ls -lo to display flags set by chflags:
$ ls -lo /var/
total 46
drwxr-xr-x 2 root wheel - 512 May 1 08:53 account
drwxr-xr-x 4 root wheel - 512 May 1 10:59 at
drwxr-x--- 2 root audit - 512 May 1 08:53 audit
drwxr-x--- 2 root wheel - 512 May 10 03:01 backups
drwxr-xr-x 4 root wheel - 512 May 5 07:35 cache
drwxr-x--- 2 root wheel - 512 Jun 1 12:13 crash
drwxr-x--- 3 root wheel - 512 May 1 10:59 cron
drwxr-xr-x 11 root wheel - 512 May 6 00:52 db
dr-xr-xr-x 2 root wheel schg 512 May 1 08:53 empty
drwxrwxr-x 2 root games - 512 May 5 02:59 games
drwxrwx--T 2 root gdm - 512 May 5 02:30 gdm
drwx------ 2 root wheel - 512 May 1 08:53 heimdal
drwxr-xr-x 9 root wheel - 512 May 9 16:22 lib
drwxr-xr-x 5 root wheel - 1536 Jun 3 00:00 log
drwxrwxr-x 2 root mail - 512 Jun 2 03:04 mail
drwxr-xr-x 2 daemon wheel - 512 May 5 01:05 msgs
drwxr-xr-x 5 root wheel - 512 May 5 02:50 named
drwxr-xr-x 2 root wheel - 512 May 1 08:53 preserve
drwxr-xr-x 12 root wheel - 512 Jun 2 21:48 run
drwxrwxr-x 2 root daemon - 512 May 1 08:53 rwho
drwxr-xr-x 9 root wheel - 512 May 5 07:35 spool
drwxrwxrwt 27 root wheel - 1536 Jun 2 23:16 tmp
drwxr-xr-x 2 root wheel - 512 May 5 02:50 yp