• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Backup / File System / images

erich37

Well-known member
#1
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

:)
 

Brogan

XenForo moderator
Staff member
#2
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:
Code:
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?
 

erich37

Well-known member
#3
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. ?


:)
 

erich37

Well-known member
#6
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
#9
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.
 

erich37

Well-known member
#10
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!
 

MattW

Well-known member
#13
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.

Code:
#!/bin/bash
## Matt's script to copy sites to home NAS

# Location to store backups...
NAS_HOST="URL/IP"
NAS_PORT="SSH PORT"
NAS_USER="root"
NAS_FORUM="/mnt/soho_storage/samba/shares/Matt/Websites/Z22SE.co.uk"

# Rsync options...
OPTS="-aruvPz
      --compress-level=9
      --itemize-changes
      --delete
      --human-readable
      --stats"

LOCAL_FORUM="/home/z22se/public_html/"

# 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