
Restic + Backblaze B2 ile Şifreli Sunucu Yedekleme Rehberi
Restic ile sunucu yedeklemesi yapın. Backblaze B2, S3, Azure ve diğer cloud providers ile uçtan uca şifreli, deduplicated, incremental backup.
Restic + Backblaze B2 ile Şifreli Sunucu Yedekleme Rehberi
Restic, uçtan uca şifrelenmiş, deduplicated ve incremental backup yapan, modern (Go ile yazılmış) açık kaynak bir backup aracıdır. Tek binary ile dağıtılır, çok platform destekli ve 30+ storage backend'e (S3-uyumlu nesne depolama, Backblaze B2, Wasabi, MinIO, REST server, SFTP, lokal disk) yazabilir.
Büyükweb Türkiye VDS ve dedicated sunucularda Restic + Backblaze B2 kombinasyonu maliyet-etkin ve güvenli bir disaster recovery stratejisidir. Bu rehberde sıfırdan kurulumu, şifreli backup rutinini, otomatik schedule, prune & rotation ve restore süreçlerini adım adım anlatıyoruz.
Restic Avantajları
| Özellik | Açıklama |
|---|---|
| Uçtan uca şifreleme | AES-256 client-side; cloud sağlayıcı bile veriyi göremez |
| Deduplication | Aynı block'lar tek seferlik depolanır — yer tasarruf |
| Incremental | İlk full backup; sonrası sadece değişiklik |
| Cross-platform | Linux, macOS, Windows, BSD |
| Tek binary | Dependency yok, kolay deploy |
| 30+ backend | S3, B2, Azure, GCS, SFTP, REST, vs. |
| Snapshot bazlı | Her backup ayrı "snapshot" — geçmişe erişim |
| Repository check | Bütünlük doğrulama yerleşik |
Backblaze B2 Neden?
| Sağlayıcı | $/TB/ay (2026) | Outbound Trafik |
|---|---|---|
| Backblaze B2 | $6 | $10/TB |
| S3-uyumlu nesne depolama | $23 | $90/TB |
| Wasabi | $7 | Ücretsiz (180 GB/ay sınır) |
Backblaze B2 fiyat-performans olarak disaster recovery için en uygun seçenek; S3 API uyumlu, restic ile tam destekli.
Adım 1: Restic Kurulum
Ubuntu / Debian
sudo apt update
sudo apt install restic
restic version
apt paketi bazen eski olur; en son sürüm için resmi binary:
# Latest release (örn 0.17.0)
wget https://github.com/restic/restic/releases/download/v0.17.0/restic_0.17.0_linux_amd64.bz2
bunzip2 restic_0.17.0_linux_amd64.bz2
sudo mv restic_0.17.0_linux_amd64 /usr/local/bin/restic
sudo chmod +x /usr/local/bin/restic
restic version
CentOS / Rocky / Alma
sudo dnf install restic
macOS
brew install restic
Adım 2: Backblaze B2 Hesabı Hazırlık
- https://www.backblaze.com/b2/cloud-storage.html adresine git → ücretsiz hesap (10 GB free)
- Buckets → Create Bucket:
- Bucket Name:
my-server-backups-2026(global unique) - Files in bucket are: Private
- Object Lock: Disable (veya enable — ransomware koruması)
- Default Encryption: SSE-B2
- Bucket Name:
- Application Keys → Add a New Application Key:
- Key Name:
restic-backup - Allow access to: bucket'inizi seç
- Type of access: Read and Write
- Key Name:
- Application Key ID ve Application Key'i kopyalayın (key 1 kez gösterilir)
Adım 3: Environment Variables
# ~/.restic-env
export B2_ACCOUNT_ID=YOUR_KEY_ID
export B2_ACCOUNT_KEY=YOUR_APP_KEY
export RESTIC_REPOSITORY=b2:my-server-backups-2026:restic
export RESTIC_PASSWORD_FILE=~/.restic-password
chmod 600 ~/.restic-env
Şifreleme Anahtarı
# Güçlü repository şifresi oluştur (kayıp = backup'a erişim yok!)
openssl rand -base64 64 > ~/.restic-password
chmod 400 ~/.restic-password
# YEDEK AL — bu dosya kaybolursa backup'lar erişilmez!
cp ~/.restic-password /backup/restic-password.bak
gpg --encrypt -r your@email.com /backup/restic-password.bak
Adım 4: Repository Init
source ~/.restic-env
restic init
Output:
created restic repository abc123 at b2:my-server-backups-2026:restic
Please note that knowledge of your password is required to access the repository.
Losing your password means that your data is irrecoverably lost.
Adım 5: İlk Backup
source ~/.restic-env
# /home/user dizinini yedekle
restic backup /home/user --tag user-home --tag full
# Birden fazla dizin
restic backup /etc /var/www /home/user --exclude-file=/root/.restic-exclude
Exclude Dosyası
# ~/.restic-exclude
*.tmp
*.log
**/cache/
**/logs/
node_modules/
.git/objects/
/proc
/sys
/dev
/tmp
/run
/mnt
/media
/var/cache
/var/log
İlk backup full (saatler sürebilir). Sonraki backup'lar incremental + deduplicated → çok hızlı.
Adım 6: Snapshot Yönetimi
# Tüm snapshot'ları listele
restic snapshots
# Sadece belirli tag'i
restic snapshots --tag full
# Snapshot detay
restic ls SNAPSHOT_ID
# Snapshot'tan dosya bul
restic find "wp-config.php"
# Snapshot'tan diff
restic diff PREV_ID CURR_ID
Adım 7: Restore
Tam Snapshot Restore
restic restore SNAPSHOT_ID --target /restore/
Belirli Dosya Restore
restic restore SNAPSHOT_ID --target /restore/ --include /home/user/important-file.txt
Snapshot Mount (FUSE)
mkdir /mnt/restic
restic mount /mnt/restic
# Snapshot'lar /mnt/restic/snapshots/ içinde
ls /mnt/restic/snapshots/
# Specific snapshot
ls /mnt/restic/snapshots/2026-05-07T03:00:00Z/
# Unmount
umount /mnt/restic
Adım 8: Otomatik Backup (Cron)
backup.sh
#!/bin/bash
# /usr/local/bin/restic-backup.sh
set -e
source ~/.restic-env
# Pre-backup: MySQL dump
mysqldump --all-databases --single-transaction --routines --triggers > /backup/mysql-dump.sql
# Pre-backup: PostgreSQL dump
sudo -u postgres pg_dumpall > /backup/postgres-dump.sql
# Restic backup
restic backup /etc /var/www /home /backup --tag daily --exclude-file=/root/.restic-exclude
# Prune (eski snapshot'ları temizle)
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --keep-yearly 2 --prune
# Health check
restic check --read-data-subset=1G
echo "Backup completed at $(date)"
sudo chmod +x /usr/local/bin/restic-backup.sh
Cron
sudo crontab -e
# Her gün 03:00
0 3 * * * /usr/local/bin/restic-backup.sh >> /var/log/restic-backup.log 2>&1
Systemd Timer (Modern Alternatif)
/etc/systemd/system/restic-backup.service:
[Unit]
Description=Restic Backup
After=network-online.target
[Service]
Type=oneshot
EnvironmentFile=/root/.restic-env
ExecStart=/usr/local/bin/restic-backup.sh
/etc/systemd/system/restic-backup.timer:
[Unit]
Description=Daily Restic Backup
[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true
[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now restic-backup.timer
sudo systemctl list-timers | grep restic
Adım 9: Retention Policy
# 7 günlük + 4 haftalık + 6 aylık + 2 yıllık
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --keep-yearly 2 --prune
| Politika | Tutulan |
|---|---|
| --keep-last 5 | Son 5 snapshot |
| --keep-hourly 24 | Son 24 saatten her saatten 1 |
| --keep-daily 7 | Son 7 günden her gün 1 |
| --keep-weekly 4 | Son 4 haftadan her hafta 1 |
| --keep-monthly 6 | Son 6 aydan her ay 1 |
| --keep-yearly 2 | Son 2 yıldan her yıl 1 |
--prune referansı kalmayan blok'ları storage'dan siler. Cost saving için önemli.
Adım 10: Repository Health
Hızlı Check
restic check
Tam Check (Aylık)
restic check --read-data
Tüm blok'ları indirir + checksum doğrular. Bandwidth tüketir ama disaster recovery güvenirliği için ayda bir.
Adım 11: Multi-Server Backup
Tek Repository, Birden Fazla Sunucu
Aynı bucket'a farklı sunucular yedekleyebilir. Her sunucuya farklı hostname + tag:
# Sunucu A
restic backup /home --hostname server-a --tag prod
# Sunucu B
restic backup /home --hostname server-b --tag prod
# Liste
restic snapshots --host server-a
Filtre + Restore
# Sadece server-a snapshots'ları
restic snapshots --host server-a
# Belirli sunucudan restore
restic restore latest --host server-a --target /restore/
Adım 12: Çoklu Repository
Production critical data ve test data'yı ayrı bucket'larda tutmak güvenli:
# Critical
export RESTIC_REPOSITORY=b2:critical-bucket:restic
restic backup /etc /home
# Bulky media (ayrı bucket)
export RESTIC_REPOSITORY=b2:media-bucket:restic
restic backup /var/www/media
Adım 13: Encryption Key Yönetimi
Restic her repository tek master key ile şifrelenir. Birden fazla erişim password'ü ekleyebilirsiniz:
# Şu anki password ile bağlan
restic key list
# Yeni password ekle (ek admin için)
restic key add
# Eski password'ü kaldır
restic key remove ID
Adım 14: Bandwidth Limit
# 5 MB/s yukarı, 10 MB/s aşağı
restic backup /home --limit-upload 5120 --limit-download 10240
Yoğun saat dışı yedekleme için cron job'da limit yok; gündüz manuel için limit kullan.
Adım 15: Monitoring + Alerting
Healthchecks.io
Cron job'da başarısız olursa Slack/email/SMS:
# backup.sh sonu
curl -fsS --retry 3 https://hc-ping.com/UUID-FROM-HEALTHCHECKS
# Hata durumunda:
trap 'curl -fsS --retry 3 https://hc-ping.com/UUID-FROM-HEALTHCHECKS/fail' ERR
Email Alert
# backup.sh
{
/usr/local/bin/restic-backup.sh
} 2>&1 | mail -s "Backup Result $(date)" admin@example.com
Adım 16: WordPress / cPanel için Strateji
WordPress
# /usr/local/bin/wp-backup.sh
#!/bin/bash
source ~/.restic-env
# DB dump
mysqldump --single-transaction wordpress > /backup/wp-db.sql
# Restic backup
restic backup /var/www/html /backup --tag wordpress --tag daily
restic forget --keep-daily 7 --keep-monthly 3 --prune
cPanel
cPanel kendi backup'ları + offsite restic kombinasyonu:
# /usr/local/bin/cpanel-offsite.sh
restic backup /backup/cpanel-backups /home --tag cpanel --tag daily
cPanel WHM panel'inden Backup Configuration ile günlük backup → restic offsite copy.
Adım 17: Disaster Recovery Test
Backup'ın işe yaramayacağı tek senaryo: hiç test etmemek.
Aylık Test
# Test makinasında / VM'de
mkdir /tmp/restore-test
restic restore latest --target /tmp/restore-test
diff -r /tmp/restore-test/etc /etc | head
Mock Database Restore
# DB dump'ı yeni MySQL'e import edip uygulama çalıştır
mysql -u root -p test_db < /tmp/restore-test/backup/mysql-dump.sql
mysql -u root -p test_db -e "SHOW TABLES;"
Yaygın Sorunlar
| Sorun | Çözüm |
|---|---|
| "unable to open repository" | RESTIC_PASSWORD doğru mu? Network var mı? |
| "backup verifies fail" | Disk corruption olabilir; check --read-data |
| B2 rate limit | --limit-upload ile düşür |
| Out of memory | İndex tut RAM'de — VDS RAM artır |
| Çok yavaş ilk backup | Bandwidth + concurrency --option b2.connections=20 |
| Hangi snapshot 1 hafta önceyi içerir? | restic snapshots + tarih |
| Restore yetersiz disk | --target başka mount'a |
Sıkça Sorulan Sorular
Backblaze B2 Türkiye'den ne kadar hızlı?
B2 EU/US lokasyonlarında DC'leri var; Türkiye'den 50-150 ms latency. 1 Gbps VDS bağlantısında 50-80 MB/s upload tipik.
S3 yerine neden B2?
Maliyet 4x daha az. Büyük bulut ekosistemine bağlı değilseniz B2 daha verimli.
Linux dışında çalışıyor mu?
Evet — Windows, macOS, FreeBSD. Aynı binary, aynı repository.
Şifre kaybedersem?
Veriler kalıcı olarak erişilemez. Mutlaka şifreyi 2-3 yere yedekleyin (KeePass + paper print + GPG-encrypted USB).
Restic ile dosya bazında geri yükleme yapabilir miyim?
Evet — restic mount ile snapshot'ları FUSE filesystem olarak browse, cp ile kopyala.
Backup süresi nasıl ölçülür?
time restic backup ... komutu süre verir. Tipik 50 GB site ilk backup: 30-60 dk. Sonraki incremental: 1-5 dk.
Birden fazla VDS'i aynı repo'ya yedekleyebilir miyim?
Evet — --hostname ile ayır. Deduplication tüm sunucularda ortak block'ları tek seferlik tutar = daha az depolama maliyeti.
İlgili Rehberler
- VDS Sunucu Yedekleme Stratejileri
- Veritabanı Yedekleme Stratejileri Full Incremental
- WordPress Otomatik Yedekleme UpdraftPlus
- Linux Disk Dosya Sistemi Yönetimi
- Türkiye VDS Sunucu
İlgili Büyükweb Hizmetleri
Sunucu yedekleme ve disaster recovery için Türkiye lokasyonlu Büyükweb hizmetleri:
- Türkiye VDS Sunucu
- Dedicated Sunucu
- Sunucu Barındırma (Colocation)
- cPanel Web Hosting
- Linux Reseller Hosting
Sorularınız için 0850 302 60 70 numaralı destek hattımıza veya iletişim sayfamıza yazabilirsiniz.
Sunucu Yönetimi İlgili Hizmetlerimiz
Bu yazıda anlatılan teknik konuyu profesyonel altyapıyla deneyimleyin
Etiketler:

