Index: uspace/app/mkminix/mkminix.c
===================================================================
--- uspace/app/mkminix/mkminix.c	(revision 86d0b4b394df8795d06247979ae9eded47c3521c)
+++ uspace/app/mkminix/mkminix.c	(revision 68ed0fbd3af1b0e52b41d4dd499695858daa57db)
@@ -97,5 +97,5 @@
 
 	/*Default block size is 4Kb*/
-	opt.block_size = 4096;
+	opt.block_size = MFS_MAX_BLOCKSIZE;
 	opt.n_inodes = 0;
 	opt.fs_longnames = false;
@@ -115,9 +115,9 @@
 		case '1':
 			opt.fs_magic = MFS_MAGIC_V1;
-			opt.block_size = MFS_MIN_BLOCK_SIZE;
+			opt.block_size = MFS_BLOCKSIZE;
 			break;
 		case '2':
 			opt.fs_magic = MFS_MAGIC_V2;
-			opt.block_size = MFS_MIN_BLOCK_SIZE;
+			opt.block_size = MFS_BLOCKSIZE;
 			break;
 		case '3':
@@ -136,6 +136,6 @@
 	}
 
-	if (opt.block_size < MFS_MIN_BLOCK_SIZE || 
-				opt.block_size > MFS_MAX_BLOCK_SIZE) {
+	if (opt.block_size < MFS_MIN_BLOCKSIZE || 
+				opt.block_size > MFS_MAX_BLOCKSIZE) {
 		printf(NAME ":Error! Invalid block size.\n");
 		exit(0);
@@ -144,5 +144,5 @@
 		printf(NAME ":Error! Invalid block size.\n");
 		exit(0);
-	} else if (opt.block_size > MFS_MIN_BLOCK_SIZE && 
+	} else if (opt.block_size > MFS_BLOCKSIZE && 
 			opt.fs_magic != MFS_MAGIC_V3) {
 		printf(NAME ":Error! Block size > 1024 is supported by V3 filesystem only.\n");
@@ -168,5 +168,5 @@
 	}
 
-	rc = block_init(handle, MFS_MIN_BLOCK_SIZE);
+	rc = block_init(handle, MFS_MIN_BLOCKSIZE);
 	if (rc != EOK)  {
 		printf(NAME ": Error initializing libblock.\n");
@@ -193,5 +193,8 @@
 	}
 
-	printf("Creating Minix file system on device\n");
+	/*Minimum block size is 1 Kb*/
+	opt.dev_nblocks /= 2;
+
+	printf(NAME ": Creating Minix file system on device\n");
 
 	/*Prepare superblock*/
@@ -211,4 +214,5 @@
 		}
 		prepare_superblock(sb, &opt);
+		block_write_direct(handle, MFS_SUPERBLOCK, 1, sb);
 	}
 
@@ -218,8 +222,17 @@
 static void prepare_superblock(struct mfs_superblock *sb, mfs_params_t *opt)
 {
-	if (opt->fs_longnames) {
-		if (opt->fs_magic == MFS_MAGIC_V1)
+	int ino_per_block = 0;
+	int fs_version;
+	aoff64_t tmp;
+
+	if (opt->fs_magic == MFS_MAGIC_V1) {
+		fs_version = 1;
+		ino_per_block = V1_INODES_PER_BLOCK;
+		if (opt->fs_longnames)
 			opt->fs_magic = MFS_MAGIC_V1L;
-		else
+	} else {
+		fs_version = 2;
+		ino_per_block = V1_INODES_PER_BLOCK;
+		if (opt->fs_longnames)
 			opt->fs_magic = MFS_MAGIC_V2L;
 	}
@@ -235,13 +248,38 @@
 			UINT32_MAX : opt->dev_nblocks;
 
-	if (opt->n_inodes == 0) {
-		aoff64_t tmp = opt->dev_nblocks / 3;		
-		sb->s_ninodes = tmp > UINT16_MAX ? UINT16_MAX : tmp;
-	} else {
-		sb->s_ninodes = opt->n_inodes;
-	}
-
+	if (opt->n_inodes == 0)
+		tmp = opt->dev_nblocks / 3;		
+	else
+		tmp = opt->n_inodes;
+
+	/*Round up the number of inodes to fill block size*/
+	if (tmp % ino_per_block)
+		tmp = ((tmp / ino_per_block) + 1) * ino_per_block;
+	sb->s_ninodes = tmp > UINT16_MAX ? UINT16_MAX : tmp;
+
+	/*Compute inode bitmap size in blocks*/
+	sb->s_ibmap_blocks = sb->s_ninodes / (MFS_BLOCKSIZE * 8);
+	if (sb->s_ibmap_blocks == 0)
+		sb->s_ibmap_blocks = 1;
+
+	/*Compute zone bitmap size in blocks*/
+	if (fs_version == 1)
+		sb->s_zbmap_blocks = sb->s_nzones / (MFS_BLOCKSIZE * 8);
+	else
+		sb->s_zbmap_blocks = sb->s_nzones2 / (MFS_BLOCKSIZE * 8);
+	if (sb->s_zbmap_blocks == 0)
+		sb->s_zbmap_blocks = 1;
+
+	/*Compute first data zone position*/
+	sb->s_first_data_zone = 2 + sb->s_zbmap_blocks + sb->s_ibmap_blocks;
+	unsigned long ninodes_blocks = 1 + (sb->s_ninodes / (fs_version == 1 ?
+							V1_INODES_PER_BLOCK :
+							V2_INODES_PER_BLOCK));
+	sb->s_first_data_zone += ninodes_blocks;
 	sb->s_log2_zone_size = 0;
-
+	/*Superblock is now ready to be written on disk*/
+	printf(NAME ": %d inodes\n", sb->s_ninodes);
+	printf(NAME ": %d zones\n", sb->s_nzones2);
+	printf(NAME ": %d first data zone\n", sb->s_first_data_zone);
 }
 
Index: uspace/lib/minix/minix.h
===================================================================
--- uspace/lib/minix/minix.h	(revision 86d0b4b394df8795d06247979ae9eded47c3521c)
+++ uspace/lib/minix/minix.h	(revision 68ed0fbd3af1b0e52b41d4dd499695858daa57db)
@@ -36,10 +36,13 @@
 #include <sys/types.h>
 
-#define MFS_MAX_BLOCK_SIZE	4096
-#define MFS_MIN_BLOCK_SIZE	1024
+#define MFS_BLOCKSIZE		1024
+
+/*The following block sizes are valid only on V3 filesystem*/
+#define MFS_MIN_BLOCKSIZE	1024
+#define MFS_MAX_BLOCKSIZE	4096
 
 #define MFS_ROOT_INO		1
-#define MFS_SUPER_BLOCK		0
-#define MFS_SUPER_BLOCK_SIZE	1024
+#define MFS_SUPERBLOCK		1
+#define MFS_SUPERBLOCK_SIZE	1024
 
 #define V2_NR_DIRECT_ZONES	7
@@ -48,4 +51,8 @@
 #define V1_NR_DIRECT_ZONES	7
 #define V1_NR_INDIRECT_ZONES	2
+
+#define V1_INODES_PER_BLOCK	(MFS_BLOCKSIZE / sizeof(struct mfs_inode))
+#define V2_INODES_PER_BLOCK	(MFS_BLOCKSIZE / sizeof(struct mfs2_inode))
+#define V3_INODES_PER_BLOCK(bs)	((bs) / sizeof(struct mfs2_inode))
 
 #define MFS_MAX_NAME_LEN	14
@@ -126,5 +133,5 @@
 
 /*MinixFS V1 inode structure as it is on disk*/
-struct mfs_v1_inode {
+struct mfs_inode {
 	uint16_t	i_mode;
 	int16_t		i_uid;
@@ -139,6 +146,6 @@
 } __attribute__ ((packed));
 
-/*MinixFS V2 inode structure as it is on disk.*/
-struct mfs_v2_inode {
+/*MinixFS V2 inode structure as it is on disk (also valid for V3).*/
+struct mfs2_inode {
 	uint16_t 	i_mode;
 	uint16_t 	i_nlinks;
Index: uspace/srv/fs/minixfs/mfs_super.c
===================================================================
--- uspace/srv/fs/minixfs/mfs_super.c	(revision 86d0b4b394df8795d06247979ae9eded47c3521c)
+++ uspace/srv/fs/minixfs/mfs_super.c	(revision 68ed0fbd3af1b0e52b41d4dd499695858daa57db)
@@ -68,5 +68,5 @@
 
 	/* initialize libblock */
-	rc = block_init(devmap_handle, MFS_SUPER_BLOCK_SIZE);
+	rc = block_init(devmap_handle, MFS_SUPERBLOCK_SIZE);
 	if (rc != EOK) {
 		async_answer_0(rid, rc);
@@ -75,5 +75,5 @@
 
 	/* prepare the superblock */
-	rc = block_bb_read(devmap_handle, MFS_SUPER_BLOCK);
+	rc = block_bb_read(devmap_handle, MFS_SUPERBLOCK);
 	if (rc != EOK) {
 		block_fini(devmap_handle);
