Este conteúdo não está disponível no idioma selecionado.

Chapter 6. Managing storage volumes in GNOME


GNOME Virtual File System (GVFS) is an extension that hides the details of storage from applications to act like a standard file system. The virtual file system is independent of hardware and device drivers.

6.1. The GVFS system

GNOME Virtual File System (GVFS) uses addresses for full identification based on the Uniform Resource Identifier (URI) standard, syntactically similar to URL addresses in web browsers. These addresses in the form of schema://user@server/path are the key information determining the kind of service.

GVFS helps to mount the resources. These mounts are shared between multiple applications. Resources are tracked globally within the running desktop session, which means that even if you quit an application that triggered the mount, the mount continues to be available for any other application. Multiple applications can access the mount at the same time unless it is limited by a back end. Some protocols by design permit only a single channel.

GVFS mounts removable media in the /run/media/ directory.

6.2. The format of the GVFS URI string

You must form a URI string to use back-end services. This string is a basic identifier used in GVFS, which carries all necessary information needed for unique identification, such as type of service, back-end ID, absolute path, or user name if required. You can see this information in the Files address bar and GTK+ open or save file dialog.

The following example is a very basic form of the URI string, which points to a root directory (/) of the File Transfer Protocol (FTP) server running at the <your_ftp_server> domain:

Example 6.1. A URI string pointing to the root FTP directory

ftp://<your_ftp_server_domain>/
Copy to Clipboard Toggle word wrap

Example 6.2. A URI string pointing to a text file on FTP

ssh://<username>@<your_ftp_server_domain>/home/<username>/<file_name>.txt
Copy to Clipboard Toggle word wrap

6.3. Mounting a storage volume in GNOME

You can manually mount a local storage volume or a network share in the Files application.

Procedure

  1. Open the Files application.
  2. Click Other Locations in the side bar.

    The window lists all connected storage volumes and all network shares that are publicly available on your local area network.

    If you can see the volume or network share in this list, mount it by clicking the item.

    If you want to connect to a different network share, use the following steps.

  3. Enter the GVFS URI string to the network share in the Enter server address field.
  4. Press Connect.
  5. If the dialog asks you for login credentials, enter your name and password into the relevant fields.
  6. When the mounting process finishes, you can browse the files on the volume or network share.

6.4. Unmounting a storage volume in GNOME

You can unmount a storage volume, a network share, or another resource in the Files application.

Warning

Always unmount a storage volume before removing the drive from the computer. Removing a drive might corrupt the data on the volumes that are still mounted.

Procedure

  1. Open the Files application.
  2. In the side bar, click the Unmount (⏏) icon next to the chosen mount.
  3. Wait until the mount disappears from the side bar or a notification about the safe removal appears.

6.5. Access to GVFS mounts in the file system

Learn more about File System in Userspace (FUSE), the main daemon for the GNOME Virtual File System (GVFS).

Applications built with the GIO library can access GVFS mounts. In addition, GVFS provides a FUSE daemon which exposes active GVFS mounts. Any application can access active GVFS mounts by using the standard POSIX APIs as though mounts were regular file systems.

In certain applications, additional library dependency and new virtual file system (VFS) subsystem specifics might be unsuitable or too complicated. For such reasons and to boost compatibility, GVFS provides a File System in Userspace (FUSE) daemon, which exposes active mounts through its mount for standard Portable Operating System Interface (POSIX) access. This daemon transparently translates incoming requests to imitate a local file system for applications.

Important

You might experience difficulties with certain combinations of applications and GVFS back ends.

The FUSE daemon starts automatically with the main gvfs daemon and mounts volumes either in the /run/user/UID/gvfs/ or ~/.gvfs/ directories as a fallback.

Manual browsing shows individual directories for each GVFS mount. The system passes the transformed path as an argument when you are opening documents from GVFS locations with non-native applications. Note that native GIO applications automatically translate this path back to a native URI.

6.6. Available GIO commands

GIO (GNOME Integrated Objects) is a library and an API to access various file system types and data sources within the GNOME desktop environment. GIO allows applications to interact with the sources such as local files, network shares, databases, web services and so on.

GIO provides several commands that might be useful for scripting or testing.

GIO uses the following commands that correspond to POSIX commands:

gio cat
Displays the content of a file.
gio mkdir
Creates a new directory.
gio rename
Renames a file.
gio mount
Provides access to various aspects of the gio mounting functionality.
gio set
Sets a file attribute on a file.
gio copy
Makes a copy of a file.
gio list
Lists directory contents.
gio move
Moves a file from one location to another.
gio remove
Removes a file.
gio trash
Sends files or directories to the Trashcan. This can be a different folder depending on where the file is located, and not all file systems support this concept. In the common case that the file lives inside a user’s home directory, the trash folder is $XDG_DATA_HOME/Trash.
gio info
Displays information of the given locations.
gio save
Reads from standard input and saves the data to the given location.
gio tree
Lists the contents of the given locations recursively, in a tree-like format. If no location is given, it defaults to the current directory.

You can control GIO specifics with the following additional commands:

gio monitor
Monitors files or directories for changes, such as creation, deletion, content and attribute changes, and mount and unmount operations affecting the monitored locations.
gio mime
Lists the registered and recommended applications for the mimetype if no handler is given, else, it is set as the default handler for the mimetype.
gio open
Opens files with the default application that is registered to handle files of this type.
Note

For user convenience, bash completion is provided as a part of the package.

All these commands are native GIO clients, there is no need for the fallback FUSE daemon to be running. Their purpose is not to be drop-in replacements for POSIX commands, in fact, a very little range of switches is supported. In their basic form, these commands take an URI string as an argument instead of a local path.

6.7. Sample GIO commands

The following section provides a few examples of the GIO commands usage.

List all files in the local /tmp directory

$ gio list file:///tmp
Copy to Clipboard Toggle word wrap

List the content of a text file from a remote system

$ gio cat ssh://joe@ftp.myserver.net/home/joe/todo.txt
Copy to Clipboard Toggle word wrap

Copy the previous text file to a local /tmp directory

$ gio copy ssh://joe@ftp.myserver.net/home/joe/todo.txt /tmp/
Copy to Clipboard Toggle word wrap

6.8. Overview of GVFS metadata

GNOME Virtual File System (GVFS) metadata storage is implemented as a set of key-and-value pairs that bind information to a particular file. GNOME applications rely on GIO (GNOME Integrated Objects) to access files and data. With GIO, you can save metadata for runtime information such as icon position, last-played location, position in a document, emblems, notes, and so on.

Whenever you move a file or directory, GVFS moves the metadata of that file or directory at the same time. The GVFS stores all metadata privately, so metadata is available only on the machine. However, GVFS tracks mounts and removable media as well.

Note

GVFS mounts removable media in the /run/media/ directory.

To view and manipulate with metadata, you can use:

  • the gio info command,
  • the gio set command, or
  • any other native GIO way of working with attributes.

6.9. Setting custom GIO metadata attribute

GIO (GNOME Integrated Objects) allows applications to attach metadata to the files. You can add and manage your own custom metadata attributes using GIO to determine how applications interact with specific files and provide more detailed information about them.

Procedure

  1. Create an empty file:

    $ touch /tmp/myfile
    Copy to Clipboard Toggle word wrap
  2. View the metadata of this file:

    $ gio info -a 'metadata::*' /tmp/myfile
    uri: file:///tmp/myfile
    attributes:
    Copy to Clipboard Toggle word wrap
  3. Set a string to this file:

    $ gio set -t string /tmp/myfile 'metadata::mynote' 'Please remember to delete this file!'
    Copy to Clipboard Toggle word wrap
  4. View the metadata:

    $ gio info -a 'metadata::*' /tmp/myfile
    uri: file:///tmp/myfile
    attributes:
      metadata::mynote: Please remember to delete this file!
    Copy to Clipboard Toggle word wrap

The metadata persists when you move the file by using the GIO API.

6.10. Password management of GVFS mounts

Learn more about the GNOME Virtual File System (GVFS) mount authentication.

A typical GVFS mount authenticates on its activation unless the resource allows anonymous authentication or does not require any authentication at all.

In a standard GTK+ dialog, you can choose whether to store the password.

When you select the persistent storage, the password is stored in the user keyring. GNOME Keyring is a central place for secrets storage. The password is encrypted and automatically unlocked on desktop session start by using the password provided on login. For protecting it by a different password, you can set the password at the first use.

The Passwords and Keys application helps to manage the stored password and GNOME Keyring. It allows removing individual records or changing passwords.

6.11. GVFS back ends

Back ends in GNOME Virtual File System (GVFS) provide access to a specific type of resource. This section provides a list of available GVFS back ends and their specifications.

Note

Some back ends are packaged separately and not installed by default. For installing additional back ends, use the dnf package manager.

The available GVFS back ends are:

admin
Provides administrator access to the local file system.
burn
A virtual back end that burning applications use as a temporary storage for new CD, DVD, or BD medium content.
cdda
Exposes Audio CD through separate Waveform Audio File Format (WAV) files.
computer
A virtual back end consolidating active mounts and physical volumes. Acts similarly to a signpost. Previously used by Files for its Computer view.
dav, davs
A WebDAV client, including secure variant. Authentication is possible only during mount. The back end does not support later re-authentication on per-folder basis.
dns-sd
DNS Service Discovery: An Avahi client, used during network browsing, forms persistent URIs to discovered services.
ftp
A fully featured File Transfer Protocol (FTP) client. Supports passive transfers by default. Also, handles secure mode over ftps (explicit mode) and ftpis (implicit mode) schemes.
gphoto2
A Picture Transfer Protocol (PTP) client to access your camera attached by USB or FireWire.
google
Provides access to Google Drive. The Google Drive account needs to be configured in the Online Accounts settings.
http
Handles all HTTP requests. Useful for easy downloading files from web in client applications.
locatest
A simple testing back end that proxies the file:// URI. The back end supports error injection.
mtp
A Media Transfer Protocol (MTP) back end for accessing media player and cell phone memory.
network
Allows you to browse Window Network and show shares discovered over Avahi.
recent
A back end used in the file chooser dialog to list recent files used by GNOME applications.
sftp
A fully-featured SSH File Transfer Protocol (SFTP) client.
smb
Accesses Samba and Windows shares.
trash
A trash back end that allows to restore deleted files.

6.12. Troubleshooting volume management in GNOME

Following are some common errors of volume management in GNOME and ways to resolve them.

6.12.1. Troubleshooting access to GVFS locations from non-GIO clients

If you have problems accessing GVFS locations from your application, it might mean that it is not native GIO client. Native GIO clients are typically all GNOME applications by using GNOME libraries (glib, gio). The gvfs-fuse service is provided as a fallback for non-GIO clients.

Prerequisites

  • The gvfs-fuse package is installed.

    $ dnf install gvfs-fuse
    Copy to Clipboard Toggle word wrap

Procedure

  1. Ensure that gvfs-fuse is running.

    $ ps ax | grep gvfsd-fuse
    Copy to Clipboard Toggle word wrap

    If gvfs-fuse is not running, log out and log back in. You must not start gvfs-fuse manually.

  2. Find the system user ID (UID) for the /run/user/UID/gvfs/ path.

    The gvfsd-fuse daemon requires a path where it can expose its services. When the /run/user/UID/gvfs/ path is unavailable, gvfsd-fuse uses the ~/.gvfs path.

    $ id -u
    Copy to Clipboard Toggle word wrap
  3. If gvfsd-fuse is still not running, start the gvfsd-fuse daemon:

    $ /usr/libexec/gvfsd-fuse -f /run/user/UID/gvfs
    Copy to Clipboard Toggle word wrap

    Now, the FUSE mount is available, and you can manually browse for the path in your application.

  4. Find the GVFS mounts under the /run/user/UID/gvfs/ or ~/.gvfs locations.

6.12.2. Troubleshooting an invisible connected USB disk

When you connect a flash drive, the GNOME Desktop might not display it. If your flash drive is not visible in Files, but you can see it in the Disks application, you can set the Show in user interface option in Disks.

Procedure

  1. Open the Disks application.
  2. Select the disk in the side bar.
  3. Below Volumes, click Additional partition options > Edit Mount Options
  4. Click Show in user interface.
  5. Confirm by clicking OK.
  6. If the flash drive is still not visible, you can try to physically removing and connecting it again.

6.12.3. Troubleshooting unknown or unwanted partitions listed in Files

You might see unknown or unwanted partitions when you plug a disk in. For example, when you plug in a flash disk, it is automatically mounted and its volumes are displayed in the Files side bar. Some devices have a special partition with backups or help files, which you might not want to see each time you plug in the device.

Procedure

  1. Open the Disks application.
  2. Select the disk in the side bar.
  3. Below Volumes, click Additional partition options > Edit Mount Options
  4. Clear Show in user interface.
  5. Confirm by clicking OK.

There are number of situations in which the client is unexpectedly and unwillingly disconnected from a virtual file system or a remote disk mount and is not reconnected automatically.

You might see the error messages in such situations. Several causes trigger such situations:

  • The connection is interrupted. For example, your laptop is disconnected from the Wi-Fi.
  • The user is inactive for some time and is disconnected by the server (idle timeout).
  • The computer is resumed from sleep mode.

Procedure

  1. Unmount file system.
  2. Mount it again.
  3. If the connection is getting disabled more often, check the settings in the Network panel in the GNOME Settings.

6.12.5. Troubleshooting a busy disk in GNOME

If you receive a notification about your disk being busy, identify the programs that are accessing the disk. Then, you can end the programs that are running. You can also use the System Monitor application to kill the programs forcefully.

Prerequisites

  • The iotop utility is installed:

    # dnf install iotop
    Copy to Clipboard Toggle word wrap

Procedure

  1. Examine the list of open files.

    • Run the lsof command to get the list of open files.
    • If lsof is not available, run the ps ax command.
    • You can use System Monitor to display the running processes in a GUI.
  2. When you have identified the programs, terminate them using any of the following methods:

    • On the command line, run the kill command.
    • In System Monitor, right-click the line with the program process name, and click End or Kill from the menu.
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat