How about: Create a GFile Code: GFile * g_file_new_for_path (const char *path); Get the enclosing mount for that GFile Code: GMount * g_file_find_enclosing_mount (GFile *file, GCancellable *cancellable, GError **error); or Code: void g_file_find_enclosing_mount_async (GFile *file, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); Then get the volume from the mount Code: GVolume * g_mount_get_volume (GMount *mount);
GFile * g_file_new_for_path (const char *path);
GMount * g_file_find_enclosing_mount (GFile *file, GCancellable *cancellable, GError **error);
void g_file_find_enclosing_mount_async (GFile *file, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
GVolume * g_mount_get_volume (GMount *mount);