# How do I set/change partition mountpoints?



## troberts (May 21, 2011)

I have a dedicated partition for my ports tree and its mountpoint is currently /usr/ports, but after reading hier(7), which says the default location for the ports collection is /usr/local/ports, I want to change it to /usr/local/ports. The confusing part is portsnap.conf says the default location is /usr/ports.

In case it helps, I used BSDInstall to set up my system. I dropped into the shell to manually set the partitions so they would be aligned, then I exited the shell after I finished. I then selected the option that would guide me in creating my partitions, but the only thing I did there was to enter the mountpoints. FreeBSD installed with no problems so I decided to update the sources and rebuild world. The buildworld stopped because I as out of swap space so I wiped the partitions and made swap 3GB and buildworld stopped in the same spot with the same error. I decided not to mess with FreeBSD-CURRENT so I downloaded the sources for FreeBSD8-STABLE and I was successful in completing the buildworld process.

Am I having problems because I setup my partitions with FreeBSD-CURRENT, but am now using FreeBSD8-STABLE? I have looked at newfs(8), tunefs(8), and gpart(8), but I could not find where they say how to set/change mountpoints.


----------



## wblock@ (May 21, 2011)

/usr/ports is correct.  Look at hier(7) again.  The ports tree is usually not a separate filesystem anyway, just another directory in /usr.

It should not matter whether partitions were created with -current or -stable.  Make / at least 1G, and at least 4G swap is a good thing unless the disk is extremely limited for space.

/etc/fstab is where the system gets predefined filesystem mount points.


----------



## troberts (May 23, 2011)

Well, now that I (think) I figured out my problem, I feel stupid. My fstab looked like the following:


```
# Device	Mountpoint	FStype	Options	Dump	Pass#
/dev/ad0p2	/		ufs	rw	1	1
/dev/ad0p4	/var		ufs	rw	2	2
/dev/ad0p5	/tmp		ufs	rw	2	2
/dev/ad0p6	/usr		ufs	rw	2	2
/dev/ad0p7	/usr/local	ufs	rw	2	2
/dev/ad0p8	/usr/ports	ufs	rw	2	2
/dev/ad0p9	/usr/src	ufs	rw	2	2
/dev/ad0p10	/usr/obj	ufs	rw	2	2
/dev/ad0p11	/usr/home	ufs	rw	2	2
/dev/ad0p12	/workdir	ufs	rw	2	2
```

When installing FreeBSD, I was asked for the mountpoints of the partitions so I mistakenly thought fixed locations are created, similar to how Windows assigns drive letters, which is why I asked how to set/change a partition's mountpoint. I thought that if I assigned /dev/ad0p8 a mountpoint of /usr/local/ports then anything written to it would end up on /dev/ad0p7, instead of /dev/ad0p8, like I want.

After I unmounted /dev/ad0p8 and used ls to see what was in /usr I saw that /usr/ports still existed, which got me curious, so I created the directory /usr/ports/testdir. After mounting /dev/ad0p8 and looking in /usr/ports, I saw my ports tree, but no testdir. I unmounted /dev/ad0p8, looked in /usr/ports and saw no ports tree, but I did see testdir. It was then I figured out partition mountpoints, which are just directories, take the place of directories that already exists.

P.S. Some clarification about ports collection/framework found in hier(7), please

```
local/	  local executables, libraries, etc.  Also used as the
			  default destination for the FreeBSD ports framework.
			  Within local/, the general layout sketched out by
			  hier for /usr should be used.  Exceptions are the
			  man directory (directly under local/ rather than
			  under local/share/), ports documentation (in
			  share/doc/<port>/), and /usr/local/etc (mimics
			  /etc).
		obj/	  architecture-specific target tree produced by build-
			  ing the /usr/src tree
		ports/	  The FreeBSD ports collection (optional).
```
If the ports collection is what you get when you use portsnap, then what is the ports framework?


----------



## wblock@ (May 23, 2011)

The ports "collection", "framework", and "tree" are all the same thing, a directory of ports files (see the Handbook chapter on ports).  In that snippet from hier(7), local/, obj/, and ports/ are all at the same level.  Scroll up to see that they're all in /usr.


----------

