Linux, Filesystem: GNOME Virtual File System (GVFS) Remote Connectivity CLI
When not using NFS, Linux administrators generally move files from one server to the next via SFTP or FTP. This can sometimes be a headache when needing to move large amounts of files between the systems. This is where I like GVFS (GNOME Virtual File System). This subsystem allows you to mount remote systems via the following protocols to a local directory tree:
Above are the common protocols supported, but there is support for more. Using GVFS to mount the remote filesystem to yours allows you to create and move files to and from the remote system using typical “cp”, “rm”, and “mv” commands. This makes things even easier if you are working through an X windows console. Just bring up the remote directory structure through a file manager application and work from there. Gnome also uses GVFS to manage USB based storage. The following will go through manually connecting to a server using GVFS.Move into the “.gvfs” filesystem in the users home directory. Unless Gnome has automatically mounted a device, this filesystem should be empty.
user01@LinuxDesk:~$ cd ~/.gvfs
In the below example, a remote servers filesystem will be mounted over an SSH/SFTP session.
user01@LinuxDesk:~/.gvfs$ gvfs-mount ssh://user05@SftpServer02 Enter password Password:
Verify that the location has been mounted.
user01@LinuxDesk:~/.gvfs$ ls sftp for user05 on SftpServer02
The SFTP was mounted and we can now traverse the remote servers filesystem as if it were our own.
user01@LinuxDesk:~/.gvfs$ cd sftp\ for\ user05\ on\ SftpServer02/ user01@LinuxDesk:~/.gvfs/sftp for user05 on SftpServer02$ ls app boot etc hs_err_pid15240.log lib media mnt opt relay sbin srv tmp var bin dev home hs_err_pid8660.log lost+found misc net proc root selinux sys usr
Since we logged into the SSH/SFTP system using user “user05″, we can write to any direcotry that remote user has access to.
user01@LinuxDesk:~/.gvfs/sftp for user05 on SftpServer02$ cd home/user05/
Below creates a new file “asdf” containing the text “asdfasdf”. Here we are just testing write capability to the remote server
user01@LinuxDesk:~/.gvfs/sftp for user05 on SftpServer02/home/user05$ echo "asdfasdf" > asdf user01@LinuxDesk:~/.gvfs/sftp for user05 on SftpServer02/home/user05$ cat asdf asdfasdf
“gvfs-mount” can also be used to list all currently mounted gvfs systems. Below shows only the sftp session.
user01@LinuxDesk:~$ gvfs-mount -l Mount(0): sftp on SftpServer02 -> sftp://SftpServer02/ Type: GDaemonMount
For reference, the following shows my 4gig USB drive that was automatically mounted when attached to the workstation through Gnome.
user01@LinuxDesk:~$ gvfs-mount -l
Drive(0): USB Drive
Type: GProxyDrive (GProxyVolumeMonitorHal)
Volume(0): 4.1 GB Media
Type: GProxyVolume (GProxyVolumeMonitorHal)
Mount(0): 4.1 GB Media -> file:///media/disk
Type: GProxyMount (GProxyVolumeMonitorHal)
Mount(0): sftp on SftpServer02 -> sftp://SftpServer02/
Type: GDaemonMount
GVFS mount points can be un-mounted using the “-u” argument. Below will un-mount the remote ssh server.
user01@LinuxDesk:~/.gvfs$ gvfs-mount -u ssh://user05@SftpServer02
Notes: GVFS contains one master daemon (gvfsd) which tracks current GVFS mounts. Each mount is created as an individual daemon with it’s own process. Knowing this, we can find the actual gvfsd process ID that the sftp connection is running under.
user01@LinuxDesk:~/.gvfs$ ps -ef | grep gvfsd-sftp user01 8022 1 0 10:34 ? 00:00:00 /usr/lib/gvfs/gvfsd-sftp --spawner :1.8 /org/gtk/gvfs/exec_spaw/21
Share this:
Like this:
~ by Kevin Goodman on December 7, 2009.
Posted in Filesystems, Linux, Networking
Tags: centos, fedora, gnome, GNOME Virtual File System, gvfs, gvfs un-mount, gvfs-mount, gvfsd, gvfsd-ftp, gvfsd-sftp, LinkedIn, Linux, list, process, redhat, ssh, ubuntu, vfs

[...] mount bisa juga dilakukan dengan baris perintah menggunakan gvfs-mount. Tulisan ini mungkin bisa menjadi referensi tambahan penggunaan [...]
Mount berkas arsip dengan GIO « Dari Tiada Ke Tiada said this on July 21, 2010 at 7:52 am