Skip to main content

Overview

Regular backups are essential for protecting your TeamSpeak 6 Server data, including server configuration, user permissions, channels, and file uploads. This guide covers backup strategies for both Docker and binary installations.

What to Backup

Your TeamSpeak 6 Server backup should include:
ComponentDescriptionCritical
DatabaseServer configuration, users, channels, permissionsYes
FilesUploaded files, avatars, iconsYes
Licenselicensekey.dat fileYes
Configurationtsserver.yaml or docker-compose.yamlRecommended
LogsServer logs for troubleshootingOptional
SSL CertificatesHTTPS query certificatesIf applicable
SSH KeysSSH query host keysIf applicable
Always stop the server before creating backups to ensure data consistency, or use database-specific backup tools that support hot backups.

Docker Backup Strategies

Volume Backup

For Docker installations, back up the entire data volume:
1

Stop the server

docker compose stop teamspeak-server
# Or if using docker run
docker stop teamspeak-server
2

Create backup

# Backup named volume to tar archive
docker run --rm \
  -v teamspeak-data:/data \
  -v $(pwd):/backup \
  alpine tar czf /backup/teamspeak-backup-$(date +%Y%m%d-%H%M%S).tar.gz -C /data .
This creates a compressed backup of the entire volume.
3

Restart the server

docker compose start teamspeak-server
# Or if using docker run
docker start teamspeak-server
4

Verify backup

# List backup contents
tar tzf teamspeak-backup-YYYYMMDD-HHMMSS.tar.gz | head -20

# Check backup size
ls -lh teamspeak-backup-*.tar.gz

Automated Docker Backup Script

Create a backup script for automated backups:
backup-teamspeak.sh
#!/bin/bash

set -e

# Configuration
BACKUP_DIR="/backups/teamspeak"
CONTAINER_NAME="teamspeak-server"
VOLUME_NAME="teamspeak-data"
RETENTION_DAYS=30
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
BACKUP_FILE="${BACKUP_DIR}/teamspeak-backup-${TIMESTAMP}.tar.gz"

# Create backup directory
mkdir -p "${BACKUP_DIR}"

echo "[$(date)] Starting TeamSpeak backup..."

# Stop container
echo "[$(date)] Stopping container..."
docker stop "${CONTAINER_NAME}"

# Create backup
echo "[$(date)] Creating backup..."
docker run --rm \
  -v "${VOLUME_NAME}":/data \
  -v "${BACKUP_DIR}":/backup \
  alpine tar czf "/backup/teamspeak-backup-${TIMESTAMP}.tar.gz" -C /data .

# Restart container
echo "[$(date)] Restarting container..."
docker start "${CONTAINER_NAME}"

# Remove old backups
echo "[$(date)] Cleaning up old backups..."
find "${BACKUP_DIR}" -name "teamspeak-backup-*.tar.gz" -mtime +${RETENTION_DAYS} -delete

echo "[$(date)] Backup completed: ${BACKUP_FILE}"
ls -lh "${BACKUP_FILE}"
Make the script executable and schedule it:
chmod +x backup-teamspeak.sh

# Add to crontab for daily backups at 3 AM
crontab -e
0 3 * * * /path/to/backup-teamspeak.sh >> /var/log/teamspeak-backup.log 2>&1
Test your backup script manually before relying on automated execution.

Bind Mount Backup

If using bind mounts instead of volumes:
docker-compose.yaml
services:
  teamspeak:
    volumes:
      - ./teamspeak-data:/var/tsserver
Backup is simplified:
# Stop server
docker compose stop

# Create backup
tar czf teamspeak-backup-$(date +%Y%m%d).tar.gz teamspeak-data/

# Restart server
docker compose start

Binary Installation Backup

Full Backup

1

Stop the server

# If using systemd
sudo systemctl stop teamspeak

# Or if running directly
pkill tsserver
2

Create backup

# Backup entire server directory
tar czf teamspeak-backup-$(date +%Y%m%d).tar.gz \
  /opt/teamspeak/ \
  --exclude='/opt/teamspeak/logs' \
  --exclude='/opt/teamspeak/crashdumps'

# Or copy to backup location
rsync -av --exclude='logs' --exclude='crashdumps' \
  /opt/teamspeak/ \
  /backups/teamspeak-$(date +%Y%m%d)/
3

Restart the server

sudo systemctl start teamspeak
# Or
cd /opt/teamspeak && ./tsserver --accept-license

Database-Specific Backups

SQLite Backup

For SQLite databases, use the SQLite backup command:
# Online backup (server can keep running)
sqlite3 /var/tsserver/ts6server.sqlite ".backup /backups/ts6server-$(date +%Y%m%d).sqlite"

# Verify backup integrity
sqlite3 /backups/ts6server-$(date +%Y%m%d).sqlite "PRAGMA integrity_check;"
SQLite’s .backup command creates a consistent backup even while the server is running, but stopping the server is still recommended for critical backups.

MariaDB Backup

For MariaDB databases, use mysqldump:
1

Create database backup

# Full database backup
mysqldump -h localhost -u teamspeak -p teamspeak \
  --single-transaction \
  --routines \
  --triggers \
  --events \
  > teamspeak-db-$(date +%Y%m%d).sql

# Compress the backup
gzip teamspeak-db-$(date +%Y%m%d).sql
2

Backup with credentials file

Create a credentials file for automated backups:
~/.my.cnf
[client]
user=teamspeak
password=your_password
host=localhost
chmod 600 ~/.my.cnf

# Backup without password prompt
mysqldump teamspeak \
  --single-transaction \
  --routines \
  --triggers \
  > teamspeak-db-$(date +%Y%m%d).sql
3

Automated MariaDB backup script

backup-mariadb.sh
#!/bin/bash

BACKUP_DIR="/backups/teamspeak-db"
DB_NAME="teamspeak"
RETENTION_DAYS=30

mkdir -p "${BACKUP_DIR}"

mysqldump "${DB_NAME}" \
  --single-transaction \
  --routines \
  --triggers \
  | gzip > "${BACKUP_DIR}/teamspeak-db-$(date +%Y%m%d-%H%M%S).sql.gz"

find "${BACKUP_DIR}" -name "*.sql.gz" -mtime +${RETENTION_DAYS} -delete
Always use --single-transaction for InnoDB tables to ensure consistent backups without locking tables.

Docker MariaDB Backup

For MariaDB running in Docker:
# Backup from Docker container
docker exec teamspeak-mariadb mysqldump \
  -u teamspeak -p teamspeak \
  --single-transaction \
  --routines \
  > teamspeak-db-$(date +%Y%m%d).sql

# Or access via docker compose
docker compose exec mariadb mysqldump \
  -u teamspeak -p teamspeak \
  --single-transaction \
  > teamspeak-db-$(date +%Y%m%d).sql

Restore Procedures

Restore Docker Volume

1

Stop the container

docker compose stop teamspeak-server
2

Restore from backup

# Extract backup to volume
docker run --rm \
  -v teamspeak-data:/data \
  -v $(pwd):/backup \
  alpine sh -c "rm -rf /data/* && tar xzf /backup/teamspeak-backup-YYYYMMDD-HHMMSS.tar.gz -C /data"
This command deletes all existing data in the volume before restoring. Ensure you have the correct backup file.
3

Restart the container

docker compose start teamspeak-server

# Verify server starts correctly
docker logs -f teamspeak-server

Restore Binary Installation

1

Stop the server

sudo systemctl stop teamspeak
2

Backup current installation

# Safety backup of current state
mv /opt/teamspeak /opt/teamspeak-old-$(date +%Y%m%d)
3

Restore from backup

# Extract backup
tar xzf teamspeak-backup-YYYYMMDD.tar.gz -C /opt/

# Or restore from rsync backup
rsync -av /backups/teamspeak-YYYYMMDD/ /opt/teamspeak/
4

Set permissions

chown -R tsserver:tsserver /opt/teamspeak
chmod +x /opt/teamspeak/tsserver
5

Restart the server

sudo systemctl start teamspeak

# Check status
sudo systemctl status teamspeak

Restore SQLite Database

# Stop server
sudo systemctl stop teamspeak

# Restore database file
cp /backups/ts6server-YYYYMMDD.sqlite /var/tsserver/ts6server.sqlite

# Verify integrity
sqlite3 /var/tsserver/ts6server.sqlite "PRAGMA integrity_check;"

# Set permissions
chown tsserver:tsserver /var/tsserver/ts6server.sqlite

# Restart server
sudo systemctl start teamspeak

Restore MariaDB Database

1

Stop the TeamSpeak server

# Stop to prevent writes during restore
sudo systemctl stop teamspeak
2

Drop and recreate database

mysql -u root -p

DROP DATABASE teamspeak;
CREATE DATABASE teamspeak CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON teamspeak.* TO 'teamspeak'@'%';
FLUSH PRIVILEGES;
EXIT;
3

Restore from backup

# Restore from uncompressed backup
mysql -u root -p teamspeak < teamspeak-db-YYYYMMDD.sql

# Or from compressed backup
gunzip < teamspeak-db-YYYYMMDD.sql.gz | mysql -u root -p teamspeak
4

Restart TeamSpeak server

sudo systemctl start teamspeak

# Verify connection
tail -f /var/tsserver/logs/ts6server_*.log

Disaster Recovery

Complete System Recovery

1

Prepare new server

  • Install the same OS as the original server
  • Install Docker or TeamSpeak binary
  • Install any required dependencies
2

Restore configuration

# Copy docker-compose.yaml or tsserver.yaml
# Restore license key
cp licensekey.dat /opt/teamspeak/
3

Restore data

Follow the appropriate restore procedure for your installation type:
4

Verify and test

  • Start the server
  • Check logs for errors
  • Connect with TeamSpeak client
  • Verify channels, permissions, and files

Migration to New Server

Use backups to migrate to a new server:
1

Create backup on old server

Follow standard backup procedures for your installation type.
2

Set up new server

Install TeamSpeak 6 Server on the new system with the same configuration.
3

Transfer backup files

# Copy via SCP
scp teamspeak-backup-*.tar.gz user@newserver:/backups/

# Or use rsync
rsync -avz /backups/ user@newserver:/backups/
4

Restore on new server

Follow the restore procedures on the new server.
5

Update DNS and firewall

  • Update DNS records to point to new server IP
  • Configure firewall rules on new server
  • Test connectivity
Run both servers in parallel during migration to minimize downtime. Switch DNS once you’ve verified the new server.

Backup Best Practices

1

Regular schedule

  • Daily backups for production servers
  • Weekly backups for development servers
  • Before any major changes or updates
2

Multiple locations

Store backups in at least two locations:
  • Local storage for quick recovery
  • Remote storage for disaster recovery
  • Cloud storage (S3, Google Cloud, Azure)
3

Test restores regularly

# Quarterly restore testing
# 1. Restore to test environment
# 2. Verify data integrity
# 3. Test server functionality
# 4. Document any issues
4

Retention policy

  • Keep daily backups for 7 days
  • Keep weekly backups for 4 weeks
  • Keep monthly backups for 12 months
  • Keep yearly backups indefinitely (if required)
5

Security

# Encrypt backups
gpg --encrypt --recipient [email protected] \
  teamspeak-backup-YYYYMMDD.tar.gz

# Set restrictive permissions
chmod 600 teamspeak-backup-*.tar.gz

Cloud Backup Solutions

AWS S3 Backup

# Install AWS CLI
apt-get install awscli

# Configure credentials
aws configure

# Upload backup to S3
aws s3 cp teamspeak-backup-$(date +%Y%m%d).tar.gz \
  s3://my-backups/teamspeak/ \
  --storage-class STANDARD_IA

# Automated backup script with S3
#!/bin/bash
BACKUP_FILE="teamspeak-backup-$(date +%Y%m%d).tar.gz"
# ... create backup ...
aws s3 cp "${BACKUP_FILE}" s3://my-backups/teamspeak/
rm "${BACKUP_FILE}"  # Remove local copy after upload

Backup to Remote Server

# Backup via SSH
tar czf - /var/tsserver | ssh user@backup-server "cat > /backups/teamspeak-$(date +%Y%m%d).tar.gz"

# Automated backup with rsync
rsync -avz --delete \
  /var/tsserver/ \
  user@backup-server:/backups/teamspeak/
Consider using automated backup solutions like Duplicity, Borg, or Restic for advanced features like encryption, compression, and incremental backups.

Troubleshooting

Backup Issues

IssueCauseSolution
Backup file too largeIncluding logs and crash dumpsExclude unnecessary directories
Permission deniedInsufficient access rightsRun as root or use appropriate user
Database lockedSQLite database in useStop server before backup
Incomplete backupDisk space fullCheck available space before backup

Restore Issues

IssueCauseSolution
Server won’t startCorrupted backupVerify backup integrity, try older backup
Permission errorsWrong file ownershipSet correct permissions with chown
Database errorsIncompatible versionRestore matching server version
Missing filesIncomplete backupRestore from complete backup
For additional assistance, see the Logging page for troubleshooting guidance.

Build docs developers (and LLMs) love