Index: uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 286286c5dfab310b2f006338cff4f2898bce1ca2)
+++ uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision fb45c7be00697b929cb4f8548767ae72242ce60d)
@@ -54,4 +54,5 @@
 static struct option const long_options[] = {
 	{"size", required_argument, 0, 's'},
+	{"sparse", no_argument, 0, 'p'},
 	{"help", no_argument, 0, 'h'},
 	{0, 0, 0, 0}
@@ -69,4 +70,5 @@
 		"  -h, --help       A short option summary\n"
 		"  -s, --size sz    Size of the file\n"
+		"  -p, --sparse     Create a sparse file\n"
 		"\n"
 		"Size is a number followed by 'k', 'm' or 'g' for kB, MB, GB.\n"
@@ -115,7 +117,8 @@
 	ssize_t file_size;
 	ssize_t total_written;
-	ssize_t to_write, rc;
+	ssize_t to_write, rc, rc2 = 0;
 	char *file_name;
 	void *buffer;
+	bool create_sparse = false;
 
 	file_size = 0;
@@ -124,9 +127,12 @@
 
 	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "s:h", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "ps:h", long_options, &opt_ind);
 		switch (c) {
 		case 'h':
 			help_cmd_mkfile(HELP_LONG);
 			return CMD_SUCCESS;
+		case 'p':
+			create_sparse = true;
+			break;
 		case 's':
 			file_size = read_size(optarg);
@@ -154,4 +160,14 @@
 		printf("%s: failed to create file %s.\n", cmdname, file_name);
 		return CMD_FAILURE;
+	}
+
+	if (create_sparse && file_size > 0) {
+		const char byte = 0x00;
+
+		if ((rc2 = lseek(fd, file_size - 1, SEEK_SET)) < 0)
+			goto exit;
+
+		rc2 = write(fd, &byte, sizeof(char));
+		goto exit;
 	}
 
@@ -174,11 +190,12 @@
 	}
 
+	free(buffer);
+exit:
 	rc = close(fd);
-	if (rc != 0) {
+
+	if (rc != 0 || rc2 < 0) {
 		printf("%s: Error writing file (%zd).\n", cmdname, rc);
 		return CMD_FAILURE;
 	}
-
-	free(buffer);
 
 	return CMD_SUCCESS;
