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

Backup / File System / images

Discussion in 'Server Configuration and Hosting' started by erich37, Aug 7, 2013.

  1. erich37

    erich37 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

  2. Brogan

    Brogan 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?
    erich37 likes this.
  3. erich37

    erich37 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. ?

  4. Brogan

    Brogan XenForo Moderator Staff Member

  5. Jeremy

    Jeremy Well-Known Member

    You should be able to convert the above to a script and set it up to run automatically.
  6. erich37

    erich37 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.
  7. Jeremy

    Jeremy Well-Known Member

    XenForo doesn't support images in the database at this time.
  8. Brogan

    Brogan XenForo Moderator Staff Member

    I back mine up regularly.

    There is no option to store files in the database.
  9. Tracy Perry

    Tracy Perry Well-Known Member

    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.
  10. erich37

    erich37 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!
  11. Chris D

    Chris D XenForo Developer Staff Member

  12. Jeremy

    Jeremy Well-Known Member

    Paul posted a script above that should be editable with his commands above to function to back up files. I'm sure Matt can help you if you ask nicely.
    MattW and erich37 like this.
  13. MattW

    MattW 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
    erich37 and Jeremy like this.
  14. Floren

    Floren Well-Known Member

  15. erich37

    erich37 Well-Known Member

    so "rsync" is a separate script which I can download somewhere on the internet or is this "rsync" included in your backup-script ?


    Many thanks!
  16. MattW

    MattW Well-Known Member

    erich37 likes this.

Share This Page