Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision 12bdc9428585089043dc519ce8c05218ed3f0817)
+++ uspace/srv/fs/fat/fat_fat.c	(revision 3a8faba762427c7f3a16c13530379da5835fb469)
@@ -359,4 +359,8 @@
 	uint16_t rscnt;
 	uint16_t sf;
+	uint16_t ts;
+	unsigned rde;
+	unsigned rds;
+	unsigned ssa;
 	block_t *blk;
 	fat_cluster_t *lifo;	/* stack for storing free cluster numbers */ 
@@ -372,4 +376,10 @@
 	rscnt = uint16_t_le2host(bs->rscnt);
 	sf = uint16_t_le2host(bs->sec_per_fat);
+	rde = uint16_t_le2host(bs->root_ent_max);
+	ts = uint16_t_le2host(bs->totsec16);
+
+	rds = (sizeof(fat_dentry_t) * rde) / bps;
+	rds += ((sizeof(fat_dentry_t) * rde) % bps != 0);
+	ssa = rscnt + bs->fatcnt * sf + rds;
 	
 	/*
@@ -382,4 +392,17 @@
 			goto error;
 		for (c = 0; c < bps / sizeof(fat_cluster_t); c++, cl++) {
+			/*
+			 * Check if the cluster is physically there. This check
+			 * becomes necessary when the file system is created
+			 * with fewer total sectors than how many is inferred
+			 * from the size of the file allocation table.
+			 */
+			if ((cl - 2) * bs->spc + ssa >= ts) {
+				rc = block_put(blk);
+				if (rc != EOK)
+					goto error;
+				goto out;
+			}
+
 			fat_cluster_t *clst = (fat_cluster_t *)blk->data + c;
 			if (uint16_t_le2host(*clst) == FAT_CLST_RES0) {
@@ -419,4 +442,5 @@
 		}
 	}
+out:
 	fibril_mutex_unlock(&fat_alloc_lock);
 
