Date: Sat, 11 Nov 2017 20:15:58 +0000 From: Jamie Landeg-Jones <jamie@dyslexicfish.net> To: lankfordandrew@charter.net, freebsd-hackers@freebsd.org Subject: Re: Root partition and usrland on one slice, /usr/local ports and src on another Message-ID: <201711112015.vABKFwVw099979@donotpassgo.dyslexicfish.net> In-Reply-To: <YfqE1w00H3jxklw01fqESe@charter.net> References: <YfqE1w00H3jxklw01fqESe@charter.net>
next in thread | previous in thread | raw e-mail | index | archive | help
lankfordandrew@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711112015.vABKFwVw099979>