Use it as a location for service data, and when a service cannot read its content there.
/srv
/srv is meant for data served by the system — web sites, FTP or file shares — for example /srv/www or /srv/nfs.
1. ls -ld /srv and findmnt /srv — present and mounted where expected?
2. df -h /srv — space left? df -i /srv — inodes left?
3. Find large or unexpected content: du -xh --max-depth=1 /srv | sort -h | tail.
4. Permissions and owner as the FHS and services expect?
5. Fix space, permissions or mount, then retest the service.
/srv mounted (or virtual) → correct owner and permissions → enough space → services read and write as intended
For Filesystem → /srv, continue with the first unproven Topic check: Identify the service’s configured document/data root instead of assuming /srv. If that boundary is healthy, advance to the adjacent check: Verify mount/backing source, ownership, mode/ACL and any MAC/security context. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
service configuration → /srv or alternate content root → mount/backing data → filesystem authorization/security context → service read → network/client delivery
Healthy evidence: service configuration points to the intended content, backing storage and authorization are correct, and the client receives the expected data.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Identify the service’s configured document/data root instead of assuming /srv.
- Verify mount/backing source, ownership, mode/ACL and any MAC/security context.
- Test access as the actual service identity and inspect service logs/configuration.
- Verify the external/client-facing request if /srv content is intended to be served.
Verification chain. service configuration → /srv or alternate content root → mount/backing data → filesystem authorization/security context → service read → network/client delivery
Step 3 Commands Verify boundary
ls /srv
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: /srv is assumed authoritative without checking service config, local root access is used as service-access evidence, or network failures are blamed on path layout alone.
/srv shows conventional data placement only, but it does not show service configuration, authorization or client reachability.
Step 5 Common mistakes Narrow the fault
- Inconsistent data locations between servers.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Distributions do not use /srv by default (Apache uses /var/www), so permissions and SELinux labels must be set for it — e.g. semanage fcontext for web content.
ls -ld <path>— owner, permissions and typestat <path>— inode, links, size and timestampsdf -h <path>— filesystem and free spacefindmnt <path>— which mount the path is on
ReferenceWhat it is1 section · depth on demand
Core model
Use /srv as a placement convention, then verify the service’s authoritative configuration, mount/source, ownership and security context. The pathname alone does not show the service consumes it or that the content is reachable externally.
ReferenceImportant terms & boundaries6 sections · depth on demand
What this shows and what it does not
/srv shows conventional data placement only, but it does not show service configuration, authorization or client reachability.
In depth
/srv: data served by this host
The hier(7) manual page describes /srv as site-specific data served by this system. It's the natural home for web content, FTP and SFTP areas, Git repositories, file shares and other data that clients access through a service. Distributions leave it empty, so the layout is the administrator's choice.
Common layouts
| Path | Content |
|---|---|
/srv/www/<site> | Web site content |
/srv/sftp/<user> | Chrooted SFTP areas |
/srv/git/ | Bare Git repositories |
/srv/nfs/, /srv/samba/ | Exported shares |
/srv/backup/ | A backup target |
/srv compared with /var/lib
/srv | /var/lib/<program> | |
|---|---|---|
| Content | Data that clients see (files, sites) | A program's internal state (database files) |
| Chosen by | The administrator | The program or package |
| Typical access | Through web, SFTP, NFS, SMB | Only through the program |
| Example | /srv/www/intranet | /var/lib/postgresql |
Operational practice
| Topic | Practice |
|---|---|
| Separate file system or LV | Data growth can't fill root; easier to move and resize |
| Mount options | nodev,nosuid, and often noexec for upload areas |
| Ownership | A dedicated group per service area; setgid directories |
| SELinux | Web content outside /var/www needs the right context (httpd_sys_content_t) |
| Backups | Include all of /srv; it's the data clients care about |
host$ sudo lvcreate -L 200G -n srv vg1 && sudo mkfs.xfs /dev/vg1/srv
host$ echo '/dev/vg1/srv /srv xfs defaults,nodev,nosuid 0 0' | sudo tee -a /etc/fstab
host$ sudo mount /srv && findmnt /srv
host$ sudo mkdir -p /srv/www/intranet && sudo chown -R root:www-data /srv/www && sudo chmod -R 2750 /srv/www
host$ sudo semanage fcontext -a -t httpd_sys_content_t "/srv/www(/.*)?"
host$ sudo restorecon -Rv /srv/www
host$ ls -Zd /srv/www/intranet
SELinux and /srv
On SELinux systems, files under /srv get a generic context by default, and a web server is denied access to them even when the Unix permissions allow it. The semanage fcontext and restorecon steps give the tree the web content type, permanently. A plain chcon would be undone by the next relabel.
Documented example, not captured output.
Known-good, transitional and broken reference
/srv — comparative operational reference for Filesystem → /srv. What it does not show: systemd active/running or host-global state alone does not show the workload context is healthy Next check: move one step toward the original workload using Inspect the path and mount in the process namespace, effective UID/GID/ACL/LSM decision, filesystem/inode state and backend errors, then repeat the original file operation.
How it works at runtime
/srv is part of Filesystem → /srv. /srv is an FHS location intended for site-specific data served by services, such as web, FTP or repository content, but actual application and distribution layouts vary widely and many services use /var/lib, /var/www or custom paths instead.
Topic-specific state model. /srv is an FHS location intended for site-specific data served by services, such as web, FTP or repository content, but actual application and distribution layouts vary widely and many services use /var/lib, /var/www or custom paths instead.
Interpretation rule. - /srv purpose ≠ every service stores served data there.
- Directory populated ≠ service configuration points to that directory.
- Local readability ≠ service identity/security context can read the content.
- Service reads local content ≠ network/client access path is healthy.
Quick reference
/srv is meant for data served by the system (web roots, FTP, Git repositories, file shares), giving a clear place for data volumes separate from OS files.
When using /srv with SELinux, add file-context rules (semanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?') because the default label for /srv is generic (var_t). Mount data volumes here (/srv/data) to keep backups and capacity management simple.
Limits and how it fails
Primary failure point. /srv shows conventional data placement only, but it does not show service configuration, authorization or client reachability.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. /srv owns FHS served-data placement. Individual server applications, permissions/security and Networking own configuration and delivery behavior.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Filesystem → /srv. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
/srv operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for /srv.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | /srv is an FHS location intended for site-specific data served by services, such as web, FTP or repository content, but actual application and distribution layouts vary widely and many services use /var/lib, /var/www or custom paths instead. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin process/container mount namespace → resolve the exact path from / and record every mount crossing → identify final dentry + filesystem/device + inode + file type → capture ownership/mode/ACL and capacity where relevant → map pseudo/device/runtime objects to the live kernel/process endpoint → verify the original consumer read/write/execute/service result. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | service configuration → /srv or alternate content root → mount/backing data → filesystem authorization/security context → service read → network/client delivery | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | /srv proves conventional data placement only; it does not prove service configuration, authorization or client reachability. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated namespace, path and object evidence can establish this Linux Filesystem proof path: service configuration → /srv or alternate content root → mount/backing data → filesystem authorization/security context → service read → network/client delivery | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured namespace, mount, inode/object, authorization, backing-resource or consumer scope. /srv proves conventional data placement only; it does not prove service configuration, authorization or client reachability. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven boundary: preserve the same process mount namespace, resolve the path and mount crossings, identify the exact object/inode or live pseudo/device endpoint, inspect effective access/capacity, then repeat the original consumer operation before changing unrelated filesystem state. | Continue to the next unresolved boundary while preserving the original test condition. |
/srv · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | /srv |
|---|---|
| Topic path | Filesystem → /srv |
| Runtime state | /srv is an FHS location intended for site-specific data served by services, such as web, FTP or repository content, but actual application and distribution layouts vary widely and many services use /var/lib, /var/www or custom paths instead. |
| Fast checks | - Identify the service’s configured document/data root instead of assuming /srv. - Verify mount/backing source, ownership, mode/ACL and any MAC/security context. - Test access as the actual service identity and inspect service logs/configuration. - Verify the external/client-facing request if /srv content is intended to be served. |
| Verification chain | service configuration → /srv or alternate content root → mount/backing data → filesystem authorization/security context → service read → network/client delivery Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | /srv proves conventional data placement only; it does not prove service configuration, authorization or client reachability. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |