NAS Error: "no space left on device"
Network Attached Storage (NAS) devices and Linux devices use a unique directory called /tmp during a backup with Magnus Box. It is not persistent storage (uses device's RAM, capped at ~50% usage), and it will be cleared after every reboot. More information can be found on this Wikipedia article.
During the backup process, Magnus Box will create a number of different files as it de-duplicates data and saves metadata. Once the backup completes, these files will be deleted. However, if Magnus Box is unable to create these files during a backup, the job will stall and fail to complete. To remedy the "Couldn't save data chunk: Write: no more space left on device" error, the temporary directory location can be changed.
Note: This workflow will need to be repeated after every update of Magnus Box. A more permanent solution may be offered in the future.
These steps are for NAS and Linux devices. To change the temporary directory on macOS or Windows, see Changing Magnus Box's temporary directory.
Changing via SSH
To change the temporary directory via SSH, log in to the NAS via Windows Command Prompt or Mac's Terminal app. Then,
- Create a new temporary folder with the following command:
mkdir /var/tmp/backup-tmp - Navigate to
/opt/<branded-backup-name>/(replacing "<branded-backup-name>" with the name of your backup software without spaces) - Make a backup copy of the startup script first:
sudo cp -p backup-daemon-start.sh backup-daemon-start.sh.bak - Edit the
backup-daemon-start.shscript with either nano or vim- Ex.
sudo nano backup-daemon-start.sh
- Ex.
- Add the following to the top of the file after
#!/bin/bash:export TMPDIR=/var/tmp/backup-tmp
- Save the file
The top of the file should now resemble this:
#!/bin/bash
export TMPDIR=/var/tmp/backup-tmp
set +eu
if test $UID -eq 0 ; then
# Workaround for missing /root var in Synology DSM /rc.d/ scripts
if test -z $HOME ; then
...
Now, restart the NAS device and initiate a manual backup to confirm the issue was resolved.
Changing via Backup Command
If SSH access is not available, a command can be added to the applicable backup to create and specify the new temporary directory. Note: this command should only be run once! After running the command, remove it from the Commands section.
Add the following command to the backup job as a Before command (in the Protected Item's Commands section), start a backup so the command runs, and then remove the command from the backup job. Restart the NAS, and start a manual backup to confirm that the issue was resolved.
F=/opt/<branded-backup-name>/backup-daemon-start.sh; grep -q '^export TMPDIR=' "$F" || { mkdir -p /var/tmp/backup-tmp && cp -p "$F" "$F.bak" && sed '1a export TMPDIR=/var/tmp/backup-tmp' "$F.bak" > "$F"; }
What the command does:
- It skips everything if the script already sets
TMPDIR, so running it twice does no harm. - It creates the new temporary folder.
- It saves a copy of the startup script as
backup-daemon-start.sh.bak, keeping its permissions. - It reads that copy and writes the script back with
export TMPDIR=/var/tmp/backup-tmpadded after the first line (#!/bin/bash). Because it reads from the copy rather than the file it's writing, the script can't be emptied halfway through.
Replace "<branded-backup-name>" with the name of your branded application, excluding spaces. For Magnus Box branded partners, this is "MagnusBox". For example, on our development server, where the branded name is "MagnusBoxDevOps", the first part reads F=/opt/MagnusBoxDevOps/backup-daemon-start.sh.
If anything goes wrong, put the original back with cp -p /opt/<branded-backup-name>/backup-daemon-start.sh.bak /opt/<branded-backup-name>/backup-daemon-start.sh.
Warning: don't use a command that reads and writes the same file in one pipeline, such as sed ... file | tee file. The shell can truncate the file before it's read, which leaves an empty startup script and stops Magnus Box from starting.
Related articles
- Changing Magnus Box's temporary directory (macOS, Windows and other Linux devices)
If there are any issues, or if you have any questions, please email support@magnusbox.com.