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
情境
- 使用者想了解
/tmp和/mnt/HDA_ROOT在 QNAP NAS 上的用途及典型空間使用情況 - 使用者想知道什麼是正常與異常
解決方案
/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) - 第三方 QPKGs 將資料存儲在系統分區而非卷
- 崩潰進程的核心轉儲檔案
- 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 生成空間警報或排除特定問題時(例如關機掛起、應用程式安裝失敗)才進行調查。
進一步閱讀