Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/Makefile	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -80,4 +80,5 @@
 	app/vlaunch \
 	app/vterm \
+	app/df \
 	srv/clipboard \
 	srv/locsrv \
Index: uspace/app/df/Makefile
===================================================================
--- uspace/app/df/Makefile	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
+++ uspace/app/df/Makefile	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2013 Manuele Conti
+# 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 = ../..
+BINARY = df
+
+SOURCES = \
+	df.c 
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/df/df.c
===================================================================
--- uspace/app/df/df.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
+++ uspace/app/df/df.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013 Manuele Conti
+ * 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 df
+ * @brief Df utility.
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <sys/statfs.h>
+#include <errno.h>
+#include <adt/list.h>
+#include <vfs/vfs.h>
+
+#define NAME  "df"
+
+#define HEADER_TABLE "Filesystem    512-blocks      Used      Available  Used%  Mounted on"
+
+#define PERCENTAGE(x, tot) ((unsigned long long) (100L * (x) / (tot)))  
+
+int main(int argc, char *argv[])
+{
+	struct statfs st;
+
+	LIST_INITIALIZE(mtab_list);
+	get_mtab_list(&mtab_list);
+	printf("%s\n", HEADER_TABLE);
+	list_foreach(mtab_list, cur) {
+		mtab_ent_t *mtab_ent = list_get_instance(cur, mtab_ent_t,
+		    link);
+		statfs(mtab_ent->mp, &st);
+		printf("block size:%lu\n", (unsigned long)st.f_bsize);
+		printf("%13s %15llu %9llu %9llu %3llu%% %s\n", 
+			mtab_ent->fs_name,
+			(unsigned long long) st.f_blocks * st.f_bsize,
+			(unsigned long long) (st.f_blocks - st.f_bfree) * st.f_bsize,
+			(unsigned long long) st.f_bfree * st.f_bsize,
+			(st.f_blocks)?PERCENTAGE(st.f_blocks - st.f_bfree, st.f_blocks):0L,
+			mtab_ent->mp);
+	}
+	putchar('\n');	
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/app/trace/trace.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -724,4 +724,6 @@
 	o = oper_new("stat", 0, arg_def, V_ERRNO, 0, resp_def);
 	proto_add_oper(p, VFS_IN_STAT, o);
+	o = oper_new("statfs", 0, arg_def, V_ERRNO, 0, resp_def);
+	proto_add_oper(p, VFS_IN_STATFS, o);
 
 	proto_register(SERVICE_VFS, p);
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -43,4 +43,5 @@
 #include <stdio.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <sys/types.h>
 #include <ipc/services.h>
@@ -892,4 +893,43 @@
 }
 
+int statfs(const char *path, struct statfs *statfs)
+{
+	sysarg_t rc;
+	sysarg_t rc_orig;
+	aid_t req;
+	size_t pa_size;
+	
+	char *pa = absolutize(path, &pa_size);
+	if (!pa)
+		return ENOMEM;
+	async_exch_t *exch = vfs_exchange_begin();
+	
+	req = async_send_0(exch, VFS_IN_STATFS, NULL);
+	rc = async_data_write_start(exch, pa, pa_size);
+	if (rc != EOK) {
+		vfs_exchange_end(exch);
+		free(pa);
+		async_wait_for(req, &rc_orig);
+		if (rc_orig == EOK)
+			return (int) rc;
+		else
+			return (int) rc_orig;
+	}
+	rc = async_data_read_start(exch, (void *) statfs, sizeof(struct statfs));
+	if (rc != EOK) {
+		vfs_exchange_end(exch);
+		free(pa);
+		async_wait_for(req, &rc_orig);
+		if (rc_orig == EOK)
+			return (int) rc;
+		else
+			return (int) rc_orig;
+	}
+	vfs_exchange_end(exch);
+	free(pa);
+	async_wait_for(req, &rc);
+	return rc;
+}
+
 /** @}
  */
Index: uspace/lib/c/include/ipc/vfs.h
===================================================================
--- uspace/lib/c/include/ipc/vfs.h	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/lib/c/include/ipc/vfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -82,4 +82,5 @@
 	VFS_IN_WAIT_HANDLE,
 	VFS_IN_MTAB_GET,
+	VFS_IN_STATFS
 } vfs_in_request_t;
 
@@ -98,4 +99,5 @@
 	VFS_OUT_LOOKUP,
 	VFS_OUT_DESTROY,
+	VFS_OUT_STATFS,
 	VFS_OUT_LAST
 } vfs_out_request_t;
Index: uspace/lib/c/include/sys/statfs.h
===================================================================
--- uspace/lib/c/include/sys/statfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
+++ uspace/lib/c/include/sys/statfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013 Manuele Conti
+ * 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 libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_SYS_STATFS_H_
+#define LIBC_SYS_STATFS_H_
+
+#include <sys/types.h>
+
+struct statfs { 
+	uint32_t    f_type;     /* type of file system  */
+	uint32_t    f_bsize;    /* fundamental file system block size */
+	uint64_t    f_blocks;   /* total data blocks in file system */
+	uint64_t    f_bfree;    /* free blocks in fs */
+};
+
+extern int statfs(const char *, struct statfs *);
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/lib/c/include/vfs/vfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -44,7 +44,9 @@
 #include "vfs_mtab.h"
 
+
 enum vfs_change_state_type {
 	VFS_PASS_HANDLE
 };
+
 
 extern char *absolutize(const char *, size_t *);
@@ -61,5 +63,4 @@
 extern async_exch_t *vfs_exchange_begin(void);
 extern void vfs_exchange_end(async_exch_t *);
-
 #endif
 
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/lib/fs/libfs.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -45,4 +45,5 @@
 #include <mem.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <stdlib.h>
 
@@ -74,4 +75,5 @@
 static void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_callid_t,
     ipc_call_t *);
+static void libfs_statfs(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
 
 static void vfs_out_mounted(ipc_callid_t rid, ipc_call_t *req)
@@ -219,4 +221,8 @@
 }
 
+static void vfs_out_statfs(ipc_callid_t rid, ipc_call_t *req)
+{
+	libfs_statfs(libfs_ops, reg.fs_handle, rid, req);
+}
 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
 {
@@ -276,4 +282,7 @@
 		case VFS_OUT_SYNC:
 			vfs_out_sync(callid, &call);
+			break;
+		case VFS_OUT_STATFS:
+			vfs_out_statfs(callid, &call);
 			break;
 		default:
@@ -830,4 +839,41 @@
 }
 
+void libfs_statfs(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid,
+    ipc_call_t *request)
+{
+	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	
+	fs_node_t *fn;
+	int rc = ops->node_get(&fn, service_id, index);
+	on_error(rc, answer_and_return(rid, rc));
+	
+	ipc_callid_t callid;
+	size_t size;
+	if ((!async_data_read_receive(&callid, &size)) ||
+	    (size != sizeof(struct statfs))) {
+		ops->node_put(fn);
+		async_answer_0(callid, EINVAL);
+		async_answer_0(rid, EINVAL);
+		return;
+	}
+	
+	struct statfs statfs;
+	memset(&statfs, 0, sizeof(struct statfs));
+
+	if (NULL != ops->size_block)	
+		statfs.f_bsize = ops->size_block(service_id);
+	if (NULL != ops->total_block)
+		statfs.f_blocks = ops->total_block(service_id);
+	if (NULL != ops->free_block)
+		statfs.f_bfree = ops->free_block(service_id);
+	
+	ops->node_put(fn);
+	
+	async_data_read_finalize(callid, &statfs, sizeof(struct statfs));
+	async_answer_0(rid, EOK);
+}
+
+
 /** Open VFS triplet.
  *
Index: uspace/lib/fs/libfs.h
===================================================================
--- uspace/lib/fs/libfs.h	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/lib/fs/libfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -93,4 +93,7 @@
 	bool (* is_file)(fs_node_t *);
 	service_id_t (* service_get)(fs_node_t *);
+	uint32_t (* size_block)(service_id_t);
+	uint64_t (* total_block)(service_id_t);
+	uint64_t (* free_block)(service_id_t);
 } libfs_ops_t;
 
Index: uspace/srv/fs/cdfs/cdfs_ops.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/cdfs/cdfs_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -625,4 +625,10 @@
 }
 
+static uint32_t cdfs_size_block(service_id_t service_id)
+{
+	uint32_t block_size = BLOCK_SIZE;
+	return block_size; 
+}
+
 libfs_ops_t cdfs_libfs_ops = {
 	.root_get = cdfs_root_get,
@@ -641,5 +647,6 @@
 	.is_directory = cdfs_is_directory,
 	.is_file = cdfs_is_file,
-	.service_get = cdfs_service_get
+	.service_get = cdfs_service_get,
+	.size_block = cdfs_size_block
 };
 
Index: uspace/srv/fs/exfat/exfat_ops.c
===================================================================
--- uspace/srv/fs/exfat/exfat_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/exfat/exfat_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -89,4 +89,7 @@
 static bool exfat_is_file(fs_node_t *node);
 static service_id_t exfat_service_get(fs_node_t *node);
+static uint32_t exfat_size_block(service_id_t);
+static uint64_t exfat_total_block(service_id_t);
+static uint64_t exfat_free_block(service_id_t);
 
 /*
@@ -912,4 +915,32 @@
 }
 
+uint32_t exfat_size_block(service_id_t service_id)
+{
+	exfat_bs_t *bs;
+	bs = block_bb_get(service_id);
+	
+	return BPC(bs);
+}
+
+uint64_t exfat_total_block(service_id_t service_id)
+{
+	exfat_bs_t *bs;
+	bs = block_bb_get(service_id);
+	
+	uint64_t block_count = DATA_CNT(bs);
+	
+	return block_count;
+}
+
+uint64_t exfat_free_block(service_id_t service_id)
+{
+	exfat_bs_t *bs;
+	bs = block_bb_get(service_id);
+	
+	uint64_t block_count = (DATA_CNT(bs) / 100) * 
+			bs->allocated_percent;
+
+	return block_count;
+}
 
 /** libfs operations */
@@ -930,5 +961,8 @@
 	.is_directory = exfat_is_directory,
 	.is_file = exfat_is_file,
-	.service_get = exfat_service_get
+	.service_get = exfat_service_get,
+	.size_block = exfat_size_block,
+	.total_block = exfat_total_block,
+	.free_block = exfat_free_block
 };
 
Index: uspace/srv/fs/ext4fs/ext4fs_ops.c
===================================================================
--- uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -101,4 +101,7 @@
 static bool ext4fs_is_file(fs_node_t *node);
 static service_id_t ext4fs_service_get(fs_node_t *node);
+static uint32_t ext4fs_size_block(service_id_t);
+static uint64_t ext4fs_total_block(service_id_t);
+static uint64_t ext4fs_free_block(service_id_t);
 
 /* Static variables */
@@ -836,4 +839,49 @@
 	ext4fs_node_t *enode = EXT4FS_NODE(fn);
 	return enode->instance->service_id;
+}
+
+uint32_t ext4fs_size_block(service_id_t service_id)
+{
+	ext4fs_instance_t *inst;
+	int rc = ext4fs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+	if (NULL == inst)
+		return ENOENT;
+
+	ext4_superblock_t *sb = inst->filesystem->superblock;
+	uint32_t block_size = ext4_superblock_get_block_size(sb);
+
+	return block_size;
+}
+
+uint64_t ext4fs_total_block(service_id_t service_id)
+{
+	ext4fs_instance_t *inst;
+	int rc = ext4fs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+	if (NULL == inst)
+		return ENOENT;
+
+	ext4_superblock_t *sb = inst->filesystem->superblock;
+	uint64_t block_count = ext4_superblock_get_blocks_count(sb);
+
+	return block_count;
+}
+
+uint64_t ext4fs_free_block(service_id_t service_id)
+{
+	ext4fs_instance_t *inst;
+	int rc = ext4fs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+	if (NULL == inst)
+		return ENOENT;
+
+	ext4_superblock_t *sb = inst->filesystem->superblock;
+	uint64_t block_count = ext4_superblock_get_free_blocks_count(sb);
+
+	return block_count;
 }
 
@@ -857,5 +905,8 @@
 	.is_directory = ext4fs_is_directory,
 	.is_file = ext4fs_is_file,
-	.service_get = ext4fs_service_get
+	.service_get = ext4fs_service_get,
+	.size_block = ext4fs_size_block,
+	.total_block = ext4fs_total_block,
+	.free_block = ext4fs_free_block
 };
 
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/fat/fat_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -91,4 +91,5 @@
 static bool fat_is_file(fs_node_t *node);
 static service_id_t fat_service_get(fs_node_t *node);
+static uint32_t fat_size_block(service_id_t);
 
 /*
@@ -843,4 +844,12 @@
 }
 
+uint32_t fat_size_block(service_id_t service_id)
+{
+	fat_bs_t *bs;
+	bs = block_bb_get(service_id);
+
+	return BPC(bs);
+}
+
 /** libfs operations */
 libfs_ops_t fat_libfs_ops = {
@@ -860,5 +869,6 @@
 	.is_directory = fat_is_directory,
 	.is_file = fat_is_file,
-	.service_get = fat_service_get
+	.service_get = fat_service_get,
+	.size_block = fat_size_block
 };
 
Index: uspace/srv/fs/mfs/mfs.h
===================================================================
--- uspace/srv/fs/mfs/mfs.h	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/mfs/mfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -58,4 +58,14 @@
 #endif
 
+#define MFS_BMAP_START_BLOCK(sbi, bid) \
+    ((bid) == BMAP_ZONE ? 2 + (sbi)->ibmap_blocks : 2)
+
+#define MFS_BMAP_SIZE_BITS(sbi, bid) \
+    ((bid) == BMAP_ZONE ? (sbi)->nzones - (sbi)->firstdatazone - 1 : \
+    (sbi)->ninodes - 1)
+
+#define MFS_BMAP_SIZE_BLOCKS(sbi, bid) \
+    ((bid) == BMAP_ZONE ? (sbi)->zbmap_blocks : (sbi)->ibmap_blocks)
+
 typedef uint32_t bitchunk_t;
 
@@ -201,4 +211,11 @@
 mfs_free_zone(struct mfs_instance *inst, uint32_t zone);
 
+extern int
+mfs_count_free_zones(struct mfs_instance *inst, uint32_t *zones);
+
+extern int
+mfs_count_free_inodes(struct mfs_instance *inst, uint32_t *inodes);
+
+
 /* mfs_utils.c */
 extern uint16_t
Index: uspace/srv/fs/mfs/mfs_balloc.c
===================================================================
--- uspace/srv/fs/mfs/mfs_balloc.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/mfs/mfs_balloc.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -44,4 +44,8 @@
 mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid);
 
+static int
+mfs_count_free_bits(struct mfs_instance *inst, bmap_id_t bid, uint32_t *free);
+
+
 /**Allocate a new inode.
  *
@@ -102,4 +106,97 @@
 
 	return mfs_free_bit(inst, zone, BMAP_ZONE);
+}
+
+/** Count the number of free zones
+ *
+ * @param inst          Pointer to the instance structure.
+ * @param zones         Pointer to the memory location where the result
+ *                      will be stored.
+ *
+ * @return              EOK on success or a negative error code.
+ */
+int
+mfs_count_free_zones(struct mfs_instance *inst, uint32_t *zones)
+{
+	return mfs_count_free_bits(inst, BMAP_ZONE, zones);
+}
+
+/** Count the number of free inodes
+ *
+ * @param inst          Pointer to the instance structure.
+ * @param zones         Pointer to the memory location where the result
+ *                      will be stored.
+ *
+ * @return              EOK on success or a negative error code.
+ */
+
+int
+mfs_count_free_inodes(struct mfs_instance *inst, uint32_t *inodes)
+{
+	return mfs_count_free_bits(inst, BMAP_INODE, inodes);
+}
+
+/** Count the number of free bits in a bitmap
+ *
+ * @param inst          Pointer to the instance structure.
+ * @param bid           Type of the bitmap (inode or zone).
+ * @param free          Pointer to the memory location where the result
+ *                      will be stores.
+ *
+ * @return              EOK on success or a negative error code.
+ */
+static int
+mfs_count_free_bits(struct mfs_instance *inst, bmap_id_t bid, uint32_t *free)
+{
+	int r;
+	unsigned start_block;
+	unsigned long nblocks;
+	unsigned long nbits;
+	unsigned long block;
+	unsigned long free_bits = 0;
+	bitchunk_t chunk;
+	size_t const bitchunk_bits = sizeof(bitchunk_t) * 8;
+	block_t *b;
+	struct mfs_sb_info *sbi = inst->sbi;
+
+	start_block = MFS_BMAP_START_BLOCK(sbi, bid);
+	nblocks = MFS_BMAP_SIZE_BLOCKS(sbi, bid);
+	nbits = MFS_BMAP_SIZE_BITS(sbi, bid);
+
+	for (block = 0; block < nblocks; ++block) {
+		r = block_get(&b, inst->service_id, block + start_block,
+		    BLOCK_FLAGS_NONE);
+		if (r != EOK)
+			return r;
+
+		size_t i;
+		bitchunk_t *data = (bitchunk_t *) b->data;
+
+		/* Read the bitmap block, chunk per chunk,
+		 * counting the zero bits.
+		 */
+		for (i = 0; i < sbi->block_size / sizeof(bitchunk_t); ++i) {
+			chunk = conv32(sbi->native, data[i]);
+
+			size_t bit;
+			for (bit = 0; bit < bitchunk_bits && nbits > 0;
+			    ++bit, --nbits) {
+				if (!(chunk & (1 << bit)))
+					free_bits++;
+			}
+
+			if (nbits == 0)
+				break;
+		}
+
+		r = block_put(b);
+		if (r != EOK)
+			return r;
+	}
+
+	*free = free_bits;
+	assert(nbits == 0);
+
+	return EOK;
 }
 
@@ -124,7 +221,8 @@
 	sbi = inst->sbi;
 
+	start_block = MFS_BMAP_START_BLOCK(sbi, bid);
+
 	if (bid == BMAP_ZONE) {
 		search = &sbi->zsearch;
-		start_block = 2 + sbi->ibmap_blocks;
 		if (idx > sbi->nzones) {
 			printf(NAME ": Error! Trying to free beyond the "
@@ -135,5 +233,4 @@
 		/* bid == BMAP_INODE */
 		search = &sbi->isearch;
-		start_block = 2;
 		if (idx > sbi->ninodes) {
 			printf(NAME ": Error! Trying to free beyond the "
@@ -192,15 +289,13 @@
 	sbi = inst->sbi;
 
+	start_block = MFS_BMAP_START_BLOCK(sbi, bid);
+	limit = MFS_BMAP_SIZE_BITS(sbi, bid);
+	nblocks = MFS_BMAP_SIZE_BLOCKS(sbi, bid);
+
 	if (bid == BMAP_ZONE) {
 		search = &sbi->zsearch;
-		start_block = 2 + sbi->ibmap_blocks;
-		nblocks = sbi->zbmap_blocks;
-		limit = sbi->nzones - sbi->firstdatazone - 1;
 	} else {
 		/* bid == BMAP_INODE */
 		search = &sbi->isearch;
-		start_block = 2;
-		nblocks = sbi->ibmap_blocks;
-		limit = sbi->ninodes - 1;
 	}
 	bits_per_block = sbi->block_size * 8;
Index: uspace/srv/fs/mfs/mfs_ops.c
===================================================================
--- uspace/srv/fs/mfs/mfs_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/mfs/mfs_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -64,4 +64,7 @@
 static int mfs_check_sanity(struct mfs_sb_info *sbi);
 static bool is_power_of_two(uint32_t n);
+static uint32_t mfs_size_block(service_id_t service_id);
+static uint64_t mfs_total_block(service_id_t service_id);
+static uint64_t mfs_free_block(service_id_t service_id);
 
 static hash_table_t open_nodes;
@@ -84,5 +87,8 @@
 	.destroy = mfs_destroy_node,
 	.has_children = mfs_has_children,
-	.lnkcnt_get = mfs_lnkcnt_get
+	.lnkcnt_get = mfs_lnkcnt_get,
+	.size_block = mfs_size_block,
+	.total_block = mfs_total_block,
+	.free_block = mfs_free_block
 };
 
@@ -1129,4 +1135,57 @@
 }
 
+static uint32_t
+mfs_size_block(service_id_t service_id)
+{
+	uint32_t block_size;
+
+	struct mfs_instance *inst;
+	int rc = mfs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+	if (NULL == inst)
+		return ENOENT;
+	
+	block_size = inst->sbi->block_size;
+
+	return block_size;
+}
+
+static uint64_t
+mfs_total_block(service_id_t service_id)
+{
+	uint64_t block_total;
+	
+	struct mfs_instance *inst;
+	int rc = mfs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+
+	if (NULL == inst)
+		return ENOENT;
+	
+	block_total = (uint64_t)inst->sbi->nzones;
+
+	return block_total;
+}
+
+static uint64_t
+mfs_free_block(service_id_t service_id)
+{
+	uint32_t block_free;
+	
+	struct mfs_instance *inst;
+	int rc = mfs_instance_get(service_id, &inst);
+	if (rc != EOK)
+		return rc;
+
+	if (NULL == inst)
+		return ENOENT;
+
+	mfs_count_free_zones(inst, &block_free);
+
+	return (uint64_t)block_free;
+}
+
 vfs_out_ops_t mfs_ops = {
 	.mounted = mfs_mounted,
Index: uspace/srv/fs/udf/udf_ops.c
===================================================================
--- uspace/srv/fs/udf/udf_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/fs/udf/udf_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -249,4 +249,17 @@
 }
 
+static uint32_t udf_size_block(service_id_t service_id)
+{
+	udf_instance_t *instance;
+	int rc = fs_instance_get(service_id, (void **) &instance);
+	if (rc != EOK)
+		return rc;
+
+	if (NULL == instance)
+		return ENOENT;
+	
+	return instance->volumes[DEFAULT_VOL].logical_block_size;
+}
+
 libfs_ops_t udf_libfs_ops = {
 	.root_get = udf_root_get,
@@ -265,5 +278,6 @@
 	.is_directory = udf_is_directory,
 	.is_file = udf_is_file,
-	.service_get = udf_service_get
+	.service_get = udf_service_get,
+	.size_block = udf_size_block
 };
 
Index: uspace/srv/vfs/vfs.c
===================================================================
--- uspace/srv/vfs/vfs.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/vfs/vfs.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -130,4 +130,7 @@
 			vfs_get_mtab(callid, &call);
 			break;
+		case VFS_IN_STATFS:
+			vfs_statfs(callid, &call);
+			break;
 		default:
 			async_answer_0(callid, ENOTSUP);
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/vfs/vfs.h	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -222,4 +222,5 @@
 extern void vfs_wait_handle(ipc_callid_t, ipc_call_t *);
 extern void vfs_get_mtab(ipc_callid_t, ipc_call_t *);
+extern void vfs_statfs(ipc_callid_t, ipc_call_t *);
 
 #endif
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 956d42816cbf5fd14e6440905bfa3626ab82a05b)
+++ uspace/srv/vfs/vfs_ops.c	(revision b86a32ebc441f6ac34403513e2fad30f2cc1742a)
@@ -1418,4 +1418,58 @@
 }
 
+void vfs_statfs(ipc_callid_t rid, ipc_call_t *request)
+{
+	char *path;
+	int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
+	if (rc != EOK) {
+		async_answer_0(rid, rc);
+		return;
+	}
+	
+	ipc_callid_t callid;
+	if (!async_data_read_receive(&callid, NULL)) {
+		free(path);
+		async_answer_0(callid, EINVAL);
+		async_answer_0(rid, EINVAL);
+		return;
+	}
+
+	vfs_lookup_res_t lr;
+	fibril_rwlock_read_lock(&namespace_rwlock);
+	rc = vfs_lookup_internal(path, L_NONE, &lr, NULL);
+	free(path);
+	if (rc != EOK) {
+		fibril_rwlock_read_unlock(&namespace_rwlock);
+		async_answer_0(callid, rc);
+		async_answer_0(rid, rc);
+		return;
+	}
+	vfs_node_t *node = vfs_node_get(&lr);
+	if (!node) {
+		fibril_rwlock_read_unlock(&namespace_rwlock);
+		async_answer_0(callid, ENOMEM);
+		async_answer_0(rid, ENOMEM);
+		return;
+	}
+
+	fibril_rwlock_read_unlock(&namespace_rwlock);
+
+	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
+	
+	aid_t msg;
+	msg = async_send_3(exch, VFS_OUT_STATFS, node->service_id,
+	    node->index, false, NULL);
+	async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
+	
+	vfs_exchange_release(exch);
+	
+	sysarg_t rv;
+	async_wait_for(msg, &rv);
+
+	async_answer_0(rid, rv);
+
+	vfs_node_put(node);
+}
+
 /**
  * @}
