Index: uspace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision dccf72146c31b468c546d35ed8f671e5e26cda76)
+++ uspace/srv/bd/file_bd/file_bd.c	(revision 1ac3a52793b357f936bd41ef49db586aa1e5c1a3)
@@ -56,4 +56,5 @@
 
 static const size_t block_size = 512;
+static bn_t num_blocks;
 static FILE *img;
 
@@ -99,4 +100,5 @@
 {
 	int rc;
+	long img_size;
 
 	rc = devmap_driver_register(NAME, file_bd_connection);
@@ -109,4 +111,17 @@
 	if (img == NULL)
 		return EINVAL;
+
+	if (fseek(img, 0, SEEK_END) != 0) {
+		fclose(img);
+		return EIO;
+	}
+
+	img_size = ftell(img);
+	if (img_size < 0) {
+		fclose(img);
+		return EIO;
+	}
+
+	num_blocks = img_size / block_size;
 
 	fibril_mutex_initialize(&dev_lock);
@@ -174,4 +189,8 @@
 			ipc_answer_1(callid, EOK, block_size);
 			continue;
+		case BD_GET_NUM_BLOCKS:
+			ipc_answer_2(callid, EOK, LOWER32(num_blocks),
+			    UPPER32(num_blocks));
+			continue;
 		default:
 			retval = EINVAL;
