Index: uspace/srv/fs/fat/fat.c
===================================================================
--- uspace/srv/fs/fat/fat.c	(revision f49b0eaadf4b224dc91c8ee7dec365d4bff11b1c)
+++ uspace/srv/fs/fat/fat.c	(revision cde485d925ad71041a0d21bd2017a6e1860f19be)
@@ -56,4 +56,5 @@
 		[IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_NULL,
 		[IPC_METHOD_TO_VFS_OP(VFS_MOUNT)] = VFS_OP_NULL,
+		[IPC_METHOD_TO_VFS_OP(VFS_MOUNTED)] = VFS_OP_DEFINED,
 		[IPC_METHOD_TO_VFS_OP(VFS_UNMOUNT)] = VFS_OP_NULL,
 	}
@@ -98,4 +99,10 @@
 		callid = async_get_call(&call);
 		switch  (IPC_GET_METHOD(call)) {
+		case VFS_MOUNTED:
+			fat_mounted(callid, &call);
+			break;
+		case VFS_MOUNT:
+			fat_mount(callid, &call);
+			break;
 		case VFS_LOOKUP:
 			fat_lookup(callid, &call);
@@ -111,6 +118,11 @@
 {
 	int vfs_phone;
+	int rc;
 
 	printf("FAT: HelenOS FAT file system server.\n");
+
+	rc = fat_idx_init();
+	if (rc != EOK)
+		goto err;
 
 	vfs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VFS, 0, 0);
@@ -120,9 +132,8 @@
 	}
 	
-	int rc;
 	rc = fs_register(vfs_phone, &fat_reg, &fat_vfs_info, fat_connection);
 	if (rc != EOK) {
-		printf("Failed to register the FAT file system (%d)\n", rc);
-		return rc;
+		fat_idx_fini();
+		goto err;
 	}
 	
@@ -133,4 +144,8 @@
 	/* not reached */
 	return 0;
+
+err:
+	printf("Failed to register the FAT file system (%d)\n", rc);
+	return rc;
 }
 
Index: uspace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision f49b0eaadf4b224dc91c8ee7dec365d4bff11b1c)
+++ uspace/srv/fs/fat/fat.h	(revision cde485d925ad71041a0d21bd2017a6e1860f19be)
@@ -218,8 +218,15 @@
 extern fs_reg_t fat_reg;
 
+extern void fat_mounted(ipc_callid_t, ipc_call_t *);
+extern void fat_mount(ipc_callid_t, ipc_call_t *);
 extern void fat_lookup(ipc_callid_t, ipc_call_t *);
 
 extern fat_idx_t *fat_idx_get_by_pos(dev_handle_t, fat_cluster_t, unsigned);
 extern fat_idx_t *fat_idx_get_by_index(dev_handle_t, fs_index_t);
+
+extern int fat_idx_init(void);
+extern void fat_idx_fini(void);
+extern int fat_idx_init_by_dev_handle(dev_handle_t);
+extern void fat_idx_fini_by_dev_handle(dev_handle_t);
 
 #endif
Index: uspace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision f49b0eaadf4b224dc91c8ee7dec365d4bff11b1c)
+++ uspace/srv/fs/fat/fat_idx.c	(revision cde485d925ad71041a0d21bd2017a6e1860f19be)
@@ -74,4 +74,13 @@
 /** List of unused structures. */
 static LIST_INITIALIZE(unused_head);
+
+static void unused_initialize(unused_t *u, dev_handle_t dev_handle)
+{
+	link_initialize(&u->link);
+	u->dev_handle = dev_handle;
+	u->next = 0;
+	u->remaining = ((uint64_t)((fs_index_t)-1)) + 1;
+	list_initialize(&u->freed_head);
+}
 
 /** Futex protecting the up_hash and ui_hash. */
@@ -402,2 +411,63 @@
 }
 
+int fat_idx_init(void)
+{
+	if (!hash_table_create(&up_hash, UPH_BUCKETS, 3, &uph_ops)) 
+		return ENOMEM;
+	if (!hash_table_create(&ui_hash, UIH_BUCKETS, 2, &uih_ops)) {
+		hash_table_destroy(&up_hash);
+		return ENOMEM;
+	}
+	return EOK;
+}
+
+void fat_idx_fini(void)
+{
+	/* We assume the hash tables are empty. */
+	hash_table_destroy(&up_hash);
+	hash_table_destroy(&ui_hash);
+}
+
+int fat_idx_init_by_dev_handle(dev_handle_t dev_handle)
+{
+	unused_t *u = (unused_t *) malloc(sizeof(unused_t));
+	if (!u)
+		return ENOMEM;
+	unused_initialize(u, dev_handle);
+	futex_down(&unused_futex);
+	list_append(&u->link, &unused_head);
+	futex_up(&unused_futex);
+	return EOK;
+}
+
+void fat_idx_fini_by_dev_handle(dev_handle_t dev_handle)
+{
+	unused_t *u;
+	link_t *l;
+
+	futex_down(&unused_futex);
+	for (l = unused_head.next; l != &unused_head; l = l->next) {
+		u = list_get_instance(l, unused_t, link);
+		if (u->dev_handle == dev_handle) 
+			goto hit;
+	}
+	futex_up(&unused_futex);
+
+	assert(false);	/* should not happen */
+
+hit:
+	list_remove(&u->link);
+	futex_up(&unused_futex);
+
+	while (!list_empty(&u->freed_head)) {
+		freed_t *f;
+		f = list_get_instance(u->freed_head.next, freed_t, link);
+		list_remove(&f->link);
+		free(f);
+	}
+	free(u); 
+}
+
+/**
+ * @}
+ */ 
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision f49b0eaadf4b224dc91c8ee7dec365d4bff11b1c)
+++ uspace/srv/fs/fat/fat_ops.c	(revision cde485d925ad71041a0d21bd2017a6e1860f19be)
@@ -559,4 +559,23 @@
 };
 
+void fat_mounted(ipc_callid_t rid, ipc_call_t *request)
+{
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	int rc;
+
+	rc = fat_idx_init_by_dev_handle(dev_handle);
+	if (rc != EOK) {
+		ipc_answer_0(rid, rc);
+		return;
+	}
+
+	ipc_answer_0(rid, EOK);
+}
+
+void fat_mount(ipc_callid_t rid, ipc_call_t *request)
+{
+	ipc_answer_0(rid, ENOTSUP);
+}
+
 void fat_lookup(ipc_callid_t rid, ipc_call_t *request)
 {
