If you're manipulating files stored on a remote machine, such as ARCUS or ARCHER supercomputers, you can mount the remote file system and interact with the files as if they were stored on your own machine. This makes viewing, editing, and opening files in software on your computer a breeze.
To do this on OSX, first ensure you have homebrew installed.
If brew
is not recognised in Terminal, run
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Then install osxfuse
brew cask install osxfuse
and then restart your computer. Finally run
brew install sshfs
You can now call sshfs
to create a remote mount from an existing directory on your computer,
but it's best to create a script in ~
you can run.
In Terminal, run
cd ~
mkdir Desktop/MountDir
nano mounter.sh
and in the new menu, write
sudo sshfs -o allow_other,defer_permissions USERNAME@ADDRESS:REMOTEDIR Desktop/MountDir
replacing USERNAME
with your username on the remote machine, ADDRESS
with the ssh address of the remote machine
(e.g. arcus-b.arc.ox.ac.uk
) and REMOTEDIR
with your home directory on the remote machine
(find by calling pwd
when you've ssh'd into the remote machine).
When done, hit keys control-X
then y
then Enter
to save the script.
Give the script permission to run with
chmod +x mounter.sh
You now have an empty folder on your desktop called MountDir (don't delete it). To mount it, open Terminal and type
./mounter.sh
and after entering your passwords (both for your OSX root and for the remote machine), the folder will change label and icon and link to your remote directory. You can now edit files inside as if they were on your machine!
Do not try to delete the
MountDir
folder when mounted! This will attempt to delete everything in your remote directory!
To unmount, call
sudo umount Desktop/MountDir
You should also put this command inside a script (e.g. unmounter.sh
) as above.
After some time depending on the remote machine, the mount will expire and you'll need to re-run the above script; sometimes this requires restarting your computer! Before leaving your computer unattended, it's good practise to unmount yourself to avoid having to restart.
it gives an error: "the dir is already mounted" but in actual dir is not mounted