Blob Stores, Storage Layout, Database Choices, Capacity Planning, and Data Separation: Concepts, Architecture, and Mental Model
Separate Nexus application files, persistent data, relational database state, blob-store content, logs, and client caches so storage, recovery, and capacity decisions are based on the state that actually exists.
Learning objectives
- Explain why repository metadata in the database and repository files in blob stores must be protected as related but different state.
- Distinguish the Nexus application directory, persistent data directory, database, blob stores, logs, temporary files, and client caches.
- Compare embedded H2 with external PostgreSQL without confusing a convenient default with a production recommendation.
- Reason about file blob stores and object storage as different IO backends with distinct latency, permission, and recovery characteristics.
- Use supported UI/REST evidence to inspect storage before making any change.
Current lab baseline (reviewed 2026-08-26): Nexus
Repository Community Edition 3.94.1-06, Java 21, loopback-only HTTP,
a dedicated non-root/non-administrator process identity, and
embedded H2 only for the disposable local instance. Sonatype
currently recommends external PostgreSQL for production deployments.
The lab never treats a blob store as a database backup or
manipulates $data-dir/blobs or database files directly.
1. The storage problem: a repository is not one directory
Chapter 04 established that hosted, proxy, and group repositories define where requests are written and read. Chapter 05 asks a different question: what durable state makes those repositories work? If an operator answers “the Nexus folder,” backup, migration, capacity, and incident decisions become dangerous because several independent state stores are being collapsed into one mental bucket.
A component such as a JAR, npm tarball, OCI layer, or Raw file must have bytes somewhere. Nexus also needs records that say which repository owns the asset, its path and format metadata, security and repository configuration, and other product state. Those responsibilities do not live in the same place.
flowchart LR C[Package client or CI] -->|HTTP request| N[Nexus Repository process] N -->|repository, component, config and auth records| DB[(H2 or PostgreSQL)] N -->|asset bytes, package metadata files and checksums| B[(Blob store)] N -->|events and diagnostics| L[Logs / task history / metrics] DB -->|routing and metadata| N B -->|stored bytes| N N -->|HTTP response| C
The arrows matter. The client talks to Nexus, not directly to the database or blob store. Nexus consults relational state to understand the repository and asset, then reads or writes repository files through the configured blob-store backend. Bypassing Nexus and editing either internal store breaks this relationship.
2. Six locations that beginners often confuse
| State area | What it contains | Operational rule |
|---|---|---|
| Application directory | Versioned Nexus application, libraries, launch configuration and bundled runtime files. | Treat as replaceable software during upgrades; do not mistake it for the repository backup. |
| Persistent data directory | Runtime configuration, logs, temporary/work state, default blob location, and the embedded H2 database when H2 is used. | Protect ownership and free space; understand which sub-state is durable before copying anything. |
| Database | Repository/component/configuration/security and other relational product state. H2 is local; PostgreSQL is external. | Back up using supported database-aware procedures; never edit tables/files as a repair shortcut. |
| Blob store | Repository files: package/artifact bytes and related repository metadata files/checksums/index artifacts stored as blobs. | Access through Nexus-supported storage operations; never rename/delete obfuscated blob files manually. |
| Logs/tasks/metrics | Evidence about operations and failures. | Preserve enough evidence before changing state; scrub sensitive data before sharing. |
| Client cache/config | Maven/npm/pip/Docker/etc. local state outside Nexus. | A warm client cache can hide a Nexus failure; isolate it during diagnosis. |
The blob store is broader than “large binaries.” A repository protocol can store metadata and checksum files as assets too. Conversely, the database is not a container for all artifact bytes. Recovery succeeds only when the database/configuration state and blob content agree.
3. Application directory versus data directory
The application directory is the unpacked Nexus software distribution. The data directory is the persistent working area. Upgrading normally introduces a new application distribution while preserving/migrating persistent state according to the supported upgrade procedure. Copying a fresh application directory does not restore repositories; copying only a data subdirectory does not necessarily restore an external PostgreSQL database.
flowchart TB APP[Application directory<br/>Nexus binaries + bundled Java] -->|upgrade replaces software| APP2[New application directory] DATA[Persistent data directory<br/>config + logs + local work] --> DB1[(Embedded H2 when used)] DATA --> B1[(Default/local blob stores)] PG[(External PostgreSQL)] -. persistent relational state .-> DATA OBJ[(S3-style object blob store)] -. external blob state .-> DATA APP -. reads configuration/state .-> DATA APP2 -. reuses/migrates supported state .-> DATA
The dashed connections show external dependencies. With PostgreSQL or object storage, important persistent state is not fully contained beneath one local data path.
4. H2 and PostgreSQL solve the same role at different operating scales
New self-hosted installations currently use embedded H2 by default, but Sonatype documents clear H2 limits and recommends external PostgreSQL for deployments beyond small/disposable use. This is a database choice, not a package-format choice.
| Dimension | Embedded H2 | External PostgreSQL |
|---|---|---|
| Placement | Inside the Nexus data directory. | Separate database service reached over a low-latency network connection. |
| Current support envelope | Up to 200,000 requests/day or 100,000 components; container-based H2 deployments are unsupported. | Recommended by current Sonatype system requirements for production deployments. |
| Operations | Simple local setup; fewer moving parts. | Adds database service, credentials, network, backup, monitoring, and failover responsibilities. |
| Recovery implication | Database files are local Nexus persistent state, but still require supported consistency handling. | Database backup/restore must be coordinated with blob content and Nexus configuration. |
| Performance dependency | Embedded-data filesystem latency directly affects Nexus. | Database network latency and PostgreSQL performance become separate observable layers. |
Do not combine these limits with Community Edition licensing/usage limits. Database supportability and product edition limits are separate dimensions.
5. File and object blob stores are storage backends, not repository types
A repository—Raw hosted, Maven proxy, npm group, and so on—references a blob store. Multiple repositories can use the same blob store. A file blob store places blob data on a filesystem path accessible to the Nexus process. An object blob store uses a supported cloud backend such as S3 under the current edition/support matrix.
Object storage can improve capacity elasticity and durability characteristics, but it adds API/network latency, IAM policy, region placement, provider limits, and new failure modes. Sonatype’s guidance favors locating object storage in the same cloud/region as Nexus; it is not a drop-in replacement for a low-latency embedded database filesystem.
6. Capacity planning is more than summing package sizes
Sonatype’s storage-planning model approximates blob usage as the combined component bytes plus filesystem overhead. A useful first-order expression is:
\[\text{blob capacity} \approx \sum \text{component bytes} + 1.5N\times \text{filesystem block size}\]
That is only the blob portion. Operators also reserve room for the data directory, temporary work, logs, database growth, cleanup/compaction behavior, upgrades, backups, and growth between capacity-review cycles. Current system requirements require at least 4 GB available disk at all times; below that threshold the database switches to read-only. An SLO should alert much earlier than the emergency boundary.
7. IO, file handles, ownership, and filesystem support are integrity controls
Nexus performance is frequently bounded by disk and network IO rather than CPU. The embedded database needs responsive storage; blob storage needs reliable throughput and capacity. The dedicated Nexus OS account must be able to access the intended data/blob paths. Sonatype also requires higher file-handle limits on Linux/macOS and warns that exhausting file descriptors can lead to data loss.
“The mount exists” is not sufficient evidence that it is supported for every Nexus state type. Current system requirements distinguish embedded-data support from blob-store support across local filesystems, network filesystems, and object storage. Verify the exact matrix before choosing a production mount.
8. Read-only inspection before mutation
Capture three independent views: product state, storage mapping, and operating-system capacity. The following calls do not edit Nexus state.
# POSIX/Bash. Use only against the disposable loopback instance.
LAB="$HOME/nexus-ch05-lab"
NX_URL="http://127.0.0.1:8081"
mkdir -p "$LAB/evidence" "$LAB/payload" "$LAB/move"
umask 077
read -rsp "Disposable Nexus admin password: " NX_PASS; printf "\n"
printf 'machine 127.0.0.1 login admin password %s\n' "$NX_PASS" > "$LAB/nexus.netrc"
unset NX_PASS
NETRC="$LAB/nexus.netrc"
# Never print, commit, or reuse this temporary credential file.
curl -fsS "$NX_URL/service/rest/v1/status" | tee "$LAB/evidence/01-status.txt"
curl --fail-with-body --silent --show-error --netrc-file "$NETRC" "$NX_URL/service/rest/v1/blobstores" | tee "$LAB/evidence/02-blobstores.json"
curl --fail-with-body --silent --show-error --netrc-file "$NETRC" "$NX_URL/service/rest/v1/repositorySettings" | tee "$LAB/evidence/03-repository-settings.json"
# POSIX: inspect the filesystem that actually contains the Nexus data directory.
df -h "$HOME" | tee "$LAB/evidence/04-disk.txt"
rm -f "$NETRC"
unset NETRC
Windows PowerShell: use the same loopback URLs
with curl.exe. Keep the disposable credential in a
user-only temporary credential mechanism rather than embedding a
password in command history. Use
Get-FileHash -Algorithm SHA256 for hashes and
Get-Volume/Get-PSDrive for free-space
evidence. Do not run Nexus as Administrator merely to bypass a
permissions problem.
Also record the database mode from the supported Nexus System Information/Support view. Do not open the H2 database files to “prove” that H2 is in use.
9. Why this matters in DevOps
Artifact availability, build throughput, retention, recovery time, and upgrade safety all depend on storage architecture. A pipeline can be perfectly configured and still fail if the database becomes read-only, a blob volume has no headroom, object-store latency grows, or a backup contains only half of the state graph. Storage design therefore belongs in the service’s architecture decision records, capacity dashboard, backup runbook, and incident evidence.
Knowledge check
If a valid PostgreSQL backup exists but the blob bucket is missing, is Nexus fully recoverable?
No. Relational state and blob content are related recovery dependencies. Metadata can point to artifact bytes that are absent.
Does the default data directory equal the Nexus application directory?
No. The application distribution is replaceable software; the data directory contains persistent/runtime state and, for H2, the embedded database.
What does the current 4 GB free-space threshold mean operationally?
Below the documented threshold the database switches to read-only. Capacity alerting should trigger well before that boundary.
Can a successful client download prove the database and blob backup strategy is correct?
No. A download proves only that the requested path was served at that moment; it does not validate recovery consistency.
Why is “put the blob store on S3” not a database strategy?
A blob backend stores repository files. Nexus relational state still lives in H2 or PostgreSQL and needs its own supported protection and recovery plan.
10. Summary
Nexus storage is a coordinated state system, not a folder of packages. The next lesson creates disposable blob stores and repositories, measures real growth, and proves exact-byte transfer without touching internal database or blob files.
Official references and version notes
- Nexus Repository Download and 2026 self-hosted release notes — current downloadable/GA baseline.
- System Requirements — Java 21, H2/PostgreSQL guidance, file handles, disk threshold, and filesystem support.
- Database Options — embedded H2 versus external PostgreSQL.
- Directories — application and persistent data directory responsibilities.
- Storage Guide and Storage Planning — blob-store layouts, sizing, and performance implications.
- Blob Stores — blob count, used size, path, state, soft quotas, and lifecycle constraints.
- Blob Store API and REST API Reference — supported inspection/configuration endpoints.
- Change Repository Blob Store — supported Pro-only repository relocation task.
- Self-Hosted Feature Matrix — edition boundaries for storage and database capabilities.
- AWS S3 Blob Store — object-storage deployment guidance.
- Raw Repositories — hosted Raw repositories and HTTP PUT publication.
Version-sensitive statements were rechecked against Sonatype primary documentation on 2026-08-26. The current Download, versions-status, and 2026 release-notes pages list 3.94.1 as the newest GA/downloadable self-hosted line. Mandatory labs therefore pin Nexus Repository Community Edition 3.94.1-06 on loopback with Java 21 and embedded H2 only as a disposable learning database. Current system requirements recommend external PostgreSQL for supported production-scale deployments and require at least 4 GB of free disk at all times. Learners should re-check the live pages before executing the lab because Nexus support matrices evolve.
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0
Send only Ethereum/ERC-20 compatible assets to this
address.