Index: uspace/srv/bd/hr/hr.c
===================================================================
--- uspace/srv/bd/hr/hr.c	(revision 9a3eec11c53dc88b39ba77db4f3c6c37bdb41da9)
+++ uspace/srv/bd/hr/hr.c	(revision c9ce6d22ba355a1d4bee6ddcf413df7f7a86db77)
@@ -296,15 +296,8 @@
 	errno_t rc = EOK;
 	service_id_t svc_id;
-	hr_volume_t *vol;
 
 	svc_id = ipc_get_arg1(icall);
 
-	vol = hr_get_volume(svc_id);
-	if (vol == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = hr_remove_volume(vol);
+	rc = hr_remove_volume(svc_id);
 
 	async_answer_0(icall, rc);
@@ -319,23 +312,21 @@
 	HR_DEBUG("%s()", __func__);
 
-	hr_volume_t *vol;
+	service_id_t *vol_svcs = NULL;
 	errno_t rc = EOK;
-
-	while (true) {
-		fibril_rwlock_write_lock(&hr_volumes_lock);
-		if (list_empty(&hr_volumes)) {
-			fibril_rwlock_write_unlock(&hr_volumes_lock);
-			break;
-		}
-
-		vol = list_pop(&hr_volumes, hr_volume_t, lvolumes);
-
-		fibril_rwlock_write_unlock(&hr_volumes_lock);
-
-		rc = hr_remove_volume(vol);
+	size_t i, vol_cnt;
+
+	rc = hr_get_volume_svcs(&vol_cnt, &vol_svcs);
+	if (rc != EOK)
+		goto fail;
+
+	for (i = 0; i < vol_cnt; i++) {
+		rc = hr_remove_volume(vol_svcs[i]);
 		if (rc != EOK)
 			break;
 	}
 
+fail:
+	if (vol_svcs != NULL)
+		free(vol_svcs);
 	async_answer_0(icall, rc);
 }
Index: uspace/srv/bd/hr/util.c
===================================================================
--- uspace/srv/bd/hr/util.c	(revision 9a3eec11c53dc88b39ba77db4f3c6c37bdb41da9)
+++ uspace/srv/bd/hr/util.c	(revision c9ce6d22ba355a1d4bee6ddcf413df7f7a86db77)
@@ -215,12 +215,16 @@
 		}
 	}
-
 	fibril_rwlock_read_unlock(&hr_volumes_lock);
+
 	return rvol;
 }
 
-errno_t hr_remove_volume(hr_volume_t *vol)
-{
-	HR_DEBUG("%s()", __func__);
+errno_t hr_remove_volume(service_id_t svc_id)
+{
+	HR_DEBUG("%s()", __func__);
+
+	hr_volume_t *vol = hr_get_volume(svc_id);
+	if (vol == NULL)
+		return ENOENT;
 
 	fibril_rwlock_write_lock(&hr_volumes_lock);
@@ -228,4 +232,5 @@
 	int open_cnt = atomic_load_explicit(&vol->open_cnt,
 	    memory_order_relaxed);
+
 	/*
 	 * The atomicity of this if condition (and this whole
@@ -246,6 +251,4 @@
 	/* save metadata, but we don't care about states anymore */
 	(void)vol->meta_ops->save(vol, NO_STATE_CALLBACK);
-
-	service_id_t svc_id = vol->svc_id;
 
 	HR_NOTE("deactivating volume \"%s\"\n", vol->devname);
Index: uspace/srv/bd/hr/util.h
===================================================================
--- uspace/srv/bd/hr/util.h	(revision 9a3eec11c53dc88b39ba77db4f3c6c37bdb41da9)
+++ uspace/srv/bd/hr/util.h	(revision c9ce6d22ba355a1d4bee6ddcf413df7f7a86db77)
@@ -72,5 +72,5 @@
 extern errno_t		 hr_get_volume_svcs(size_t *, service_id_t **);
 extern hr_volume_t	*hr_get_volume(service_id_t);
-extern errno_t		 hr_remove_volume(hr_volume_t *);
+extern errno_t		 hr_remove_volume(service_id_t);
 extern errno_t		 hr_init_extents_from_cfg(hr_volume_t *, hr_config_t *);
 extern void		 hr_fini_devs(hr_volume_t *);
