code: mafs

ref: b5d191e8cfa4fac05a02ea309df2541a2652ff23
dir: /man/mafs.8/

View raw version
.TH MAFS 8
.SH NAME
block, find, free, reconcile, unused, updatefrees, used - file server maintenance
.SH SYNOPSIS
.PD 0
.PP
.B halt
.PP
.B sync
.PD
.PP
.B newuser
.I name
.RI [ options ]
.PP
.B disk/block
.I drive
.I block_number
.PP
.B disk/find
.I drive
.I block_number
.PP
.B disk/free
.I drive
.PP
.B disk/reconcile
.I -u used_blocks_list_file
.I -F free_blocks_list_file
.I nblocks
.PP
.B disk/unused
.I used_blocks
.I nblocks
.PP
.B disk/used
.I drive
.PP
.B disk/updatefrees
.I drive
.I free_blocks_list_file
.I nblocks
.SH DESCRIPTION
Reading /adm/ctl prints the number of free, used and total blocks/megabytes. The following commands should be written to /adm/ctl of a
.IR mafs (4)
file server.
.PP
.I Halt
stops the mafs service after pending writes to the disk are completed.
.PP
.I Sync
blocks until all the pending writes to the disk are completed.
.sp
.PP
The following commands should be written to /adm/users of a
.IR mafs (4)
file server.
.PP
.I Newuser
requires a
.I name
argument.
With no options it adds user
.IR name ,
with group leader
.IR name ,
to
.B /adm/users
and makes the directory
.BI /usr/ name
owned by user and group
.IR name .
The options are
.TF =leaderxx
.TP
.B :
Add a group: add the name to
.B /adm/users
but don't create the directory.
By convention, groups are numbered starting from 10000, users from 0.
.TP
.I newname
Rename existing user
.I name
to
.IR newname .
.TP
.BI = leader
Change the leader of
.I name
to
.IR leader .
If
.I leader
is missing, remove the existing leader.
.TP
.BI + member
Add
.I member
to the member list of
.IR name .
.TP
.BI - member
Remove existing
.I member
from the member list of
.IR name .
.PP
After a successful
.I newuser
command the file server overwrites
.B /adm/users
to reflect the internal state of the user table.
.PD
.PP
.I disk/block
Interpret the contents of a block based on the tag and write out a single formatted block based on the tag.
.PP
.I disk/find
traverses the directory heirarchy and identifies the file that a block number belongs to.
.PP
.I disk/find
traverses the directory heirarchy and identifies the file that a block number belongs to.
.PP
.I disk/free
shows the list of free blocks from the contents of /adm/frees.
.PP
.I disk/reconcile
reads two lists of block numbers and flags the common and missing blocks.
.PP
.I disk/unused
builds the list of free blocks. This should match the contents of /adm/frees.
.PP
.I disk/used
traverses the directory heirarchy and writes out all the used block numbers.
.PP
.I disk/updatefrees
changes the contents of /adm/frees.
.SH EXAMPLES
Check disk usage (traditional df) of a mafs mounted at /n/mafs_myservice.
.IP
.EX
cat /n/myservice/adm/ctl
.EE
.PP
Show the contents of block 22 in disk, tests/test.0/disk.
.IP
.EX
disk/block tests/test.0/disk 22
.EE
.PP
Find the file using block 17 in disk, tests/test.0/disk.
.IP
.EX
disk/find  tests/test.0/disk 17
.EE
.PP
From the contents of /adm/frees show the list of free blocks. disk/reconcile uses the output of this to reconcile the list of used blocks with the list of free blocks.
.IP
.EX
disk/free  tests/test.0/disk
.EE
.PP
Read two lists of block numbers and flag the common and missing blocks.
.IP
.EX
disk/reconcile -u <{disk/used  tests/test.0/disk} \\
	-F <{disk/free  tests/test.0/disk} 32
.EE
.PP
Build the list of free blocks. This should match the contents of /adm/frees.
.IP
.EX
disk/unused <{disk/used test.0/disk} 32
.EE
.PP
Traverse the directory heirarchy and write out all the used block numbers.
.IP
.EX
disk/used  tests/test.0/disk
.EE
.PP
Change the contents of /adm/frees.
.IP
.EX
disk/updatefrees tests/test.0/disk \\
	<{disk/unused <{disk/used tests/test.0/disk} 32}
.EE
.PP
A sanity check that the file system is not corrupt by comparing that the unused blocks and free blocks match up. $nblocks is the total number of disk blocks. $disk is the disk.
.IP
.EX
diff <{disk/unused -l <{disk/used tests/test.0/disk} 32}} \\
	<{disk/free tests/test.0/disk}
.EE
.SH SOURCE
.B /sys/src/cmd/mafs
.SH SEE ALSO
.IR mafs (4)
.br
M[a]fs - Plan 9 userspace file system
.SH SOURCE
.B /sys/src/cmd/mafs