Ephemeral vs Persistent Storage
What Ephemeral Storage Is
Ephemeral storage is temporary disk space that exists only as long as the virtual machine or container using it. It is usually the local disk physically attached to the host running the instance, or a scratch area created when the instance starts. When the instance stops, is deleted or is moved to another host, that data is normally gone.
Ephemeral storage is often fast and is sometimes included in the price of the instance. That makes it useful for caches, temporary build files and scratch space, where losing the contents causes a delay rather than lasting damage.
What Persistent Storage Is
Persistent storage keeps data independent of the compute resource that uses it. A persistent volume, such as a block volume, or an object bucket remains after the server is restarted, rebuilt or replaced, and can be attached to a new instance. This separation is what lets a database or an uploads folder survive when the server underneath it changes.
The trade-off is that persistent storage usually travels over a network, which adds some latency compared with a local disk, and it is usually billed as a separate resource. Its advantage is durability and flexibility. Data stored as objects in buckets follows the same principle.
Uploads Lost During a Server Rebuild
A website stores customer uploads in a folder on the instance's local disk. The server is rebuilt during an update, and the new instance starts with an empty disk. The application still runs, but the uploads are gone. Moving the upload folder to persistent storage, such as a block volume or an object bucket, would have kept the files through the rebuild.
Frequently asked questions
Should I store website files on ephemeral storage?
Only for files that can be recreated. Build outputs, caches and temporary files are reasonable candidates. Anything users upload, plus databases and configuration that cannot be regenerated, belongs on persistent storage, because the instance can be replaced at any time.
Does a server reboot erase ephemeral storage?
It depends on the provider and the type of disk. Many cloud platforms keep local ephemeral data through a simple reboot but erase it when the instance is stopped, deleted or moved to new hardware. Treat ephemeral data as lost whenever the instance is replaced, and check the provider's documentation for the exact behavior.