Jupyter notebooks for your team.

Try free
← Blog

Colab Mount Drive: Save Files to Google Drive, Fix drive.mount Errors and Stop Losing Work (2026)

How to mount Google Drive in Colab with drive.mount, read a CSV from it and save outputs and checkpoints so they survive the runtime being deleted. What Colab keeps and loses, the exact drive.mount error messages and their fixes, why folders of 10,000 files fail, and a snippet that runs in Colab and on a laptop.

Fastero Dev TeamFastero Dev Team2026-12-01Last updated: 2026-12-02

Most Colab files that "disappear" were never in Google Drive: they were on the runtime's own disk, which Colab deletes. We read the source of google.colab.drive, Google's example notebook for loading data, Colab's FAQ and the text of its dialogs, collected the mount errors people report on Colab's issue tracker and Stack Overflow, and ran a snippet that works both in Colab and on a laptop.

The short answer: run from google.colab import drive and drive.mount('/content/drive'), approve the pop-up with the same Google account the notebook runs under, and your files appear under /content/drive/MyDrive. Read and write there with normal paths. Anything saved only in /content lives on the runtime's disk and is deleted with the runtime: after an idle timeout, at the session's time limit, or on Disconnect and delete runtime. Drive writes sync in the background, so call drive.flush_and_unmount() before a job ends. The common mount errors come from the permission pop-up, a non-empty mount folder, or more than about 10,000 items in one Drive folder. Checked 1 December 2026.

Fastero

Jupyter notebooks for your team, with nothing to install.

Start a notebook or bring your .ipynb files. SQL cells query your databases with no password in the code, and a notebook runs now or on a schedule. Colleagues open it with their own login; viewers are free.

Try free →

How to mount Google Drive in Colab

  1. Add a code cell and run:

    from google.colab import drive
    drive.mount('/content/drive')
  2. Colab asks "Permit this notebook to access your Google Drive files?" and opens a Google sign-in window. Choose the account you're running Colab with and allow every permission it lists.

  3. The cell prints Mounted at /content/drive. Your files are in /content/drive/MyDrive, and shared drives in /content/drive/Shareddrives.

The Mount Drive button in the file browser does the same, and for a notebook only you have edited, Colab may remount Drive by itself in later sessions.

Read the warning before you allow it: "Granting access to Google Drive will permit code executed in the notebook to modify files in your Google Drive. Make sure to review notebook code prior to allowing this access." That includes cells someone else wrote in a notebook they shared with you.

The function's full signature in Google's source:

def mount(mountpoint, force_remount=False, timeout_ms=120000, readonly=False):
Option What it does
force_remount=True Remounts even if Drive is already mounted, the fix for a stale or broken mount
readonly=True Mounts Drive read-only, so notebook code can't change your files
timeout_ms How long to wait for the mount, 120,000 ms (2 minutes) by default

The mount drops the spaces from Drive's folder names, but My Drive still works: of shared drives, the Colab team says "including or omitting the space should work equivalently." In shell commands, quote a path with a space or write My\ Drive.

Read a CSV from Google Drive in Colab

Once Drive is mounted, a file in it is just a path:

import pandas as pd
 
df = pd.read_csv('/content/drive/MyDrive/data/sales.csv')
xl = pd.read_excel('/content/drive/MyDrive/data/budget.xlsx')
  • Files shared with you aren't in MyDrive until you add a shortcut to them in your own Drive.
  • Another account's Drive can't be mounted. Since January 2022 the mount "requires using the same account to mount Google Drive as you use for notebook code execution", a Colab team member wrote. Share the folder with your Colab account instead.
  • Excel works as it is: openpyxl, which pandas uses for .xlsx, is installed in Colab.
  • Google Sheets aren't files pandas can read. Use gspread or Colab's sheets.InteractiveSheet, both in Google's example notebook.

Save files to Google Drive from Colab

Write straight to a path under /content/drive/MyDrive, or copy a finished file across:

df.to_csv('/content/drive/MyDrive/outputs/clean.csv', index=False)
!cp /content/model.pt /content/drive/MyDrive/checkpoints/

Two things make saving to Drive less instant than it looks:

  • Writes land on the runtime's disk first, then sync. The Colab team, in 2019: "Data written to Google Drive is first written to the disk attached to the VM, so the maximum size is limited by that", and "large writes on one system can take a while to show up in the other." A file you can see in Colab may not be in Drive yet.
  • drive.flush_and_unmount() forces the sync and unmounts Drive. Google's example notebook follows it with: "All changes made in this colab session should now be visible in Drive." Run it at the end of a long job; remount if you need Drive again.

For training checkpoints, save a few large files rather than many small ones, and write each to a new filename so a cut-off write never replaces your last good copy. Copy between Drive folders rather than moving: "If you attempt to move files from one folder to another via Colab and your operation is interrupted, you may lose all of the data in transit."

Why Colab files disappear: what survives a runtime reset

A table of what survives in Colab: variables, DataFrames and loaded models live in the runtime's memory and are lost on a session restart and when the runtime is deleted; uploads, outputs in /content and pip packages live on the runtime's disk and survive a restart but not deletion; files in /content/drive/MyDrive and the notebook itself live in Google Drive and survive both

What survives a session restart and a deleted runtime in Colab, from Colab's own dialogs and FAQ, checked 1 December 2026.

Colab's own dialogs spell it out:

  • Restart session clears memory but keeps the machine: "Runtime state including all local variables will be lost." Files in /content and installed packages stay.
  • A deleted runtime takes its disk with it: "This runtime's files will be deleted when this runtime is deleted." That happens on Runtime › Disconnect and delete runtime, and on its own: "Virtual machines are deleted when idle for a while, and have a maximum lifetime enforced by the Colab service."
  • A new machine type is a new runtime. Switching to a GPU or high RAM moves you to another machine; after a memory crash Colab warns: "Your current runtime's state will be lost, including local files."
  • Closing the tab doesn't help. Without a paid plan, "execution will be interrupted when user interaction ceases, and the VM will be deleted soon after that."

So anything you want tomorrow goes under /content/drive/MyDrive, or somewhere else off the runtime; keep pip install lines at the top of the notebook and rerun them. How long runtimes last is in our Colab limits guide, and why buying compute units can hand you a fresh runtime is in our compute units guide.

One notebook for Colab and your laptop

google.colab only exists inside Colab, so the import doubles as a test of where the code is running. This picks the Drive folder in Colab and a local folder anywhere else, then reads and writes the same relative paths:

"""Same code in Colab (files in Google Drive) and on a laptop (a local folder)."""
import os
from pathlib import Path
 
import pandas as pd
 
try:
    from google.colab import drive  # this module exists only inside Colab
 
    drive.mount("/content/drive")
    BASE = Path("/content/drive/MyDrive/sales-project")
except ImportError as err:
    print(f"Not in Colab ({err}), so using a local folder")
    BASE = Path(os.environ.get("PROJECT_DIR", "sales-project"))
 
orders = pd.read_csv(BASE / "data" / "orders.csv")
by_region = orders.groupby("region", as_index=False)["revenue"].sum()
 
out_dir = BASE / "outputs"
out_dir.mkdir(parents=True, exist_ok=True)
by_region.to_csv(out_dir / "revenue_by_region.csv", index=False)
print(by_region.to_string(index=False))
print("Saved", (out_dir / "revenue_by_region.csv").as_posix())

We ran it on a Windows laptop with Python 3.14 and pandas 3.0 on 1 December 2026, against a six-row orders.csv of invented orders:

Not in Colab (No module named 'google'), so using a local folder
region  revenue
 North  1680.25
 South  1596.25
  West  3315.00
Saved sales-project/outputs/revenue_by_region.csv

With other Google libraries installed, the message reads No module named 'google.colab' instead. In Colab, the first branch prints Mounted at /content/drive and reads from MyDrive/sales-project, so keep the same folder layout in Drive and on disk; PROJECT_DIR points the laptop branch elsewhere.

Jupyter notebooks for your team.

Start free →

drive.mount errors and how to fix them

"credential propagation was unsuccessful"

MessageError: Error: credential propagation was unsuccessful

The mount didn't get a usable sign-in. In order of likelihood:

  1. The pop-up was closed, blocked or only partly approved. Rerun the cell and allow every permission; a 2024 answer on Stack Overflow found that choosing only some of them throws this error.
  2. You picked a different account from the one running the notebook. Use the same account.
  3. Colab itself is down. On the evening of 16 November 2026 (UTC) it failed for many users at once; a reply on Colab's issue tracker said "we are actively investigating", and it worked again within about three hours. If a new notebook with just the two mount lines fails, check Colab's issue tracker.

"mount failed" or a timeout

ValueError: mount failed: timeout during initial read of root folder; for more info: https://research.google.com/colaboratory/faq.html#drive-timeout

Usually too many files at the top of your Drive: "storing more than approximately ten thousand items in the root directory can cause mounting to fail." Move loose files in My Drive into subfolders, each under ten thousand items. One open report from November 2026 traced a timeout to Google's Drive service rejecting the Drive client on Colab's machines as out of date; only Google can fix that one.

"Mountpoint must not already contain files"

ValueError: Mountpoint must not already contain files

Something wrote into /content/drive before Drive was mounted, often a cell that saved to a Drive path too early. If os.path.ismount('/content/drive') is False, the folder is local: rename it (!mv /content/drive /content/drive_old) and mount again. Never delete it without that check. The same code also rejects a mount point that contains a space or is a symlink.

"Input/output error"

OSError: [Errno 5] Input/output error

Colab's FAQ gives two causes: a folder holding too many items, or Drive's own quotas, "per-user and per-file operation count and bandwidth quotas", usually hit by "accessing a popular shared file, or accessing too many distinct files too quickly." Split big folders, copy a popular shared file into your own Drive, and read archives instead of thousands of small files. If a storage-quota notice appears, empty Drive's trash; more Drive space doesn't add disk to Colab's machines.

"Transport endpoint is not connected"

[Errno 107] Transport endpoint is not connected

The process behind the mount has died. Remount:

drive.mount('/content/drive', force_remount=True)

If that fails, save anything in /content, use Runtime › Disconnect and delete runtime, and mount again.

"Drive already mounted"

Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).

Not an error: you ran the mount cell twice. Ignore it, or remount as it says if the mount has stopped working.

"unsupported in this environment"

NotImplementedError: Mounting drive is unsupported in this environment. Use PyDrive2 instead. See examples at https://colab.research.google.com/notebooks/io.ipynb#scrollTo=7taylj9wpsA2.

You're on a runtime without Colab's Drive support: per the FAQ, a local runtime, a GCP Marketplace machine or Colab Enterprise, which says "google.colab.drive.mount is not supported in Colab Enterprise." Use the Drive API or PyDrive2, as Google's notebook shows.

Why Google Drive is slow in Colab

Google's FAQ gives the reasons: "Files stored in Google Drive may be stored in a distant region from your Colab runtime. To maximize performance, reduce read/writes from Drive." Every file read goes over the network, so a training loop that opens tens of thousands of images one at a time crawls; one Stack Overflow user saw Colab read "only 2-3 images in a second" from Drive.

Google's fix is to move one archive instead of many files: copy a .zip or .tar.gz from Drive to the runtime and unpack it there, not in the mounted folder.

!cp /content/drive/MyDrive/datasets/images.zip /content/
!unzip -q /content/images.zip -d /content/images

Then point the code at /content/images. Copying the archive back into Drive at the end works the same way in reverse: one tar file, not a folder of thousands.

Other ways to get files into Colab

Method Best for How
Upload from your computer A few files, one session files.upload() from google.colab; files land in /content and are deleted with the runtime
Download to your computer Small results files.download('example.txt')
gdown A public Drive link, no mount gdown <link or file ID>; installed in Colab, and pip install gdown anywhere else
Google Cloud Storage Big datasets, files shared with a team auth.authenticate_user(), then gsutil cp; needs a Google Cloud project
Drive API or PyDrive2 Sharing settings, metadata, runtimes that can't mount Examples in Google's I/O notebook

gdown's README calls it a "Google Drive public file/folder downloader when curl/wget fails". If it says "Permission Denied", the file must be shared as "Anyone with the link". Google Drive drops large downloads after about an hour; --continue resumes them. Kaggle is the other common home for data: it keeps 20 GB of files between sessions, as our Kaggle vs Colab comparison explains.

Where Fastero fits

Colab plus Drive is a good home for a personal notebook and a GPU. It's awkward for a notebook a team relies on: the files sit in one person's Drive, the mount usually asks for that person's sign-in on each new runtime, and on most plans nothing runs once the tab is closed.

Fastero is an AI and data platform where people and AI agents work together on a team's data. Files uploaded to a Fastero project stay with the project, and its notebooks read them by path, Excel files included, with no mount step in each run. Notebooks can also query a saved database connection in a SQL cell, run on a cron schedule on the server with no browser open, and be read by colleagues who sign in; viewers are free. Results that need to last can be pinned to a dashboard that refreshes when the notebook runs on its schedule. The Free plan has no end date and includes 500 MB of storage and 6 hours a day of notebook and Python time. For GPU model training, keep Colab.

A notebook in Fastero with View as App and Promote to App above it, and the project's notebooks, queries, files and data sources in the explorer on the left

A notebook in a Fastero project, with the project's files in the explorer. Sample data.

FAQ

How do I mount Google Drive in Colab?

Run from google.colab import drive and then drive.mount('/content/drive'), and approve the sign-in pop-up with the account Colab runs under. Your files are then under /content/drive/MyDrive. The Mount Drive button in the file browser does the same.

Why did my Colab files disappear?

They were saved to the runtime's own disk, /content, which Colab deletes when the runtime is deleted: after an idle timeout, at the session's time limit, or when you choose Disconnect and delete runtime. Save to /content/drive/MyDrive instead.

How do I save a file from Colab to Google Drive?

Mount Drive, then write to a path under /content/drive/MyDrive, or copy a finished file there with !cp. Writes sync to Drive in the background, so run drive.flush_and_unmount() before a long job ends.

What does flush_and_unmount do?

It pushes every pending write from the runtime to Google Drive, then unmounts Drive. Use it at the end of a job so nothing is lost when the runtime goes; mount again if you still need Drive.

How do I read a CSV from Google Drive in Colab?

Mount Drive, then pass the file's path under /content/drive/MyDrive to pd.read_csv. For a file someone shared with you, add a shortcut to it in your own Drive first.

Why does drive.mount time out?

Usually because a Drive folder, often My Drive itself, holds more than about ten thousand items. Move them into subfolders. If a new notebook still can't mount, check Colab's issue tracker for an outage.

Can I mount someone else's Google Drive in Colab?

No. Since 2022 the mount must use the same account the notebook runs under. Ask the owner to share the folder with your account, then add a shortcut to it in your Drive.

Sources

Read on 1 December 2026:


Try Fastero free: upload your team's files to a project once, and notebooks read them by path on every run, with no Drive to mount. No credit card required.

Start a notebook next to your team's data.

Python 3.11 with pandas, SQLAlchemy and seaborn, SQL cells on your databases, and scheduled runs on the Free plan. No credit card required.

Follow Fastero on LinkedIn for new articles and examples.