Index: uspace/app/ext2info/ext2info.c
===================================================================
--- uspace/app/ext2info/ext2info.c	(revision 3949e8a00ee606175ad5dc087d7a9c5707e594c9)
+++ uspace/app/ext2info/ext2info.c	(revision 1d6f507f0b213da5fe9346663a8a45869e166812)
@@ -88,4 +88,10 @@
 	if (rc != EOK)  {
 		printf(NAME ": Error initializing libext2.\n");
+		return 3;
+	}
+	
+	rc = ext2_filesystem_check_sanity(&filesystem);
+	if (rc != EOK) {
+		printf(NAME ": Filesystem did not pass sanity check.\n");
 		return 3;
 	}
Index: uspace/lib/ext2/libext2_filesystem.c
===================================================================
--- uspace/lib/ext2/libext2_filesystem.c	(revision 3949e8a00ee606175ad5dc087d7a9c5707e594c9)
+++ uspace/lib/ext2/libext2_filesystem.c	(revision 1d6f507f0b213da5fe9346663a8a45869e166812)
@@ -46,4 +46,6 @@
  * @param fs			Pointer to ext2_filesystem_t to initialize
  * @param devmap_handle	Device handle of the block device
+ * 
+ * @return 		EOK on success or negative error code on failure
  */
 int ext2_filesystem_init(ext2_filesystem_t *fs, devmap_handle_t devmap_handle)
@@ -85,4 +87,22 @@
 
 /**
+ * Check filesystem for sanity
+ * 
+ * @param fs			Pointer to ext2_filesystem_t to check
+ * @return 		EOK on success or negative error code on failure
+ */
+int ext2_filesystem_check_sanity(ext2_filesystem_t *fs)
+{
+	int rc;
+	
+	rc = ext2_superblock_check_sanity(fs->superblock);
+	if (rc != EOK) {
+		return rc;
+	}
+	
+	return EOK;
+}
+
+/**
  * Finalize an instance of filesystem
  * 
Index: uspace/lib/ext2/libext2_filesystem.h
===================================================================
--- uspace/lib/ext2/libext2_filesystem.h	(revision 3949e8a00ee606175ad5dc087d7a9c5707e594c9)
+++ uspace/lib/ext2/libext2_filesystem.h	(revision 1d6f507f0b213da5fe9346663a8a45869e166812)
@@ -51,4 +51,5 @@
 
 extern int ext2_filesystem_init(ext2_filesystem_t *, devmap_handle_t);
+extern int ext2_filesystem_check_sanity(ext2_filesystem_t *);
 extern void ext2_filesystem_fini(ext2_filesystem_t *);
 
Index: uspace/lib/ext2/libext2_superblock.c
===================================================================
--- uspace/lib/ext2/libext2_superblock.c	(revision 3949e8a00ee606175ad5dc087d7a9c5707e594c9)
+++ uspace/lib/ext2/libext2_superblock.c	(revision 1d6f507f0b213da5fe9346663a8a45869e166812)
@@ -247,4 +247,25 @@
 }
 
+/**
+ * Get count of inodes per block group
+ * 
+ * @param sb pointer to superblock
+ */
+inline uint32_t	ext2_superblock_get_inodes_per_group(ext2_superblock_t *sb)
+{
+	return uint32_t_le2host(sb->inodes_per_group);
+}
+
+/**
+ * Compute count of block groups present in the filesystem
+ * 
+ * @param sb pointer to superblock
+ */
+inline uint32_t ext2_superblock_get_block_group_count(ext2_superblock_t *sb)
+{
+	return ext2_superblock_get_total_block_count(sb) / 
+	    ext2_superblock_get_blocks_per_group(sb);
+}
+
 /** Read a superblock directly from device (i.e. no libblock cache)
  * 
@@ -276,4 +297,61 @@
 }
 
+/** Check a superblock for sanity
+ * 
+ * @param sb	Pointer to superblock
+ * 
+ * @return		EOK on success or negative error code on failure.
+ */
+int ext2_superblock_check_sanity(ext2_superblock_t *sb)
+{
+	if (ext2_superblock_get_magic(sb) != EXT2_SUPERBLOCK_MAGIC) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_rev_major(sb) > 1) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_total_inode_count(sb) == 0) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_total_block_count(sb) == 0) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_blocks_per_group(sb) == 0) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_fragments_per_group(sb) == 0) {
+		return ENOTSUP;
+	}
+	
+	// We don't support fragments smaller than block
+	if (ext2_superblock_get_block_size(sb) != 
+		    ext2_superblock_get_fragment_size(sb)) {
+		return ENOTSUP;
+	}
+	if (ext2_superblock_get_blocks_per_group(sb) !=
+		    ext2_superblock_get_fragments_per_group(sb)) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_inodes_per_group(sb) == 0) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_inode_size(sb) < 128) {
+		return ENOTSUP;
+	}
+	
+	if (ext2_superblock_get_first_inode(sb) < 11) {
+		return ENOTSUP;
+	}
+	
+	return EOK;
+}
+
 
 /** @}
Index: uspace/lib/ext2/libext2_superblock.h
===================================================================
--- uspace/lib/ext2/libext2_superblock.h	(revision 3949e8a00ee606175ad5dc087d7a9c5707e594c9)
+++ uspace/lib/ext2/libext2_superblock.h	(revision 1d6f507f0b213da5fe9346663a8a45869e166812)
@@ -99,6 +99,9 @@
 inline uint32_t	ext2_superblock_get_free_block_count(ext2_superblock_t *);
 inline uint32_t	ext2_superblock_get_free_inode_count(ext2_superblock_t *);
+inline uint32_t	ext2_superblock_get_block_group_count(ext2_superblock_t *);
+inline uint32_t	ext2_superblock_get_inodes_per_group(ext2_superblock_t *);
 
 extern int ext2_superblock_read_direct(devmap_handle_t, ext2_superblock_t **);
+extern int ext2_superblock_check_sanity(ext2_superblock_t *);
 
 #endif
