code: mafs

ref: fc5add282e0dadcc4a1980cf8376e825b976771e
dir: /fsck/

View raw version
#!/bin/rc

# usage
#	disk/fsck /dev/sdFn/fs

disk=$1
if(~ $#disk '')
	exit invalid disk

# get the total number of blocks from the config block
nblocks=`{disk/block $disk 1 | awk '$1 == "nblocks"{ print $2 }'}

# write the free extents to /a/frees
disk/updatefrees $disk <{disk/unused $nblocks <{disk/used $disk}}

# change fsok from 0 to 1
disk/fsok $disk