Root partition and usrland on one slice, /usr/local ports and src on another
Jamie Landeg-Jones
jamie at dyslexicfish.net
Sat Nov 11 20:16:00 UTC 2017
lankfordandrew at charter.net wrote:
> So what I'd like to do is put the entire freebsd system on one fairly
> small, pristine slice, but put the more bloated and ephemeral src,
> ports, /usr/local, /home portions on one big slice. I tried symlinks
> between "/src" or "/usr/src" and "/usr/ports" and tweaking some build
I too had problems doing a similar thing. I remember ports wouldn't always
work in some situations (I can't remember the details now, it was years ago)
Anyway, this was my solution, using null-mounts:
Create 2 mountable partitions, "/" and another (say "/...")
Under /... create: (for example)
mkdir /.../mnt
mkdir /.../mnt/usr.local
mkdir /.../mnt/usr.src
mkdir /.../mnt/usr.ports
...
Then bind mount then, in /etc/fstab:
/.../mnt/usr.local /usr/local nullfs rw 0 0
/.../mnt/usr.src /usr/src nullfs rw 0 0
/.../mnt/usr.ports /usr/ports nullfs rw 0 0
hidden /.../mnt tmpfs ro,uid=0,gid=0,mode=0000,size=4096,inodes=14 0 0
Basically, the directories under /.../mnt/ in fstab are additionally
mounted onto the specified directory.
The last entry above is optional. I know it will make some people shiver!
- What it does is mount a blank, empty, unwritable temp disk
over /.../mnt , masking the directory and it's contents, so that files on
the filesystem won't get exposed twice. This means things that walk '/',
like file-stat scripts, and backups won't need specific modifications to
remove duplicates listings. This works, so long as the directories beneath
/.../mnt are mounted before the hidden fs.
The reason I use /.../mnt/filesys rather than /.../filesys is so that
operational directories, such as /.../.snap and /.../lost+found are not
made unacessable by the hidden mount.
Cheers, Jamie
More information about the freebsd-hackers
mailing list