nutznboltz
June 10th, 2004, 09:58
I just upgraded a box from FreeBSD-4-STABLE to FreeBSD-5.2.1-RELEASE for the first time. I used CVS to get the RELENG_5_2 branch and then compiled and installed the source code. Don't try this yourself unless you are will to muck with the bootstrap changeover.
During the upgrade the I noticed that I was now using the root filesystem for /tmp space since the FreeBSD-4-STABLE used mfs /tmp space. Can't do that on Fbsd-5 so I came up with a script you can drop into /etc/rc.d to use md /tmp. That way you can have faster /tmp space.
$ cat /etc/rc.d/md_tmp
#! /bin/sh
# PROVIDE: tmp
# REQUIRE: addswap
# BEFORE: sysctl
# KEYWORD: FreeBSD
. /etc/rc.subr
name="md_tmp"
start_cmd="md_tmp_start"
stop_cmd=":"
md_tmp_start()
{
mdconfig -a -t swap -s 256M -u 10
newfs -U /dev/md10
mount /dev/md10 /tmp
chmod 1777 /tmp
}
load_rc_config $name
run_rc_command "$1"
in operation:
$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 126M 56M 60M 48% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/da0s1e 252M 60M 172M 26% /var
/dev/da0s1f 9.8G 5.0G 4.0G 56% /home
/dev/da0s1g 24G 5.1G 17G 23% /usr
procfs 4.0K 4.0K 0B 100% /proc
/dev/md10 252M 16K 232M 0% /tmp
During the upgrade the I noticed that I was now using the root filesystem for /tmp space since the FreeBSD-4-STABLE used mfs /tmp space. Can't do that on Fbsd-5 so I came up with a script you can drop into /etc/rc.d to use md /tmp. That way you can have faster /tmp space.
$ cat /etc/rc.d/md_tmp
#! /bin/sh
# PROVIDE: tmp
# REQUIRE: addswap
# BEFORE: sysctl
# KEYWORD: FreeBSD
. /etc/rc.subr
name="md_tmp"
start_cmd="md_tmp_start"
stop_cmd=":"
md_tmp_start()
{
mdconfig -a -t swap -s 256M -u 10
newfs -U /dev/md10
mount /dev/md10 /tmp
chmod 1777 /tmp
}
load_rc_config $name
run_rc_command "$1"
in operation:
$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 126M 56M 60M 48% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/da0s1e 252M 60M 172M 26% /var
/dev/da0s1f 9.8G 5.0G 4.0G 56% /home
/dev/da0s1g 24G 5.1G 17G 23% /usr
procfs 4.0K 4.0K 0B 100% /proc
/dev/md10 252M 16K 232M 0% /tmp