Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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