Volumes
This guide will walk you through creating and managing your first Volume.
What are Volumes?
Volumes are a powerful feature for ensuring data persistence in your rentals. They allow you to store data outside of a container's lifecycle, making it possible to maintain state even if a container is deleted or recreated.
When you mount a volume, you are linking a directory path inside your container (referred to as a mount point) to a persistent volume that exists independently of the container. Any data that your application writes to this mount point is saved directly to the volume.
Your data remains safe and intact, even if the container experiences issues or is intentionally removed. And the same volume can be remounted to a different container, allowing for easy data migration or sharing between different services or versions of your application.
Creating a Volume
-
Navigate to the Volumes Page:
- Go to the Dashboard, go to the Volumes section and click on Create Volume.
-
Define Your Volume:
- Name: Give your volume a name.
- Size: Specify the size of the volume. You can resize the volume later if needed.
-
Deploy: Click Create Volume to provision your new persistent storage.
Attaching a Volume
Now that you have a volume created, you can attach it to a rental. There are two ways to attach a volume:
During Rental Creation
When creating a new rental, you can attach a volume in the Mount Storage step:
- In the rental creation flow, navigate to the Mount Storage section.
- Select an existing volume from the dropdown.
- Specify the Mount Point (e.g.,
/data,/workspace) - this is the directory path inside your container where the volume will be accessible. - Complete the rest of the rental configuration and deploy.
To an Existing Rental
You can also attach volumes to rentals that are already running:
- Navigate to Your Rental: Go to your rental's detail page in the Dashboard.
- Attach Volume: In the Attached Volumes section, click on Attach.
- Select Volume: Choose the volume you want to attach from your available volumes.
- Specify Mount Point: Define where the volume should be mounted inside your container (e.g.,
/data,/models). - Confirm: Click Save to mount the volume to your rental.