shithub: docs.9front.org

ref: 9f7f9d770de575946cb33133537ad1207405b45c
dir: /cwfs.md/

View raw version
cwfs(4) tips
============

No-dump configuration
---------------------

A cheap VPS or an SD card lack the storage capacity for running a usable
default `cwfs(4)` setup with a big WORM partition and daily dumps.
The go-to solution is the `hjfs(4)` file system, which doesn't
use a dedicated WORM partition and doesn't do daily dumps by default.
However, it has several performance problems and is not as well tested.

The `cwfs` file system can be configured in lots of ways beyond the
default cache-worm + other configuration supported by the 9front
installer.

The desired configuration we're going to cover is a single `main`
file server tree backed by a simple disk file system - the same type
used by the `other` tree in the default setup.

To do this we're going to partition the disk appropriately and override
the `mountcwfs` stage of the 9front installer with a replacement
[script](http://a-b.xyz/23/666a) that will configure `cwfs`
appropriately. The rest of the installation and most of the
subsequent system operation remain unaffected.

Start by booting from the installation media. Configure networking
with `ip/ipconfig(8)` and fetch the replacement `mountcwfs` script,
or put the script on a flash drive:

	webfs
	ramfs
	hget http://a-b.xyz/23/666a >/tmp/mountcwfs
	chmod +x /tmp/mountcwfs
	
Override the `mountcwfs` stage using `bind(1)`:

	bind /tmp/mountcwfs /bin/inst/mountcwfs

Run `inst/start` and complete the stages up to `preppart` as you would
normally.  At `preppart`, delete the default partitions and create one
named `fsmain` with a desired size:

	d other
	d fscache
	d fsworm
	a fsmain 123456 .+100%
	w
	q

Make sure to "ream" the new partition at the next step.

Complete the rest of the installation, reboot. That is all.

Adding A drive to the worm
--------------------------

On long living installations or ones that hold a lot of larger files
you may want to add a drive to WORM when it starts to fill up.

First, format the disk, if you are adding to a current install
you probably want one large `plan9` partition containing a single `fsworm`
partition:

	disk/mbr -m /386/mbr /dev/sdD0/data # If your using gpt I can't help you here
	disk/fdisk -a /dev/sdD0/data # disk/edisk for gpt
	# this will partition all unpartitioned space as a plan9 partition,
	# if it looks correct type w to save and then q to quit
	disk/prep -a fsworm /dev/sdD0/plan9
	# this will create an fsworm partition w and q if it looks correct

Now reboot the computer and at bootargs start cwfs with -c to enter
configuration console. At the console enter a new configuration which
includes the newly created `fsworm` partition.
Note that device names are likely to be different in your case.

	config: filsys main c(/dev/sdC0/fscache)((/dev/sdC0/fsworm)(/dev/sdD0/fsworm))
	config: filsys dump o
	config: end

After exiting the console the system should boot with the new partition
added to the WORM. Run:

	con -C /srv/cwfs.cmd
	statw

to confirm. `wsize * 16000` is the size of your WORM.

No refunds