2

On the latest FreeBSD installation, how can I make a partition have both /var/ and /tmp/ as a mount point? That is, one partition would contain /var/ and /tmp/. Is that even possible? I know of course that a mount point of / will contain everything not specified, but can I specifically say /dev/ad0p3/ has /tmp/ and /var/ as a mount point?

1

You can use one of these 2 techniques for doing this. They're highlighted in this post titled: Mount multiple directories to the same partition?.

Method #1

Boot from another system (e.g. a LiveCD) and mount your /var partition and do this as root:

cd /mnt/var
mkdir -m755 .newvar
mv * .newvar # won't try to move .newvar because it begins with a period
mv .newvar var # rename .newvar to var
mkdir -m1777 tmp # make a tmp dir

Now specify a mountpoint for the entire partition in your /etc/fstab:

/mnt/ignore_me/var /var none bind
/mnt/ignore_me/tmp /tmp none bind

Method #2

Keep mounting the /var partition as you are currently, but do this as root:

cd /var
mkdir -m1777 .tmpdir # make a hidden /var/.tmpdir

NOTE: notice that /var/tmp is something different.

Add the following to your /etc/fstab, after the lines that mount /var:

/var/.tmpdir /tmp none bind

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.