Backup / File System / images


Well-known member
I have just found out that XenForo-software is saving all images (Avatar-images, image-attachments in threads) not in the "MySQL-database", but in the "File-system".

I am currently doing an automatic backup of the "MySQL-database" once per week via a Cronjob and save it to another server and also send the database-backup to my E-mail.

Since the images (Avatar-images, image-attachments in threads) are not being stored in the "MySQL-databse" but in the "File-system", my images are currently not being backed-up.

The big question is:
how do I perform a backup of the images (Avatar-images, image-attachments in threads) ?
I would like to create weekly backups of my "Files" as well.

Is there a script available which can automatically backup the "File-system" ?
How to do such a backup properly ?

Appreciate your tips and help!

Many thanks



XenForo moderator
Staff member
You can use an FTP program or if you have shell access, something like this to zip the contents, which will make downloading a lot quicker:
Zip Data Directory
tar -czf data_$(date +%d.%m.%y).tar.gz /path/to/data

Zip Internal Data Directory
tar -czf internal_data_$(date +%d.%m.%y).tar.gz /path/to/internal_data
And you only just found this out now? After three years?


Well-known member
hmmm :confused:

well, I do not want to "manually" perform the backup by transfering files via FTP back and forth.

I would like to install some "script" which creates a backup of all files "automagically" once per week.

Maybe somebody is doing this already and has a guide of which script to use, etc. ?



Well-known member
it seems everybody is just doing a backup of their "MySQL database", but not of their "File system" ?

So when your server crashes, all image-attachments in the Forums and Avatar-images are gone ?

I am actually wondering why the "images" are not in the "database" but in a file-system ?
Maybe because of better performance ? Hmmm....

Should I somehow move the "images & files" into the "MySQL database" and then make a backup of the database ?

Sorry, I have no clue about this at all..... just wondering how to do all that stuff.

Tracy Perry

Well-known member
it seems everybody is just doing a backup of their "MySQL database", but not of their "File system" ?
My Name is Nobody then I guess. <you'd have to have seen the movie> :p
I have a script on my servers that run as a CRON job and do a dump of the database, archive the structure of my forum(s) up then sends them to the other servers. Once every 3 days I have a CRON job on my MAC that scp's those files pertaining to the three forums over to my local computer - then I send them out to the two RAID servers I have here at the house.


Well-known member
do you know of a script or would you be able to recommend any specific script which I could use to backup my "Files" ?

Many thanks!


Well-known member
I much prefer to use rsync to back up the forum files (especially when you have 13GB of attachments in the /data/ directory!). The script I have backs up the whole public_html folder.

## Matt's script to copy sites to home NAS

# Location to store backups...

# Rsync options...


# Display greeter...
echo "Backing up home directory to NAS..."
echo ""

# Echo command to run...
echo /usr/bin/rsync -e "ssh -p ${NAS_PORT}" $OPTS $LOCAL_FORUM $NAS_USER@$NAS_HOST:$NAS_FORUM
echo ""
sleep 5

# now the actual transfer
/usr/bin/rsync -e "ssh -p ${NAS_PORT}" $OPTS $LOCAL_FORUM $NAS_USER@$NAS_HOST:$NAS_FORUM