Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Tools and frameworks

Linux Server Operations

About 4010 characters Updated Nov 30, 2026 21 views AI wiki

Linux server operations refers to the daily management of processes, services, storage, network, and logs on online machines to ensure long-term stable operation of the system. In AI applications, training jobs, inference services, vector stores, caches, and scheduling scripts all run on the same batch of machines, and how well operations are done is directly reflected in "whether you get woken up in the middle of the night."

Core Principles

Everything in Linux can be understood as files and processes. Processes are scheduled by the kernel, services are hosted by the process manager, resources are described through the file system (everything is a file), and status can be observed directly through /proc and /sys. The core methodology of operations is: look at the phenomenon first, then locate the bottleneck with means of limited scope, and finally fix it with the smallest change. Get the order wrong and you fall into a loop of blind restarts.

Resource bottlenecks usually fall into only four categories: CPU, memory, disk, and network. When troubleshooting, look at load and utilization first, then at the specific process, and finally at whether the system level is stuck on some limit (file handles, TCP connections, cgroup quotas). After containerization, an extra layer of awareness is needed: the memory and CPU a container sees are often a restricted view, and the numbers on the host and inside the container may not match, so looking only at in-container data easily leads to misjudgment.

Another basic concept is permissions and minimal exposure. Online machines should open only necessary ports, use a dedicated account and public key for login, disable password login and direct root login, and keep a record of sudo operations. Doing security configuration in advance costs far less than hardening afterward, and it also prevents a training machine from becoming a springboard.

Key Points

First, systemd services are the standard way to host long-running processes. Write a unit file, configure ExecStart, restart policy, WorkingDirectory, environment variables, and resource limits, and let the system handle starting, restarting, and auto-start at boot. The key configurations are Restart=on-failure and RestartSec, to avoid a process being left unattended after a crash or restarting wildly to form a storm. Viewing service logs with journalctl -u is far more efficient than digging through scattered files, and services with large log volumes should configure journald size limits, otherwise the disk will be quietly filled up.

Second, disk cleanup is the highest-frequency firefighting action. First look at partition usage and inode usage, both of which can be full. Common big consumers are logs, Docker images and container layers, cache directories, old kernels, and temporary downloaded files. The recommended order is: compress and rotate logs first, then clean build caches, and only then consider deleting data files; before deleting, confirm whether they are held by a mounted process (use lsof to find deleted but still open files, which occupy space yet are invisible).

Third, process troubleshooting needs method. See who is eating CPU, who is eating memory, who is frantically reading and writing disk; confirm whether a process is a zombie or truly stuck; use strace to observe system calls, and the thread view of top to see whether a single thread is saturated; when OOM occurs, check the kernel log to confirm the killed object and the trigger. Do not start with kill -9, which skips cleanup logic and may leave lock files and half-written data.

Fourth, log rotation must be configured in advance. Use logrotate to split by size and time, retain several copies and compress them, and use copytruncate or a signal to make the process reopen the file handle. Many services never rotate by default and fill the disk after a few months. The rotation policy must be balanced against troubleshooting needs: too short a retention period and no history can be found when a problem occurs; too long and disk costs are high.

Common Misconceptions

Misconception one: hanging services in the background with nohup, so they all disappear after a machine restart and no one knows the startup parameters. Misconception two: when the disk is full, deleting logs first without checking whether a process still holds the handle, so space is not released. Misconception three: restarting as soon as load is high, masking root causes such as slow queries or memory leaks.

Application Scenarios

Hosting and self-healing of inference services, supervision of training jobs, emergency handling of disk space, resource troubleshooting on GPU machines, centralized log management, container host maintenance, and batch script scheduling.