On this page
Block storage (volumes)
A block volume is a durable virtual disk you attach to an instance to add capacity that lives independently of the server, so your data survives a rebuild, a resize or the instance being deleted.
Where an instance's root disk is tied to the instance itself, a volume is a separate resource with its own lifecycle. You create it once, attach it to a running instance, format it and mount it, and it keeps your data even if you later detach it and move it to another instance.
Volumes are replicated in the storage backend for durability. You can grow a volume, capture point-in-time snapshots for backup or cloning, and pick a volume type when more than one is offered.
Key concepts
Volume — A network block device you attach to one instance at a time and mount like a physical disk.
Volume type — The class of storage a volume is created from; the choices offered depend on your project.
Attachment — The link between a volume and the instance it is currently connected to, exposed as a device such as /dev/vdb.
Snapshot — A point-in-time copy of a volume you can restore from or use to create a new volume.
Extend — Growing a volume's capacity in place; you then grow the filesystem inside the guest.
Before you start
- A running instance to attach the volume to.
- Enough block-storage quota in the project for the size you want.
- Console or SSH access to the instance so you can format and mount the new device.
Step by step
- Open the create form
Go to Storage > Block storage and choose Create volume.
Screenshot — The Create volume button on the Block storage pageThe Create volume button on the Block storage page - Set name, size and type
- Give the volume a recognizable name.
- Choose a size in GB sized for your data plus room to grow.
- Pick a volume type if more than one is available.
- Optionally create the volume from an image or clone an existing volume as the source.
Screenshot — The Create volume form with the name, size and type fieldsThe Create volume form with the name, size and type fields - Create and wait
Submit the form and wait for the volume to reach the Available state before attaching it.
- Attach it to an instance
Open the volume's actions and choose Attach, then select the target instance. The volume moves to In-use once connected.
Screenshot — The attach-to-instance dialog listing available instancesThe attach-to-instance dialog listing available instances - Format and mount inside the guest
- Connect to the instance.
- Find the new device (often
/dev/vdb). - Create a filesystem and mount it, then add it to
/etc/fstabso it remounts on reboot.
Examples
lsblk sudo mkfs.ext4 /dev/vdb sudo mkdir -p /data sudo mount /dev/vdb /data echo '/dev/vdb /data ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
# after Extend in the console, from inside the instance: sudo resize2fs /dev/vdb
patrii volume create --name app-data --size 100 patrii volume attach <volume-id> --server <server-id> # later, to grow it patrii volume extend <volume-id> --size 200
resource "patrii_volume" "data" {
name = "app-data"
size = 100
}
resource "patrii_volume_attachment" "data" {
volume_id = patrii_volume.data.id
instance_id = patrii_instance.web.id
}Limits & specifications
Actions available on a volume:
| Action | What it does |
|---|---|
Attach | Connect the volume to a running instance. |
Detach | Disconnect it so you can move it to another instance. |
Extend | Increase the volume's capacity; grow the filesystem afterward. |
Snapshot | Capture a restorable point-in-time copy. |
Delete | Permanently remove the volume once it is detached. |
Best practices
- Keep application data on a volume, not the root disk, so it survives a rebuild.
- Unmount cleanly inside the guest before detaching a volume.
- Snapshot before risky changes so you can roll back.
- Use
nofailin/etc/fstabso a detached volume never blocks the instance from booting. - Size for growth, but remember you can always extend later.
FAQ
Can two instances use the same volume at once?
I attached the volume but do not see it in the instance.
/dev/vdb) but has no filesystem until you create one. Run lsblk to find it, then format and mount it.Does deleting an instance delete its volumes?
How do I make a volume bigger?
resize2fs).Learn more
Everything you can do here in the console is also available through the Patrii Cloud API for automation and scripting.