QNAP NAS RAMDisk Full [Resolved]

A problem that has been lingering around for over 10 years and does not seem to hold a resolution other than rebooting the QNAP is resolved, well at least for my particular situation.  Even on a fairly modern TS-1273AU-RP QNAP this problem persists. This QNAP has only one application installed, everything else is removed that can be removed.  Those apps that cannot be removed are disabled. The sole purpose of this QNAP is to serve as an iSCSI Target. Yet, presented with the following error on the QNAP dashboard.

QNAP: A system failure occurred.

The problem is that there is only 400+ MB of ramdisk.

Filesystem Type   Size       Used   Available   Capacity  Mounted on
none       tmpfs  432.0M   432.0M          0%       100%  /

One article that suggested to determine any directory size over 1M in size.

du -hx / | grep '[0-9]M'

That command led to the /var/log directory, where exists a 100MB log, hero_iscsi_scst.log, for iSCSI.

cd /var/log
cat /dev/null > hero_iscsi_scst.log

There are other ways to delete that file, but this worked.  This resolved the diskspace issue and was able to continue to work from the QNAP.

Automatically

Create a cronjob, but not the usual way (link below), load the job, then restart the service. The job below will zero byte the log every three months on the first of that month at 1 am.

echo "0 1 1 */3 * /bin/true > /var/log/hero_iscsi_scst.log" >> /etc/config/crontab
crontab /etc/config/crontab && /etc/init.d/crond.sh restart

Source(s)

  • https://www.tecmint.com/empty-delete-file-content-linux/
  • https://forum.qnap.com/viewtopic.php?f=45&t=71490&start=60#p536852
  • https://forum.qnap.com/viewtopic.php?t=126856
  • https://wiki.qnap.com/wiki/Add_items_to_crontab
  • https://superuser.com/questions/849413/why-would-you-cat-dev-null-var-log-messages