
MIN_INODES=9000

echo "creates a file-system file of $1 $2 (Kb/Mb) with at least $MIN_INODES i-nodes"
# echo "floppy of 1.44 Mb = 1440 kb"

if [ $# -ne 2 ]
then
	echo "incorrect number of arguments"
	exit -1
fi


if [ $2 = "Mb" ]
then
	typeset -i SIZE=$1*1024
	NAME=$1Mb.fs

else 
	typeset -i SIZE=$1
	NAME=$1Kb.fs
fi

INODE_ARG="-N $MIN_INODES"
#if [ $SIZE -gt $MIN_INODES ]
if [ $SIZE -gt 30000 ]
then

	INODE_ARG="-i 4096"
	#INODE_ARG="-i 1024"

fi

echo "$NAME of $SIZE Kb  (inode = $INODE_ARG)"

echo "* creating fs file"
dd if=/dev/zero bs=1k count=$SIZE of=$NAME

echo "* formating"
echo "/sbin/mke2fs -v -L maragda -b 1024 -F -m0 $INODE_ARG $NAME"
/sbin/mke2fs -v -L maragda -b 1024 -F -m0 $INODE_ARG $NAME


