![]() |
|
||||
![]()
MFS filesystems are ramdisk filesystems, and common to all BSDs. They are backed up by swap space, so that high use sections stay in RAM, and receive RAM performance, but low-use sections receive disk drive performance. They are commonly used for /tmp or other temporary uses. They are limited in size to MAXDSIZ, which is 1GB on OpenBSD.
When building OpenBSD-current, I like to mount an MFS filesystem for /usr/obj, to shave some minutes off of build time. Until this week, I have been able to fit all of /usr/obj within a single 1G MFS filesystem. I can still do so for building userland, but making a release(8) fails, at it requires even more space in /usr/obj than can fit. I cannot increase MAXDSIZ, as that will break many other components of the OS. So I conceived this workaround:
The mount_mfs(8) command is used to create the MFS filesystems. The key option is "-s" which is used to set the number of 512-byte sectors. Vnodes are how filesystems are addressed. The userland tool to manipulate them is vnconfig(8). It is most often used to mount CD or hard disk images. It is used here to make the large (empty) files we created in ramdisk act as devices, for concatenation into a single CCD device. CCD devices are included in OpenBSD's GENERIC kernel. They can do simple concatenation (RAID0) or mirroring (RAID1-like). In this case, I select simple concatenation. Note that I leave the entire first cylinder (63x255 sectors, about 7.8 MB) empty on each vnode device and the CCD device, for CCD management information. Here's my build-userland shell script, which shows the sequence:
Code:
#!/bin/sh# # kernel should be manually built first, then system rebooted, before # executing this script. # # make sure we're root: test -O /etc/passwd || echo run as superuser test -O /etc/passwd || exit # create ramdisk /usr/obj -- it is bigger than max MFS space: mkdir /tmp/j1 /tmp/j2 mount_mfs -o noatime,async -s 1500000 swap /tmp/j1 mount_mfs -o noatime,async -s 1500000 swap /tmp/j2 dd if=/dev/zero of=/tmp/j1/1 bs=1m seek=670 count=0 dd if=/dev/zero of=/tmp/j2/2 bs=1m seek=670 count=0 vnconfig svnd1 /tmp/j1/1 vnconfig svnd2 /tmp/j2/2 printf 'a a\n16065\n\nccd\nw\nq' | disklabel -E svnd1 printf 'a a\n16065\n\nccd\nw\nq' | disklabel -E svnd2 ccdconfig ccd0 0 0 /dev/svnd1a /dev/svnd2a printf 'a a\n16065\n\n\nw\nq' | disklabel -E ccd0 newfs ccd0a mount -o async,noatime /dev/ccd0a /usr/obj # make userland cd /usr/src nice make obj cd /usr/src/etc && env DESTDIR=/ nice make distrib-dirs cd /usr/src nice make build Last edited by jggimi; 26th October 2008 at 05:16 PM. Reason: Corrected starting sectors to 16065 (63x255). |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Have problem transfer large file bigger 1GB | bsdme2 | FreeBSD General | 9 | 14th January 2009 05:49 AM |
Need help with mounting filesystems | Mr-Biscuit | FreeBSD General | 2 | 11th September 2008 08:29 AM |
webmin filesystems error | smooth187 | FreeBSD General | 1 | 29th July 2008 05:29 PM |
mirror device detached on large file copy | lil_elvis2000 | FreeBSD General | 24 | 27th June 2008 02:56 PM |
Automatic Mount for Devices/Filesystems | vermaden | FreeBSD General | 11 | 12th June 2008 04:55 AM |