Index: .bzrignore
===================================================================
--- .bzrignore	(revision d3842e01da801b970e9415e073319003a65ccb23)
+++ .bzrignore	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -27,4 +27,5 @@
 uspace/app/blkdump/blkdump
 uspace/app/edit/edit
+uspace/app/ext2info/ext2info
 uspace/app/getterm/getterm
 uspace/app/init/init
@@ -52,4 +53,5 @@
 uspace/dist/app/blkdump
 uspace/dist/app/edit
+uspace/dist/app/ext2info
 uspace/dist/app/getterm
 uspace/dist/app/kill
Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision d3842e01da801b970e9415e073319003a65ccb23)
+++ boot/Makefile.common	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -128,4 +128,5 @@
 	$(USPACE_PATH)/app/blkdump/blkdump \
 	$(USPACE_PATH)/app/edit/edit \
+	$(USPACE_PATH)/app/ext2info/ext2info \
 	$(USPACE_PATH)/app/kill/kill \
 	$(USPACE_PATH)/app/killall/killall \
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision d3842e01da801b970e9415e073319003a65ccb23)
+++ uspace/Makefile	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -37,4 +37,5 @@
 	app/blkdump \
 	app/edit \
+	app/ext2info \
 	app/getterm \
 	app/init \
Index: uspace/app/ext2info/Makefile
===================================================================
--- uspace/app/ext2info/Makefile	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
+++ uspace/app/ext2info/Makefile	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBEXT2_PREFIX)/libext2.a
+EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBEXT2_PREFIX)
+BINARY = ext2info
+
+SOURCES = \
+	ext2info.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/ext2info/ext2info.c
===================================================================
--- uspace/app/ext2info/ext2info.c	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
+++ uspace/app/ext2info/ext2info.c	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2011 Martin Sucha
+ * Copyright (c) 2010 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup fs
+ * @{
+ */
+
+/**
+ * @file	ext2info.c
+ * @brief	Tool for displaying information about ext2 filesystem
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libblock.h>
+#include <mem.h>
+#include <devmap.h>
+#include <byteorder.h>
+#include <sys/types.h>
+#include <sys/typefmt.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <libext2.h>
+
+#define NAME	"ext2info"
+
+static void syntax_print(void);
+
+int main(int argc, char **argv)
+{
+
+	int rc;
+	char *dev_path;
+	devmap_handle_t handle;
+	size_t block_size;
+	aoff64_t dev_nblocks;
+	uint8_t *data;
+	ext2_superblock_t *superblock;
+	
+	uint16_t magic;
+	
+	if (argc < 2) {
+		printf(NAME ": Error, argument missing.\n");
+		syntax_print();
+		return 1;
+	}
+
+	--argc; ++argv;
+
+	if (argc != 1) {
+		printf(NAME ": Error, unexpected argument.\n");
+		syntax_print();
+		return 1;
+	}
+
+	dev_path = *argv;
+
+	rc = devmap_device_get_handle(dev_path, &handle, 0);
+	if (rc != EOK) {
+		printf(NAME ": Error resolving device `%s'.\n", dev_path);
+		return 2;
+	}
+
+	rc = block_init(handle, 2048);
+	if (rc != EOK)  {
+		printf(NAME ": Error initializing libblock.\n");
+		return 2;
+	}
+
+	rc = block_get_bsize(handle, &block_size);
+	if (rc != EOK) {
+		printf(NAME ": Error determining device block size.\n");
+		return 2;
+	}
+
+	rc = block_get_nblocks(handle, &dev_nblocks);
+	if (rc != EOK) {
+		printf(NAME ": Warning, failed to obtain block device size.\n");
+	}
+
+	data = malloc(block_size);
+	if (data == NULL) {
+		printf(NAME ": Error allocating data buffer of %" PRIuOFF64 " bytes", (aoff64_t) block_size);
+		block_fini(handle);
+		return 3;
+	}
+	
+	// TODO: don't assume device block size of 512 bytes
+	rc = block_read_direct(handle, 2, 1, data);
+	if (rc != EOK) {
+		printf(NAME ": Error reading block");
+		free(data);
+		return 3;
+	}
+	
+	superblock = (ext2_superblock_t *) data;
+	
+	printf("Superblock:\n");
+	magic = ext2_superblock_get_magic(superblock);
+	if (magic == EXT2_SUPERBLOCK_MAGIC) {
+		printf("  Magic value: %X (correct)\n", magic);
+	}
+	else {
+		printf("  Magic value: %X (incorrect)\n", magic);
+	}
+	
+	
+	free(data);
+
+	block_fini(handle);
+
+	return 0;
+}
+
+
+static void syntax_print(void)
+{
+	printf("syntax: blkdump [--offset <num_blocks>] [--count <num_blocks>] <device_name>\n");
+}
+
+/**
+ * @}
+ */
Index: uspace/lib/ext2/libext2.c
===================================================================
--- uspace/lib/ext2/libext2.c	(revision d3842e01da801b970e9415e073319003a65ccb23)
+++ uspace/lib/ext2/libext2.c	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -38,4 +38,8 @@
 #include <errno.h>
 
+inline uint16_t ext2_superblock_get_magic(ext2_superblock_t *superblock) {
+	return uint16_t_le2host(superblock->magic);
+}
+
 /** @}
  */
Index: uspace/lib/ext2/libext2.h
===================================================================
--- uspace/lib/ext2/libext2.h	(revision d3842e01da801b970e9415e073319003a65ccb23)
+++ uspace/lib/ext2/libext2.h	(revision d5e276303aacb69e6369060c00aa10fcf9894915)
@@ -37,5 +37,14 @@
 #define LIBEXT2_LIBEXT2_H_
 
+#include <byteorder.h>
 
+typedef struct ext2_superblock {
+	uint8_t unused[56];
+	uint16_t magic;
+} ext2_superblock_t;
+
+#define EXT2_SUPERBLOCK_MAGIC 0xEF53
+
+inline uint16_t ext2_superblock_get_magic(ext2_superblock_t *superblock);
 
 #endif
