Volumes and NFS
DigitalOcean has two kinds of network storage for machines. A Volume is a block device: a disk that attaches to one Droplet at a time and keeps its data when that Droplet is replaced. A Network File Storage share (NFS) is a file system that many Droplets and Kubernetes nodes in the same VPC mount at once.
Create a Volume
Section titled “Create a Volume”const data = yield* DigitalOcean.Volume("Data", { region: "nyc3", sizeGigabytes: 10, filesystemType: "ext4",});Give it to a Droplet in the same region with volumes: [data.volumeId] on the Droplet, or attach it to one that already exists:
yield* DigitalOcean.VolumeAttachment("DataOnHost", { volumeId: data.volumeId, dropletId: host.dropletId,});Growing sizeGigabytes resizes the Volume in place; grow the file system on the Droplet afterwards.
Snapshot a Volume
Section titled “Snapshot a Volume”const snap = yield* DigitalOcean.VolumeSnapshot("Nightly", { volumeId: data.volumeId });Pass snapshotId to a new Volume to start it from the snapshot.
Share files with NFS
Section titled “Share files with NFS”const vpc = yield* DigitalOcean.Vpc("AppVpc", { region: "nyc3" });const shared = yield* DigitalOcean.Nfs("Shared", { region: "nyc3", sizeGib: 50, vpcIds: [vpc.vpcId],});Droplets and Kubernetes nodes in the VPC mount it at shared.host:shared.mountPath. performanceTier: "high" gives it more throughput.
Limits
Section titled “Limits”- A Volume and its Droplet must be in the same region, and a Volume attaches to one Droplet at a time.
- NFS is reachable only from inside its VPCs, and only in the regions that offer it.
See Droplets for disks a Droplet keeps on its own.