How to Create, Mount, or Delete a Shared Drive

Machines are Linux and Windows virtual machines with persistent storage, GPU options, and free unlimited bandwidth. They’re designed for high-performance computing (HPC) workloads.


Shared drives provide storage that is accessible from multiple machines in a private network.

You can manage shared drives with the Paperspace console, Paperspace API, or Paperspace CLI.

Create a Shared Drive

Before creating a shared drive, you need to create a private network where you store the shared drive.

Using a Paperspace Console

To create a shared drive, go to the Paperspace console, in the top-left corner, click the dropdown menu, select CORE, click the Drives tab, in the Drives page, click CREATE to open the Create a drive window.

The Create a drive window of Core dashboard's Drives page.

In the Create a drive window, under the Name section, choose a name for your shared drive.

Under the Size in GB section, click the dropdown menu, choose a disk size for your shared drive. By default, the lowest disk size is selected.

Under the Region section, click the dropdown menu, choose a region for your shared drive. A good default is selected for you, but for the best performance and minimal latency, choose the datacenter region nearest to you and your users. Shared drives are region-specific, so its region must belong to the same region as the machines that are using it.

Under the Network section, click the dropdown menu, choose a network for your shared drive. By default, one of your private networks in the same region is chosen.

After you’ve configured for shared drive, click CREATE. You can see your new shared drive in the Drives tab.

Using the Paperspace API

When creating a shared drive using the Paperspace API, you need to provide the following values:

  • name (string): The name of the shared drive.
  • size (number): The disk size of the shared drive in GB.
  • networkId (string): The ID of the private network the shared drive belongs to.
  • region (string): The region the shared drive belongs to.
How to Create a Shared Drive Using the Paperspace API
  1. Create an API key to authenticate your requests to your Paperspace account and save it for use.

  2. Send a POST request to https://api.paperspace.com/v1/shared-drives.

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PAPERSPACE_API_KEY" \
  -d '{
        "name": "your-shared-drive-name",
        "size": 50,
        "region": "NY2",
        "networkId": "nwhoe4ox"
      }' \
  "https://api.paperspace.com/v1/shared-drives"

Using the Paperspace CLI

When creating a shared drive using the Paperspace CLI, you need to provide the following values:

  • name (string): The name of the shared drive.
  • size (number): The disk size of the shared drive in GB.
  • network-id (string): The ID of the private network the shared drive belongs to.
  • region (string): The region the shared drive belongs to.
How to Create a Shared Drive Using the Paperspace CLI
  1. Install pspace, the Paperspace command-line tool.

  2. Create an API key to authenticate your requests to your Paperspace account and save it for use with pspace.

  3. Use the API key to grant pspace access to your Paperspace account.

pspace login --api-key your-api-key
  1. Finally, run pspace shared-drive create -F [flags].
pspace shared-drive create -F --name your-shared-drive-name --network-id nwhoe4ox --region NY2 --size 50

Access a Shared Drive

Before you can access the shared drive, you need to mount your shared drive to your machine. For Windows-based machines, follow the Mount a Drive in a Folder tutorial.

Note
You cannot mount a shared drive to your machine using the Paperspace API or CLI. If you want to mount a shared drive to your machine, you need to mount it via the Paperspace console.
How to Mount a Shared Drive on Linux Using the Paperspace Console
  1. In the Paperspace console, in the top-right corner, click the dropdown menu, select CORE, then click the Machines tab. In the Machines section, find and select the machine you want to mount a shared drive to.

  2. Connect to your machine, open a terminal, then use the mkdir command to create a directory to mount your shared drive to.

sudo mkdir /mnt/share

If the directory is created outside of the root directory, you must change its ownership to the paperspace user. This ensures that the directory has the appropriate permissions and is managed by the paperspace user.

sudo chown paperspace:paperspace /mnt/share
  1. Using a text editor of your choice, open the /etc/fstab file. The /etc/fstab file defines how disk drives and partitions are mounted.
sudo nano /etc/fstab
  1. Append the following line to the bottom of the /etc/fstab file. This line is the shared drive you want to add to your machine.
//your-shared-drive-ip-address/your-shared-drive-name /mnt/share   cifs  username=your-username,password=your-password,uid=1000,gid=1000,rw  0  0
  1. Save and exit the /etc/fstab file.

  2. Mount your shared drive to the directory you created earlier.

mount /mnt/share
  1. Verify that you have successfully mounted your shared drive by running a df command, which shows the disk space usage on your machine.
df -h

You have successfully mounted your shared drive if you see it listed among other mounted filesystems.

Filesystem            Size  Used Avail Use% Mounted on
...
//your-shared-drive-ip-address/your-shared-drive-name   500G  150G  350G  30% /mnt/share

If you get the mount error below, it means there is an issue related to either your file system type or server settings.

mount: wrong fs type, bad option, bad superblock on //your-shared-drive-ip-address/your-shared-drive-name,
missing codepage or helper program, or other error
(for several filesystems (for example, nfs, cifs) you might
need a `/sbin/mount.<type>` helper program)

To fix this error, you need to:

  1. Ensure your machine is up-to-date.
sudo apt-get update
  1. Install Common Internet File System (CIFS) utilities, which provides the tools to mount Server Message Block (SMB) and CIFS shares. SMB/CIFS shares are protocols used to dictate how different resources, such as shared drives, are shared within your machine.
sudo apt install cifs-utils
  1. Re-attempt to mount your shared drive to the directory you created earlier.
mount /mnt/share

Using the Paperspace Console

To access your shared drives, go to the Paperspace console, in the top-left corner, click the dropdown menu, select CORE, click the Drives tab, then find the shared drive you want to access.

In the shared drive, under the network address section, username section, and password section, click to copy their values for later use.

After copying your shared drives attributes, connect to your machine, then find your shared drive under the directory you mounted your shared drive to.

After finding the shared drive on your machine, open the shared drive, then type the network address, username, and password values from earlier for authentication.

Using the Paperspace API

When accessing a shared drive using the Paperspace API, you need to provide the ID of the shared drive you want to access.

How to Access a Shared Drive Using the Paperspace API
  1. Create an API key to authenticate your requests to your Paperspace account and save it for use.

  2. Send a GET request to https://api.paperspace.com/v1/shared-drives/{shared-drive-id}.

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PAPERSPACE_API_KEY" \
  -d '{
        "id": "RJFHxSmO7U03"
      }' \
  "https://api.paperspace.com/v1/shared-drives/RJFHxSmO7U03"

Using the Paperspace CLI

When accessing a shared drive using the Paperspace CLI, you need to provide the ID of the shared drive you want to access.

How to Access a Shared Drive Using the Paperspace CLI
  1. Install pspace, the Paperspace command-line tool.

  2. Create an API key to authenticate your requests to your Paperspace account and save it for use with pspace.

  3. Use the API key to grant pspace access to your Paperspace account.

pspace login --api-key your-api-key
  1. Finally, run pspace shared-drive get <shared-drive-id>.
pspace shared-drive get RJFHxSmO7U03

Delete a Shared Drive

Using the Paperspace Console

To delete a shared drive, go to the Paperspace console, in the top-left corner, click the dropdown menu, select CORE, then click the Drives tab.

In the Drives page, within the list of shared drives, find the shared drive you want to delete.

Then, in the shared drive you want to delete, click , click Delete.

Using the Paperspace API

When deleting a shared drive using the Paperspace API, you need to provide the ID of the shared drive to delete.

How to Delete a Shared Drive Using the Paperspace API
  1. Create an API key to authenticate your requests to your Paperspace account and save it for use.

  2. Send a DELETE request to https://api.paperspace.com/v1/shared-drives/{your-shared-drive-id}.

curl -X DELETE \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PAPERSPACE_API_KEY" \
  -d '{
        "id": "RJFHxSmO7U03"
      }' \
  "https://api.paperspace.com/v1/shared-drives/RJFHxSmO7U03"

Using the Paperspace CLI

When deleting a shared drive using the Paperspace CLI, you need to provide the ID of the shared drive to delete.

How to Delete a Shared Drive Using the Paperspace CLI
  1. Install pspace, the Paperspace command-line tool.

  2. Create an API key to authenticate your requests to your Paperspace account and save it for use with pspace.

  3. Use the API key to grant pspace access to your Paperspace account.

pspace login --api-key your-api-key
  1. Finally, run pspace shared-drive delete <shared-drive-id>.
pspace shared-drive delete RJFHxSmO7U03