Index: uspace/srv/volsrv/part.c
===================================================================
--- uspace/srv/volsrv/part.c	(revision f0f87879a2e9616ccbf28e95d70d5e6ec25cf738)
+++ uspace/srv/volsrv/part.c	(revision b82985e38dd735e0d27cc640ce20c07827880201)
@@ -297,15 +297,20 @@
 }
 
-/** Mount partition.
+/** Determine actual mount path to be used for a partition.
  *
  * @param part Partition
- */
-static errno_t vol_part_mount(vol_part_t *part)
+ * @param rpath Place to store pointer to newly allocated string or @c NULL
+ *              if volume should not be mounted
+ * @param rauto Place to store boolean flag whether mount point is automatic
+ *
+ * @return EOK on success, ENOMEM if out of memory
+ */
+static errno_t vol_part_determine_mount_path(vol_part_t *part, char **rpath,
+    bool *rauto)
 {
 	const char *cfg_mp;
 	char *mp;
+	bool mp_auto;
 	int err;
-	bool mp_auto;
-	errno_t rc;
 
 	/* Get configured mount point */
@@ -324,5 +329,6 @@
 		if (str_size(part->label) < 1) {
 			/* Don't mount nameless volumes */
-			log_msg(LOG_DEFAULT, LVL_NOTE, "Not mounting nameless volume.");
+			*rpath = NULL;
+			*rauto = false;
 			return EOK;
 		}
@@ -335,4 +341,41 @@
 		}
 
+		mp_auto = true;
+	} else if (str_cmp(cfg_mp, "None") == 0 || str_cmp(cfg_mp, "none") == 0) {
+		mp = NULL;
+		mp_auto = false;
+	} else {
+		mp = str_dup(cfg_mp);
+		mp_auto = false;
+	}
+
+	*rpath = mp;
+	*rauto = mp_auto;
+	return EOK;
+}
+
+/** Mount partition.
+ *
+ * @param part Partition
+ */
+static errno_t vol_part_mount(vol_part_t *part)
+{
+	char *mp;
+	bool mp_auto;
+	errno_t rc;
+
+	rc = vol_part_determine_mount_path(part, &mp, &mp_auto);
+	if (rc != EOK) {
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Error determining mount point.\n");
+		return rc;
+	}
+
+	if (mp == NULL) {
+		log_msg(LOG_DEFAULT, LVL_NOTE, "Not mounting volume.");
+		return EOK;
+	}
+
+	if (mp_auto) {
+		/* Create directory for automatic mount point */
 		log_msg(LOG_DEFAULT, LVL_NOTE, "Create mount point '%s'", mp);
 		rc = vfs_link_path(mp, KIND_DIRECTORY, NULL);
@@ -343,12 +386,4 @@
 			return EIO;
 		}
-
-		mp_auto = true;
-	} else if (str_cmp(cfg_mp, "None") == 0 || str_cmp(cfg_mp, "none") == 0) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Not mounting volume.");
-		return EOK;
-	} else {
-		mp = str_dup(cfg_mp);
-		mp_auto = false;
 	}
 
@@ -545,4 +580,44 @@
 }
 
+/** Find partition by filesystem path.
+ *
+ * @param parts Partitions
+ * @param path Filesystem path
+ * @param rpart Place to store pointer to partition
+ * @return EOK on success, ENOENT if not found, ENOMEM if out of memory
+ */
+errno_t vol_part_find_by_path_ref(vol_parts_t *parts, const char *path,
+    vol_part_t **rpart)
+{
+	errno_t rc;
+	char *mpath;
+	bool mauto;
+
+	fibril_mutex_lock(&parts->lock);
+
+	list_foreach(parts->parts, lparts, vol_part_t, part) {
+		rc = vol_part_determine_mount_path(part, &mpath, &mauto);
+		if (rc != EOK) {
+			fibril_mutex_unlock(&parts->lock);
+			return ENOMEM;
+		}
+
+		if (mpath != NULL && str_cmp(mpath, path) == 0) {
+			/* Add reference */
+			refcount_up(&part->refcnt);
+			fibril_mutex_unlock(&parts->lock);
+			free(mpath);
+			*rpart = part;
+			return EOK;
+		}
+
+		if (mpath != NULL)
+			free(mpath);
+	}
+
+	fibril_mutex_unlock(&parts->lock);
+	return ENOENT;
+}
+
 void vol_part_del_ref(vol_part_t *part)
 {
