Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

/srv

Direct answer

/srv is meant for data served by the system — web sites, FTP or file shares — for example /srv/www or /srv/nfs.

When to use this

Use it as a location for service data, and when a service cannot read its content there.

First 30 seconds

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.

Operational verification

/srv mounted (or virtual) → correct owner and permissions → enough space → services read and write as intended

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it as a location for service data, and when a service cannot read its content there.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points

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.

Key checks
  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <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

PathContent
/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>
ContentData that clients see (files, sites)A program's internal state (database files)
Chosen byThe administratorThe program or package
Typical accessThrough web, SFTP, NFS, SMBOnly through the program
Example/srv/www/intranet/var/lib/postgresql

Operational practice

TopicPractice
Separate file system or LVData growth can't fill root; easier to move and resize
Mount optionsnodev,nosuid, and often noexec for upload areas
OwnershipA dedicated group per service area; setgid directories
SELinuxWeb content outside /var/www needs the right context (httpd_sys_content_t)
BackupsInclude 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
linux /srvservice data directory linuxsrv directory purposeserved data linux
Embedded reference data

Quick lookup tables

/srv operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for /srv.

Lookup boundaryTopic-specific referenceOperational 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 verificationPin 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 chainservice configuration → /srv or alternate content root → mount/backing data → filesystem authorization/security context → service read → network/client deliveryTrace 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 evidenceCorrelated 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 deliveryUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 pathFilesystem → /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 chainservice 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?