Applicable Products
- All QNAP NAS models running QTS / QuTS hero
Scenario
- User wants to understand the purpose and typical space usage of
/tmp and /mnt/HDA_ROOT on a QNAP NAS - User wants to know what is normal vs. abnormal
Solution
Both /tmp and /mnt/HDA_ROOT are system-managed directories. QTS creates and deletes their contents automatically. Under normal circumstances, you do not need to monitor or clean them manually. QTS will issue a system notification if either filesystem runs critically low on space.
/tmp is a tmpfs (RAM-based filesystem) — it is recreated fresh on every reboot and does not persist across restarts./mnt/HDA_ROOT is the system partition — it stores QTS system configuration, QPKG metadata, and system logs.- If space is running low, identify what is consuming the space before deleting anything — blindly removing files can break QTS services.
How to Check Space Usage
Step 1: Check Overall Filesystem Usage (df)
# Show all mounted filesystems in human-readable form
df -h
# Filter to show only /tmp and HDA_ROOT
df -h | grep -E "tmp|HDA_ROOT"
Example output:
tmpfs 991M 42M 949M 5% /tmp
/dev/md9 371M 238M 114M 68% /mnt/HDA_ROOT
Normal ranges:
/tmp: A few MB to tens of MB used is normal. Above 80% may indicate a misbehaving service or accumulated temp files./mnt/HDA_ROOT: ~100–300 MB used out of ~400–500 MB total is typical. Above 80% warrants investigation.
The key is not the absolute number, but whether usage is trending upward over time.
Step 2: Find What Is Consuming Space (du)
Important: Always use the -x flag with du to avoid crossing mount boundaries — this prevents du from counting files on other filesystems.
# Top-level directory sizes under /tmp
du -xh --max-depth=1 /tmp
# Top-level directory sizes under /mnt/HDA_ROOT
du -xh --max-depth=1 /mnt/HDA_ROOT
Example output (/tmp on a healthy system):
4.0K /tmp/config
68K /tmp/medialibrary
332K /tmp/smart
884K /tmp/.malware_remover
1.6M /tmp/rssdoc
6.1M /tmp
Example output (/mnt/HDA_ROOT on a healthy system):
8.0K /mnt/HDA_ROOT/.qpkg
3.0M /mnt/HDA_ROOT/archive
12M /mnt/HDA_ROOT/ssl_lib
53M /mnt/HDA_ROOT/.config
77M /mnt/HDA_ROOT/.logs
117M /mnt/HDA_ROOT/update_pkg
260M /mnt/HDA_ROOT/
What Is Normal vs. Abnormal
| Directory | Normal | Investigate If |
|---|
/tmp | A few MB to tens of MB; fluctuates with services starting/stopping | Above 80% for extended period; single large files (> 50 MB); rapidly growing files |
/mnt/HDA_ROOT | ~100–300 MB used (~400–500 MB total); stable over time | Above 80% used and continuing to grow; update_pkg left over after a failed firmware update; unexpectedly large .logs directory |
Common Causes of Abnormal Space Usage
- /tmp filling up:
- A crashed or hung service writing logs to /tmp continuously
- QPKG installation that failed mid-extract, leaving large
.tmp or .img files - Third-party scripts (e.g.
autorun.sh) writing output to /tmp without log rotation
- /mnt/HDA_ROOT filling up:
- Failed firmware update leaving a large
update_pkg file - Excessive system log accumulation in
.logs (especially .logs/network) - Third-party QPKGs storing data in the system partition instead of a volume
- Core dump files from crashed processes
- LVM archive growth in
.config/lvm/archive
Warning Signs That Require Attention
/tmp or root RAMDISK (/) stays near 100% for extended periods/mnt/HDA_ROOT usage > 80% and continues to grow- NAS exhibits: unable to shut down or reboot properly; Web UI fails to load or services won't start; system notification: "System storage insufficient"
Does QTS Handle Cleanup Automatically?
Yes. QTS manages both directories automatically:
- /tmp: Being a tmpfs, it is completely recreated on every reboot. QTS services clean up their own temp files during normal operation. A reboot is the ultimate cleanup for /tmp.
- /mnt/HDA_ROOT: QTS performs log rotation (managed by
syslog-ng and logrotate) and cleans up firmware update staging files after successful updates. The QTS lifecycle manages update and temp files automatically. - System alerts: If either filesystem reaches a critical threshold, QTS will generate a notification in the Notification Center (and optionally via email/push). The notification will typically say: "System storage insufficient".
Why bother with df / du at all? These commands are for debugging and troubleshooting, not daily monitoring. Use them to identify which service or QPKG is behaving abnormally, and determine whether to disable an app, restart a service, update/rollback firmware, or contact QNAP support (with logs attached).
Best practice: Under normal operation, there is no need to manually monitor or clean these directories. Only investigate when QTS generates a space alert or when troubleshooting a specific issue (e.g. shutdown hang, app installation failure).
Further Reading
适用产品
- All QNAP NAS models running QTS / QuTS hero
场景
- 用户希望了解在 QNAP NAS 上
/tmp和/mnt/HDA_ROOT的用途及典型空间使用情况 - 用户希望知道什么是正常的,什么是不正常的
解决方案
/tmp和/mnt/HDA_ROOT都是系统管理目录。QTS 会自动创建和删除其内容。在正常情况下,您无需手动监控或清理它们。如果文件系统空间严重不足,QTS 会发出系统通知。
/tmp是一个tmpfs(基于 RAM 的文件系统) —— 每次重启时都会重新创建,不会在重启后保留。/mnt/HDA_ROOT是系统分区 —— 它存储 QTS 系统配置、QPKG 元数据和系统日志。- 如果空间不足,请先识别是什么占用了空间再删除任何内容 —— 盲目删除文件可能会破坏 QTS 服务。
如何检查空间使用情况
步骤 1:检查整体文件系统使用情况 (df)
# 以人类可读的形式显示所有挂载的文件系统
df -h
# 过滤以仅显示 /tmp 和 HDA_ROOT
df -h | grep -E "tmp|HDA_ROOT"
示例输出:
tmpfs 991M 42M 949M 5% /tmp
/dev/md9 371M 238M 114M 68% /mnt/HDA_ROOT
正常范围:
/tmp: 使用几 MB 到几十 MB 是正常的。超过 80% 可能表示服务异常或临时文件积累。/mnt/HDA_ROOT: 使用约 100–300 MB,总计约 400–500 MB 是典型的。超过 80% 需要调查。
关键不是绝对数字,而是使用量是否随着时间推移而上升。
步骤 2:查找占用空间的内容 (du)
重要:始终使用-x标志与du一起使用,以避免跨越挂载边界——这可以防止du计算其他文件系统上的文件。
# /tmp 下的优异目录大小
du -xh --max-depth=1 /tmp
# /mnt/HDA_ROOT 下的优异目录大小
du -xh --max-depth=1 /mnt/HDA_ROOT
示例输出(/tmp在健康系统上):
4.0K /tmp/config
68K /tmp/medialibrary
332K /tmp/smart
884K /tmp/.malware_remover
1.6M /tmp/rssdoc
6.1M /tmp
示例输出(/mnt/HDA_ROOT在健康系统上):
8.0K /mnt/HDA_ROOT/.qpkg
3.0M /mnt/HDA_ROOT/archive
12M /mnt/HDA_ROOT/ssl_lib
53M /mnt/HDA_ROOT/.config
77M /mnt/HDA_ROOT/.logs
117M /mnt/HDA_ROOT/update_pkg
260M /mnt/HDA_ROOT/
什么是正常与异常
| 目录 | 正常 | 需要调查的情况 |
|---|
/tmp | 几 MB 到几十 MB;随服务启动 / 停止而波动 | 超过 80% 持续一段时间;单个大文件(> 50 MB);文件快速增长 |
/mnt/HDA_ROOT | ~100–300 MB 已使用(总计约 400–500 MB);随时间稳定 | 使用率超过 80% 并持续增长;update_pkg在固件更新失败后剩余;意外的大型.logs目录 |
异常空间使用的常见原因
- /tmp 填满:
- 崩溃或挂起的服务持续将日志写入 /tmp
- QPKG 安装中途失败,留下大型
.tmp或.img文件 - 第三方脚本(例如
autorun.sh)将输出写入 /tmp 而不进行日志轮替
- /mnt/HDA_ROOT 填满:
- 失败的固件更新留下大型
update_pkg文件 - 系统日志在
.logs中过多累积(尤其是.logs/network) - 第三方 QPKG 将数据存储在系统分区而不是卷中
- 崩溃进程的核心转储文件
- LVM 归档在
.config/lvm/archive中增长
需要注意的警告信号
/tmp或根 RAMDISK (/) 长时间接近 100%/mnt/HDA_ROOT使用率 > 80% 并继续增长- NAS 表现:无法正常关机或重启;Web UI 无法加载或服务无法启动;系统通知:“系统存储不足”
QTS 是否自动处理清理工作?
是的。QTS 会自动管理这两个目录:
- /tmp:作为一个 tmpfs,它在每次重启时都会重建。QTS 服务在正常操作期间会清理自己的临时文件。重启是 /tmp 的较终清理方式。
- /mnt/HDA_ROOT:QTS 执行日志轮换(由
syslog-ng和logrotate管理)并在成功更新后清理固件更新暂存文件。QTS 生命周期自动管理更新和临时文件。 - 系统警报:如果任一文件系统达到临界阈值,QTS 将在通知中心中生成通知(也可以通过电子邮件 / 推送通知)。通知通常会说:"系统存储不足"。
为什么要麻烦df / du?这些命令用于调试和故障排除,而不是日常监控。使用它们来识别哪个服务或 QPKG 行为异常,并决定是否禁用应用程序、重启服务、更新 / 回滚固件,或联系 QNAP 支持(附上日志)。
较佳实践:在正常操作下,无需手动监控或清理这些目录。只有在 QTS 生成空间警报或排查特定问题时(例如关机挂起、应用安装失败)才进行调查。
进一步阅读