OMG! Even I backup the NAS data in somewhere, the multimedia indies, QPhoto album, QNote,...etc., are gone!
Several days ago, my QTier's SSD was damaged. Since I have backed up the data using Hybrid Backup 3 to another QNAP, I felt safe. However, after I fixed the volume, all Qphoto album, tags,...all are gone!
Regarding the post from QNAP forum, backing up the QNAP system and application data is not recommended by QNAP due to the different system configurations between old and new machine.
Of course, we can easily backup the user data that can be accessed from "Share Folder". However, the user data stored by QNAP system or QNAP App, like QPhotos, Thumbnails, Indexing data,...etc., are inaccessible directly by user. Those user data are also important and need to be backed it up.
Finally, I cam up the following method:
- Access QNAP using SSH. "admin" account is used.
- Locate the folders / files
- Create the script - user rsync to backup the data to another disc or location
- Setup the cronjob
(Please noted that the following information may not be applied for different model or use case. I am using QNAP TS-253D. Two harddisk attached without RAID)
The source folder/file locations
The following are the folders/files after inspection:
(Note: The QNAP system is installed in the 1st disk. So that mount point is /share/CACHEDEV1_DATA/
)
Path | Description | Remarks |
---|---|---|
/share/CACHEDEV1_DATA/.system/ | QNap System folder | Data and Database are stored here. |
/share/CACHEDEV1_DATA/.@backup_config/ | ||
/share/CACHEDEV1_DATA/.@backup_qbox/ | ||
/share/CACHEDEV1_DATA/.@qmonitor/ | ||
/share/CACHEDEV1_DATA/.@qsync | ||
/share/CACHEDEV1_DATA/.@station_config/ | ||
/share/CACHEDEV1_DATA/.codesigning/ | ||
/share/CACHEDEV1_DATA/.idmap | ||
/share/CACHEDEV1_DATA/.ldapdb | ||
/share/CACHEDEV1_DATA/.musicdata/ | ||
/share/CACHEDEV1_DATA/.qbox/ | ||
/share/CACHEDEV1_DATA/.qcoolie | ||
/share/CACHEDEV1_DATA/.qextension | ||
/share/CACHEDEV1_DATA/.qpkg/ | QPkg App | Include App data? |
/share/CACHEDEV1_DATA/.samba/ |
Folders under /share/CACHEDEV1_DATA/.system
that I will consider to back it up:
Path | Description | Remarks |
---|---|---|
./data/ | ||
./facedata/ | ||
./idbserver.conf | ||
./mediaconverter/ | ||
./mlindexdir.json | ||
./music/ | ||
./qmonitor/ | ||
./qtranscode/ | ||
./root_cert/ | ||
./thumbnail/ | ||
./tmp/ | ||
./video/ | ||
./wfm/ | ||
./xcodesvr.xml |
The backup script
I create the script and place it at /share/homes/admin/scripts/backup-qnap-files.sh
. Please noted that:
- Recursive flag
-r
must be given explicitly when using--files-from
- Source folder is
/
- Source file/folder list are placed at
/share/homes/admin/scripts/backup-qnap-files.lst
- Exclude file/folder list are placed at
/share/homes/admin/scripts/backup-qnap-files.exclude.lst
- Destination folder is
/share/backup-qnap-data/data
- RSync log is placed at
/share/backup-qnap-data/log
#!/bin/sh rsync -av --delete \ --files-from=/share/homes/admin/scripts/backup-qnap-files.lst \ --exclude-from=/share/homes/admin/scripts/backup-qnap-files.exclude.lst \ --log-file=/share/backup-qnap-data/log/backup-qnap-files.`date +%Y%m%d-%H%M%S`.log \ -r \ / /share/backup-qnap-data/data
Content of backup-qnap-files.lst
/share/CACHEDEV1_DATA/.system/ /share/CACHEDEV1_DATA/.musicdata/ /share/CACHEDEV1_DATA/.qbox/ /share/CACHEDEV1_DATA/.samba/ /share/CACHEDEV1_DATA/.@backup_config/ /share/CACHEDEV1_DATA/.@backup_qbox/ /share/CACHEDEV1_DATA/.codesigning/ /share/CACHEDEV1_DATA/.qpkg/ /share/CACHEDEV1_DATA/.@station_config/ /share/CACHEDEV1_DATA/.@qmonitor/ /share/CACHEDEV1_DATA/.idmap /share/CACHEDEV1_DATA/.ldapdb /share/CACHEDEV1_DATA/.qcoolie /share/CACHEDEV1_DATA/.qextension /share/CACHEDEV1_DATA/.@qsync
Content of backup-qnap-files.exclude.lst
/share/CACHEDEV1_DATA/.qpkg/MediaSignPlayer/ /share/CACHEDEV1_DATA/.system/bluetooth/ /share/CACHEDEV1_DATA/.qpkg/container-station/run/ /share/CACHEDEV1_DATA/.samba/lock/ # /share/CACHEDEV1_DATA/.system/log/ # /share/CACHEDEV1_DATA/.system/LOG/
Cronjob
Edit /etc/config/crontab
and Add the job
In my case,, I want to run the job at 2:30am everyday:
vi /etc/config/crontab # Add this line (e.g. Run backup at 2:30am everyday): 30 2 * * * /share/homes/admin/scripts/backup-qnap-files.sh >/dev/null 2>&1
Apply the crontab and restart daemon:
crontab /etc/config/crontab && /etc/init.d/crond.sh restart
References: