Index: uspace/drv/bus/usb/usbmast/main.c
===================================================================
--- uspace/drv/bus/usb/usbmast/main.c	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/drv/bus/usb/usbmast/main.c	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -85,4 +85,5 @@
 static int usbmast_bd_close(bd_srv_t *);
 static int usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
 static int usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
 static int usbmast_bd_get_block_size(bd_srv_t *, size_t *);
@@ -93,4 +94,5 @@
 	.close = usbmast_bd_close,
 	.read_blocks = usbmast_bd_read_blocks,
+	.sync_cache = usbmast_bd_sync_cache,
 	.write_blocks = usbmast_bd_write_blocks,
 	.get_block_size = usbmast_bd_get_block_size,
@@ -338,4 +340,12 @@
 }
 
+/** Synchronize blocks to nonvolatile storage. */
+static int usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
+{
+	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
+
+	return usbmast_sync_cache(mfun, ba, cnt);
+}
+
 /** Write blocks to the device. */
 static int usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
Index: uspace/drv/bus/usb/usbmast/scsi_ms.c
===================================================================
--- uspace/drv/bus/usb/usbmast/scsi_ms.c	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/drv/bus/usb/usbmast/scsi_ms.c	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -383,4 +383,51 @@
 }
 
+/** Perform SCSI Synchronize Cache command on USB mass storage device.
+ *
+ * @param mfun		Mass storage function
+ * @param ba		Address of first block
+ * @param nblocks	Number of blocks to read
+ * @param data		Data to write
+ *
+ * @return		Error code
+ */
+int usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
+{
+	scsi_cmd_t cmd;
+	scsi_cdb_sync_cache_10_t cdb;
+	int rc;
+
+	if (ba > UINT32_MAX)
+		return ELIMIT;
+
+	if (nblocks > UINT16_MAX)
+		return ELIMIT;
+
+	memset(&cdb, 0, sizeof(cdb));
+	cdb.op_code = SCSI_CMD_SYNC_CACHE_10;
+	cdb.lba = host2uint32_t_be(ba);
+	cdb.numlb = host2uint16_t_be(nblocks);
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.cdb = &cdb;
+	cmd.cdb_size = sizeof(cdb);
+
+	rc = usbmast_run_cmd(mfun, &cmd);
+
+        if (rc != EOK) {
+		usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.\n",
+		   ddf_dev_get_name(mfun->mdev->ddf_dev), str_error(rc));
+		return rc;
+	}
+
+	if (cmd.status != CMDS_GOOD) {
+		usb_log_error("Synchronize Cache (10) command failed, device %s.\n",
+		   ddf_dev_get_name(mfun->mdev->ddf_dev));
+		return EIO;
+	}
+
+	return EOK;
+}
+
 /**
  * @}
Index: uspace/drv/bus/usb/usbmast/scsi_ms.h
===================================================================
--- uspace/drv/bus/usb/usbmast/scsi_ms.h	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/drv/bus/usb/usbmast/scsi_ms.h	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -64,4 +64,5 @@
 extern int usbmast_read(usbmast_fun_t *, uint64_t, size_t, void *);
 extern int usbmast_write(usbmast_fun_t *, uint64_t, size_t, const void *);
+extern int usbmast_sync_cache(usbmast_fun_t *, uint64_t, size_t);
 extern const char *usbmast_scsi_dev_type_str(unsigned);
 
Index: uspace/lib/block/block.c
===================================================================
--- uspace/lib/block/block.c	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/block/block.c	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -194,4 +194,6 @@
 	if (devcon->cache)
 		(void) block_cache_fini(service_id);
+	
+	(void)bd_sync_cache(devcon->bd, 0, 0);
 	
 	devcon_remove(devcon);
Index: uspace/lib/c/generic/bd.c
===================================================================
--- uspace/lib/c/generic/bd.c	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/c/generic/bd.c	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -150,4 +150,15 @@
 }
 
+int bd_sync_cache(bd_t *bd, aoff64_t ba, size_t cnt)
+{
+	async_exch_t *exch = async_exchange_begin(bd->sess);
+
+	int rc = async_req_3_0(exch, BD_SYNC_CACHE, LOWER32(ba),
+	    UPPER32(ba), cnt);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
 int bd_get_block_size(bd_t *bd, size_t *rbsize)
 {
Index: uspace/lib/c/generic/bd_srv.c
===================================================================
--- uspace/lib/c/generic/bd_srv.c	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/c/generic/bd_srv.c	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -128,4 +128,23 @@
 }
 
+static void bd_sync_cache_srv(bd_srv_t *srv, ipc_callid_t callid,
+    ipc_call_t *call)
+{
+	aoff64_t ba;
+	size_t cnt;
+	int rc;
+
+	ba = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
+	cnt = IPC_GET_ARG3(*call);
+
+	if (srv->srvs->ops->sync_cache == NULL) {
+		async_answer_0(callid, ENOTSUP);
+		return;
+	}
+
+	rc = srv->srvs->ops->sync_cache(srv, ba, cnt);
+	async_answer_0(callid, rc);
+}
+
 static void bd_write_blocks_srv(bd_srv_t *srv, ipc_callid_t callid,
     ipc_call_t *call)
@@ -244,4 +263,7 @@
 			bd_read_toc_srv(srv, callid, &call);
 			break;
+		case BD_SYNC_CACHE:
+			bd_sync_cache_srv(srv, callid, &call);
+			break;
 		case BD_WRITE_BLOCKS:
 			bd_write_blocks_srv(srv, callid, &call);
Index: uspace/lib/c/include/bd.h
===================================================================
--- uspace/lib/c/include/bd.h	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/c/include/bd.h	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -48,4 +48,5 @@
 extern int bd_read_toc(bd_t *, uint8_t, void *, size_t);
 extern int bd_write_blocks(bd_t *, aoff64_t, size_t, const void *, size_t);
+extern int bd_sync_cache(bd_t *, aoff64_t, size_t);
 extern int bd_get_block_size(bd_t *, size_t *);
 extern int bd_get_num_blocks(bd_t *, aoff64_t *);
Index: uspace/lib/c/include/bd_srv.h
===================================================================
--- uspace/lib/c/include/bd_srv.h	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/c/include/bd_srv.h	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -62,4 +62,5 @@
 	int (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t);
 	int (*read_toc)(bd_srv_t *, uint8_t, void *, size_t);
+	int (*sync_cache)(bd_srv_t *, aoff64_t, size_t);
 	int (*write_blocks)(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
 	int (*get_block_size)(bd_srv_t *, size_t *);
Index: uspace/lib/c/include/ipc/bd.h
===================================================================
--- uspace/lib/c/include/ipc/bd.h	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/c/include/ipc/bd.h	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -42,4 +42,5 @@
 	BD_GET_NUM_BLOCKS,
 	BD_READ_BLOCKS,
+	BD_SYNC_CACHE,
 	BD_WRITE_BLOCKS,
 	BD_READ_TOC
Index: uspace/lib/scsi/include/scsi/sbc.h
===================================================================
--- uspace/lib/scsi/include/scsi/sbc.h	(revision f27f3fd3d0757456b4c88e34e107b9fc2f73a1c8)
+++ uspace/lib/scsi/include/scsi/sbc.h	(revision 95fe55cac78ac183464a76737f6fde227e0734ca)
@@ -50,4 +50,7 @@
 	SCSI_CMD_READ_CAPACITY_16	= 0x9e,
 
+	SCSI_CMD_SYNC_CACHE_10		= 0x35,
+	SCSI_CMD_SYNC_CACHE_16		= 0x91,
+
 	SCSI_CMD_WRITE_6		= 0x0a,
 	SCSI_CMD_WRITE_10		= 0x2a,
@@ -131,4 +134,36 @@
 } scsi_read_capacity_10_data_t;
 
+/** SCSI Synchronize Cache (10) command */
+typedef struct {
+	/** Operation code (SCSI_CMD_SYNC_CACHE_10) */
+	uint8_t op_code;
+	/** Reserved, Sync_NV, Immed, Reserved */
+	uint8_t flags;
+	/** Logical block address */
+	uint32_t lba;
+	/** Reserved, Group Number */
+	uint8_t group_no;
+	/** Number of Logical Blocks */
+	uint16_t numlb;
+	/** Control */
+	uint8_t control;
+} __attribute__((packed)) scsi_cdb_sync_cache_10_t;
+
+/** SCSI Synchronize Cache (16) command */
+typedef struct {
+	/** Operation code (SCSI_CMD_SYNC_CACHE_16) */
+	uint8_t op_code;
+	/** Reserved, Sync_NV, Immed, Reserved */
+	uint8_t flags;
+	/** Logical block address */
+	uint64_t lba;
+	/** Number of Logical Blocks */
+	uint32_t numlb;
+	/** Reserved, Group Number */
+	uint8_t group_no;
+	/** Control */
+	uint8_t control;
+} __attribute__((packed)) scsi_cdb_sync_cache_16_t;
+
 /** SCSI Write (10) command */
 typedef struct {
