Google Colab Persistent Disks: Keep Notebook State Across Runtime Restarts
Persistent disks let your Colab notebook survive runtime restarts, preserving models, datasets, and intermediate results without re-download. Here’s how they work, when to use them, and what to watch out for.
15 Feb 2026, 11:16 UTC

The Colab runtime resets every time you restart, wiping in‑memory data, re‑downloading datasets, and forcing model checkpoints to disappear. If you’re iterating on experiments or training large models, those delays add up fast.
\nHow Colab persistent disks keep notebook state alive
\nPersistent disks are Google‑managed block‑storage volumes that mount automatically at /content/colab_root. They survive runtime restarts, so any files you write there remain accessible in the next session. The disk is encrypted by default and allocated in 1‑GB increments up to 100 GB, integrating seamlessly with Python file I/O.
Mount point and lifecycle
\nThe disk appears as a standard Linux directory inside the runtime. When the notebook is explicitly deleted, the persistent disk is removed too—it’s a session‑aware cache, not a permanent archive.
\nWorked example: saving a checkpoint that survives a restart
\n- \n
- In your notebook cell, create a directory and write a test file: \n
import os; os.makedirs('/content/colab_root/checkpoints', exist_ok=True); with open('/content/colab_root/checkpoints/sample.txt', 'w') as f: f.write('test checkpoint data')\n - Restart the runtime via Runtime > Restart runtime. This clears in‑memory state, but files under /content/colab_root should persist. \n
- After the runtime reconnects, verify the file: \n
with open('/content/colab_root/checkpoints/sample.txt') as f: print(f.read())\n
Expected check: The printed text matches what you wrote. If the file is absent, the disk may not have been allocated or the notebook was permanently deleted.
\nRelevant risk: Exceeding your Google Drive quota can prevent the disk from mounting. Colab also does not support concurrent writes from multiple notebooks to the same persistent‑disk path—doing so may corrupt data.
\nTrade‑offs, limitations, and when to choose another option
\n- \n
- Session expiry: Colab sessions expire after roughly 12 hours of inactivity. You’ll need to restart the runtime to continue, and may need to re‑select the persistent‑disk size. \n
- Quota constraints: Disks are allocated in 1‑GB increments up to 100 GB. Larger workloads may hit the limit sooner than expected. \n
- No concurrent writes: Multiple notebooks writing to the same /content/colab_root path can corrupt files. If you need shared access, consider Google Cloud Storage or Drive. \n
Getting started: your first verification step
\nOpen a notebook, go to Runtime > Change runtime type, and locate the Persistent disk allocation dropdown. Pick a size that matches your typical experiment (10 GB or 20 GB is a good starting point). Then create a test file at /content/colab_root/test.txt, restart the runtime, and confirm the file remains readable. That’s the fastest way to confirm the feature works for your workflow.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.