Sub topic 11
DBFS: what it is and why it is legacy for data
This chapter assumes you can use Databricks notebooks, write basic Python and SQL, and know what a catalog, schema and table are. You should also know that cloud object storage holds files as objects in buckets or containers.
What DBFS is
The Databricks File System (DBFS) is a storage layer that Databricks mounted on every workspace. It maps familiar file paths, such as dbfs:/FileStore/, onto cloud object storage in your account. Its root is a storage location created for the workspace, and every user of the workspace can reach it.
Older tutorials use DBFS for everything: uploaded CSV files, notebook output, library files and temporary data. That is why you still see it in existing code.
Why it is legacy for data
DBFS predates Unity Catalog and sits outside its governance model. Three problems follow from that.
- Coarse access control. Files in the DBFS root are visible to workspace users. You cannot grant
READon a single folder to one group the way you can with a volume. - No catalog lineage or auditing per object. Files have no place in the catalog, schema and volume namespace, so you cannot manage them like other governed data.
- Workspace scope. DBFS belongs to one workspace. Volumes belong to a metastore and can be shared across workspaces that use it.
For these reasons, Databricks recommends Unity Catalog volumes for non-tabular data files. Some workspaces also disable or restrict public DBFS root access, so code that depends on it can fail.
Comparing the two patterns
The same listing in the legacy style and the preferred style:
# Legacy pattern: DBFS root path
display(dbutils.fs.ls("dbfs:/FileStore/"))
# Preferred pattern: Unity Catalog volume path
display(dbutils.fs.ls("/Volumes/main/default/landing/"))The call is the same. The difference is the path. A volume path names a catalog (main), a schema (default) and a volume (landing), so Unity Catalog can check privileges on it. The DBFS path names only a folder in the workspace root.
| Aspect | DBFS root | Unity Catalog volume |
|---|---|---|
| Path prefix | `dbfs:/` or `/dbfs/` | `/Volumes/` |
| Access control | Workspace-level | `READ VOLUME` and `WRITE VOLUME` |
| Scope | One workspace | Metastore |
| Governance | None per file | Catalog, schema, volume |
| Recommended for data | No | Yes |
How the layers relate
Both routes end in cloud object storage. Only the volume route passes a privilege check on the way.
Recognizing DBFS in existing code
When you read older code, look for these signs:
- Paths that start with
dbfs:/, such asdbfs:/FileStore/tables/sales.csv. - Paths that start with
/dbfs/, used with Python'sopen(). - Calls to
dbutils.fs.mount, which create legacy mounts.
The next chapters cover each of these in detail and show how to replace them.
Exercise
A teammate stores customer export files in dbfs:/FileStore/exports/ and asks why this is discouraged. Give two reasons and name the recommended alternative.
Show answer
DBFS root access is workspace-level, so you cannot restrict one folder to one group, and the files sit outside the Unity Catalog namespace, so they get no catalog-level governance. Use a Unity Catalog volume, for example /Volumes/main/default/landing/, and control access with READ VOLUME and WRITE VOLUME.