Forum

Results 1 to 8 of 8
  1. #1
    Join Date
    April 2013
    Location
    Germany
    Posts
    86

    A little question about backup

    Hi,
    I have a little question about server backup
    My server is running on debian without mysql database.
    If i do a cron job with just a cp dommand from ts3server folder to a backup folder, can the backup works ?
    for example :
    Code:
    cp -Rf /home/servers/ts3 /home/ts3backup
    PS: I want all backuping (permissions, ident, icons and channels)

    Regards

  2. #2
    Join Date
    December 2004
    Location
    RF
    Posts
    3,006
    You need to stop server first, if you want to backup it on file level.
    Othervise, read manual.

  3. #3
    Join Date
    April 2013
    Location
    Germany
    Posts
    86
    Ok thank you

  4. #4
    Join Date
    February 2012
    Location
    Germany
    Posts
    576
    Don't use cp, but you can make kind of a snapshot backup of a sqlite database. Sqlite allows concurrent access of different processes to its database files, if everyone accessing is using the sqlite API. It's consistent from the sqlite point of view, but not necessarily from the Teamspeak point of view, if the Teamspeak server isn't using transactions for multi-table updates. If you do the backup in low-usage times, for example around 5:30 am, chances are good that the backup is perfectly fine.

    You need the sqlite package for /usr/bin/sqlite3, and assuming your Teamspeak server database is in /var/lib/teamspeak3/ts3server.sqlitedb, you do this to make a consistent backup to /var/lib/teamspeak3/backups/:
    Code:
    # perform a clean copy of the sqlite database
    sqlite3 /var/lib/teamspeak3/ts3server.sqlitedb ".backup /var/lib/teamspeak3/backups/ts3server.sqlitedb.`date +%Y%m%d-%H%M%S`"
    Additionally, you have to backup the files/ directory structure, since it's there where the icons, avatar files and uploaded channel files are saved.

    To restore from that backup, rename ts3server.sqlitedb.YYYYMMDD to ts3server.sqlitedb and move it to its original directory.

  5. #5
    Join Date
    April 2013
    Location
    Germany
    Posts
    86
    Quote Originally Posted by schlumpi View Post
    don't use cp,
    but why...?

  6. #6
    Join Date
    February 2012
    Location
    Germany
    Posts
    576
    Because if in the moment you do cp the server updates data in the database file, the copy is no exact copy of the database file any more. If the update requires 2 write operations, it is possible that the first write isn't in the copy, because cp has already copied the part of the file that contains the first update, but the second write is in the copy, because it is more at the end of the file and cp has not yet read that part. So you have an incomplete update in the the copied database file, and that usually means a broken database that cannot be used as backup.

    If you create a copy with the sqlite .backup command instead, like I proposed, sqlite uses the API of sqlite to wait until there is no database update pending. Then it locks the database file for updates (prohibits them), and then it copies the database contents to a new file. After that, it unlocks the database. cp isn't able to do this.

  7. #7
    Join Date
    December 2004
    Location
    RF
    Posts
    3,006
    Quote Originally Posted by TheZero View Post
    but why...?
    Because "cp" doesn't know anything about your sever. And does not guarantee consistent backup, if the server is running at the same time.

  8. #8
    Join Date
    April 2013
    Location
    Germany
    Posts
    86
    Ok, Thanks guys

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Not Supported] Create a database backup while server is running
    By EndCrawler in forum Server Support
    Replies: 3
    Last Post: November 10th, 2018, 02:59 PM
  2. [Resolved] Question about server admin / server backup
    By Barrybe in forum General Questions
    Replies: 4
    Last Post: November 23rd, 2011, 06:52 PM
  3. [Question] - How to backup settings...
    By DanesDK in forum General Questions
    Replies: 1
    Last Post: July 7th, 2010, 10:22 AM
  4. License question on a backup server
    By HHD_HELLBOUND in forum General Questions
    Replies: 0
    Last Post: January 5th, 2010, 12:21 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •