Skip to content

Mounting H4H Like a Local Drive🔗

SSH File System🔗

SSH File System (SSHFS) is a command line tool that allows you to use an SSH connection to mount a remote server's file system and interact with it like it's your local machine. This is very useful when developing on H4H because it allows you to access and edit your code using your IDE of choice. It also allows you to easily view data visualization images without the need to explicitly download them to your local machine.

You can install the sshfs command line utility as follows:

  • Ubuntu: sudo apt install sshfs
  • MacOS: brew install sshfs
  • Conda: conda install sshfs

SSHFS can be used to mount the HPC4Health Login or Data Node.

Sensitive Data

Oftentimes you will be working with sensitive data on H4H. Please never download sensitive information such as PHI, patient information / images, etc. to your local machine!

Try it yourself🔗

Once you've installed sshfs on your local machine, try the following:

  1. Open the sshfs manual pages and review how to use the tool

    Solution
    man sshfs
    
  2. Make an empty directory to use as the mount target for access to H4H

    Solution
    mkdir h4hdata
    
  3. Use sshfs to mount the H4H Data Node to to the directory you just made (HINT: Use the allow_other option to allow non-root users to access the mouted drive)

    Solution
    sudo sshfs -o allow_other -p "$H4HDATA_PORT" "<username>@$H4HDATA:/cluster/projects/bhklab" "$(pwd)/h4hdata"  # make sure to add your username! Will prompt for password if no SSH Key setup for root user
    
  4. List files in the directory to confirm that it worked

    Solution
    ls "$(pwd)/h4hdata"  # should see directories like rawdata, procdata, etc.
    
  5. Unmount H4H from the directory

    Solution
    sudo fusermount -u "$(pwd)/h4hdata"
    ls "$(pwd)/h4hdata"  # should be empty now
    

    Note: fusermount is used to unmount drives on Linux. Alternatives are umount for macOS and mountvol /D for Windows.