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 Copiar o linkLink copiado para a área de transferência!
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 Copiar o linkLink copiado para a área de transferência!
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>/
ftp://<your_ftp_server_domain>/
Example 6.2. A URI string pointing to a text file on FTP
ssh://<username>@<your_ftp_server_domain>/home/<username>/<file_name>.txt
ssh://<username>@<your_ftp_server_domain>/home/<username>/<file_name>.txt
6.3. Mounting a storage volume in GNOME Copiar o linkLink copiado para a área de transferência!
You can manually mount a local storage volume or a network share in the Files application.
Procedure
- Open the Files application.
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.
- Enter the GVFS URI string to the network share in the Enter server address field.
- Press .
- If the dialog asks you for login credentials, enter your name and password into the relevant fields.
- When the mounting process finishes, you can browse the files on the volume or network share.
6.4. Unmounting a storage volume in GNOME Copiar o linkLink copiado para a área de transferência!
You can unmount a storage volume, a network share, or another resource in the Files application.
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
- Open the Files application.
- In the side bar, click the Unmount (⏏) icon next to the chosen mount.
- 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 Copiar o linkLink copiado para a área de transferência!
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.
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 Copiar o linkLink copiado para a área de transferência!
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.
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 Copiar o linkLink copiado para a área de transferência!
The following section provides a few examples of the GIO commands usage.
List all files in the local /tmp
directory
gio list file:///tmp
$ gio list file:///tmp
List the content of a text file from a remote system
gio cat ssh://joe@ftp.myserver.net/home/joe/todo.txt
$ gio cat ssh://joe@ftp.myserver.net/home/joe/todo.txt
Copy the previous text file to a local /tmp
directory
gio copy ssh://joe@ftp.myserver.net/home/joe/todo.txt /tmp/
$ gio copy ssh://joe@ftp.myserver.net/home/joe/todo.txt /tmp/
6.8. Overview of GVFS metadata Copiar o linkLink copiado para a área de transferência!
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.
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 Copiar o linkLink copiado para a área de transferência!
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
Create an empty file:
touch /tmp/myfile
$ touch /tmp/myfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the metadata of this file:
gio info -a 'metadata::*' /tmp/myfile
$ gio info -a 'metadata::*' /tmp/myfile uri: file:///tmp/myfile attributes:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set a string to this file:
gio set -t string /tmp/myfile 'metadata::mynote' 'Please remember to delete this file!'
$ gio set -t string /tmp/myfile 'metadata::mynote' 'Please remember to delete this file!'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the metadata:
gio info -a 'metadata::*' /tmp/myfile
$ gio info -a 'metadata::*' /tmp/myfile uri: file:///tmp/myfile attributes: metadata::mynote: Please remember to delete this file!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The metadata persists when you move the file by using the GIO API.
6.10. Password management of GVFS mounts Copiar o linkLink copiado para a área de transferência!
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 Copiar o linkLink copiado para a área de transferência!
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.
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) andftpis
(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 Copiar o linkLink copiado para a área de transferência!
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 Copiar o linkLink copiado para a área de transferência!
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
$ dnf install gvfs-fuse
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Ensure that
gvfs-fuse
is running.ps ax | grep gvfsd-fuse
$ ps ax | grep gvfsd-fuse
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If
gvfs-fuse
is not running, log out and log back in. You must not startgvfs-fuse
manually.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
$ id -u
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If
gvfsd-fuse
is still not running, start thegvfsd-fuse
daemon:/usr/libexec/gvfsd-fuse -f /run/user/UID/gvfs
$ /usr/libexec/gvfsd-fuse -f /run/user/UID/gvfs
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now, the FUSE mount is available, and you can manually browse for the path in your application.
-
Find the GVFS mounts under the
/run/user/UID/gvfs/
or~/.gvfs
locations.
6.12.2. Troubleshooting an invisible connected USB disk Copiar o linkLink copiado para a área de transferência!
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
- Open the Disks application.
- Select the disk in the side bar.
- Below Volumes, click Additional partition options > Edit Mount Options
- Click Show in user interface.
- Confirm by clicking .
- 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 Copiar o linkLink copiado para a área de transferência!
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
- Open the Disks application.
- Select the disk in the side bar.
- Below Volumes, click Additional partition options > Edit Mount Options
- Clear Show in user interface.
- Confirm by clicking .
6.12.5. Troubleshooting a busy disk in GNOME Copiar o linkLink copiado para a área de transferência!
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
# dnf install iotop
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Examine the list of open files.
-
Run the
lsof
command to get the list of open files. -
If
lsof
is not available, run theps ax
command. - You can use System Monitor to display the running processes in a GUI.
-
Run the
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.
-
On the command line, run the