Key idea
A SphereStor volume is a disk that lives in an environment. You mount it on a service, which makes it appear as a folder such as /data, and whatever your app writes there survives when the spherelet is replaced.
Three pieces, three places
You set up storage in order: quota on your account, a volume in the environment, a mount on the service. SphereStor comes with the Pro, Team and Enterprise plans; Hobby doesn't include it.
- Quota is the total storage you've paid for, in GB, at $0.25 per GB per month. You pay for it whether or not your volumes use it all.
- A volume is a named disk carved out of that quota. It can't be bigger than the quota you have left.
- A mount attaches the volume to a service at a path.
1. Add quota
Open the environment and choose the Storage tab, then Manage quota (or Add SphereStor quota if it says No SphereStor quota). On your account's SphereStor tab, choose Add storage and set the GB you need. 1 GB is plenty for this module's lab.
2. Create a volume
Back on the environment's Storage tab:
- Choose New SphereStor volume.
- Enter a Volume name, for example
notes-data, and a Storage size (GB). - Choose Create.
The list shows each volume with its size and how many services use it. It's ready to mount a few seconds later.
3. Mount it on a service
- Open the service, then Settings, then the Storage card.
- Choose Configure storage.
- Under SphereStor volume, pick your volume.
- Enter the Mount path, for example
/data. It must start with/. - Choose Save. The card shows the volume as Unmounted.
- Choose Mount, then Mount again in the dialog.
The status turns Mounted, and the service restarts on a new spherelet with the volume attached.
Your app must write to that exact path. If it writes to /app/data and you mounted /data, the files still land on the temporary filesystem.
Limits to design around
A volume attaches to one spherelet at a time:
- Keep the service at 1 spherelet. Extra spherelets, including ones autoscaling adds, can't see the data.
- One service per volume, and in the console one volume per service.
- Mount a folder your app owns, not one your image already fills (like
/app). The volume hides what was at that path.
If several spherelets or services need the same data, it belongs in a database or object storage (lesson 5.5.1).
Unmount, resize and delete
- Unmount (on the service's Storage card) disconnects the volume and restarts the service without it. The data stays on the volume: choose Configure storage and mount it again to get it back.
- Resize with Edit in the volume's menu on the environment's Storage tab. Volumes can grow but not shrink.
- Delete from the same menu destroys the data and can't be undone. Unmount the volume first; a mounted volume can't be deleted.
Volumes are managed in the console and the API; csph has no volume commands yet. A mounted service's Storage card also has Open SphereFiles, a file browser for checking what your app wrote.
Check yourself