If I sshfs an entire filesystem at the root directory, does that mean it will download the entire root directory? Is that how SSHFS works, it physicallly downloads the whole thing? Or does it fetch the files as I cd into them? I would like to grab the whole root partition, but I'm worried it would take a while and lots of space.

1 Answer 1


Nope, sshfs does not copy any files over the network when you mount a remote directory. It does not even copy files when you cd into a sshfs-mounted directory. When you cd into a directory, sshfs fetches the names of the files.

The actual contents of files only get transferred by when you access a file. So let's say there's a file called file.txt in the directory mydir, mounted on your system via sshfs. The transmission of the contents of file.txt starts:

$ cd mydir              # not here
$ ls                    # still not
$ cat file.txt          # now the file is transferred!

This means you can safely mount an entire root filesystem with sshfs, even if it's larger than all the free space you have available on your hard drive.

  • 4
    Wow, this is a good answer. Commented Feb 13, 2015 at 3:45
  • 2
    Thanks for the answer. Couple of followup questions:What is the clean up mechanism for sshfs? When does it remove the files which are pulled from the server? Any official documentation for this?
    – psykid
    Commented Dec 17, 2019 at 12:54
  • I have the same questions as @psykid.
    – progonkpa
    Commented Aug 7, 2021 at 12:52
  • There is no cleanup mechanism, because there is nothing to clean up. If you run cat file.txt multiple time, the file is transferred multiple times! Commented Aug 9, 2021 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .