Index: uspace/srv/fs/minixfs/Makefile
===================================================================
--- uspace/srv/fs/minixfs/Makefile	(revision 819450ad3a80c66a2178aa26cfe8316f7fde674f)
+++ uspace/srv/fs/minixfs/Makefile	(revision 9e3dc95b68ac177f7844dca8b588d3e488e569f2)
@@ -34,5 +34,7 @@
 
 SOURCES = \
-	mfs.c
+	mfs.c \
+	mfs_super.c \
+	mfs_utils.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/fs/minixfs/mfs_const.h
===================================================================
--- uspace/srv/fs/minixfs/mfs_const.h	(revision 819450ad3a80c66a2178aa26cfe8316f7fde674f)
+++ uspace/srv/fs/minixfs/mfs_const.h	(revision 9e3dc95b68ac177f7844dca8b588d3e488e569f2)
@@ -38,8 +38,4 @@
 #include <bool.h>
 
-#define MFS_MAGIC_V1		0x137F
-#define MFS_MAGIC_V2		0x2468
-#define MFS_MAGIC_V3		0x4D5A
-
 #define MFS_ROOT_INO		1
 #define MFS_SUPER_BLOCK		0
Index: uspace/srv/fs/minixfs/mfs_super.c
===================================================================
--- uspace/srv/fs/minixfs/mfs_super.c	(revision 819450ad3a80c66a2178aa26cfe8316f7fde674f)
+++ uspace/srv/fs/minixfs/mfs_super.c	(revision 9e3dc95b68ac177f7844dca8b588d3e488e569f2)
@@ -31,5 +31,14 @@
  */
 
+#include <libfs.h>
+#include <stdlib.h>
+#include <libblock.h>
+#include <errno.h>
+#include <str.h>
 #include "mfs_super.h"
+#include "mfs_utils.h"
+#include "../../vfs/vfs.h"
+
+static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version);
 
 void mfs_mounted(ipc_callid_t rid, ipc_call_t *request)
@@ -38,4 +47,6 @@
 	enum cache_mode cmode;	
 	struct mfs_superblock *sp;
+	bool native;
+	mfs_version_t version;
 
 	/* Accept the mount options */
@@ -73,4 +84,42 @@
 	/* get the buffer with the superblock */
 	sp = block_bb_get(devmap_handle);
+
+	if (!check_magic_number(sp->s_magic, &native, &version)) {
+		/*Magic number is invalid!*/
+		block_fini(devmap_handle);
+		async_answer_0(rid, ENOTSUP);
+		return;
+	}
+}
+
+static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version)
+{
+	*native = true;
+
+repeat_check:
+
+	switch (*native ? magic : conv16(false, magic)) {
+	case MFS_MAGIC_V1:
+		*version = MFS_VERSION_V1;
+		return true;
+	case MFS_MAGIC_V2:
+		*version = MFS_VERSION_V2;
+		return true;
+	case MFS_MAGIC_V3:
+		*version = MFS_VERSION_V3;
+		return true;
+	default:
+		;
+	}
+
+	if (*native) {
+		*native = false;
+		goto repeat_check;
+	} else {
+		return false;
+	}
+
+	/*Should never happens*/
+	return false;
 }
 
Index: uspace/srv/fs/minixfs/mfs_super.h
===================================================================
--- uspace/srv/fs/minixfs/mfs_super.h	(revision 819450ad3a80c66a2178aa26cfe8316f7fde674f)
+++ uspace/srv/fs/minixfs/mfs_super.h	(revision 9e3dc95b68ac177f7844dca8b588d3e488e569f2)
@@ -37,4 +37,8 @@
 #include "../../vfs/vfs.h"
 
+#define MFS_MAGIC_V1		0x137F
+#define MFS_MAGIC_V2		0x2468
+#define MFS_MAGIC_V3		0x4D5A
+
 struct mfs_superblock {
 	/*Total number of inodes on the device*/
@@ -67,4 +71,10 @@
 } __attribute__ ((packed));
 
+typedef enum {
+	MFS_VERSION_V1 = 1,
+	MFS_VERSION_V2,
+	MFS_VERSION_V3
+} mfs_version_t;
+
 void mfs_mounted(ipc_callid_t rid, ipc_call_t *request);
 
Index: uspace/srv/fs/minixfs/mfs_utils.c
===================================================================
--- uspace/srv/fs/minixfs/mfs_utils.c	(revision 819450ad3a80c66a2178aa26cfe8316f7fde674f)
+++ uspace/srv/fs/minixfs/mfs_utils.c	(revision 9e3dc95b68ac177f7844dca8b588d3e488e569f2)
@@ -38,5 +38,5 @@
 		return n;
 
-	return r = (n << 8) | (n >> 8);
+	return (n << 8) | (n >> 8);
 }
 
