Backup de Arquivos
Este guia mostra como configurar backup de arquivos e diretórios.
Backup Rápido
Para backup pontual sem configuração:
backupally quick /var/www/html -d /backups/ -zCom upload para S3:
backupally quick /var/www/html -d s3://bucket/backups/ -t s3 \
--access-key AKIAIO... \
--secret-key wJalrX... \
--bucket my-bucket \
-zCriar Task de Backup
Website
Crie /etc/backupally/tasks.d/website.toml:
[task]
id = "website"
name = "Website Files"
enabled = true
schedule = "0 4 * * *"
[target]
kind = "fileset"
includes = ["/var/www/html"]
excludes = [
"**/.git",
"**/node_modules",
"**/*.log",
"**/cache/*",
"**/tmp/*"
]
[packer]
compressor = "zstd"
compression_level = 6
[[storage]]
id = "local"
driver = "local"
path = "/backup/website"
retention = "daily 7, weekly 4"Configurações do Sistema
[task]
id = "system-config"
name = "System Configuration"
enabled = true
schedule = "0 5 * * *"
[target]
kind = "fileset"
includes = [
"/etc/nginx",
"/etc/systemd",
"/etc/cron.d",
"/etc/backupally"
]
[packer]
compressor = "zstd"
[[storage]]
driver = "s3"
bucket = "system-backups"
path = "config/${hostname}/${date}"
retention = "daily 30, monthly 12"Home de Usuário
[task]
id = "home-backup"
name = "User Home Directory"
enabled = true
schedule = "0 2 * * *"
[target]
kind = "fileset"
includes = ["/home/usuario"]
excludes = [
"**/.cache",
"**/Downloads",
"**/Trash",
"**/.local/share/Trash"
]
[[storage]]
driver = "b2"
bucket = "personal-backups"
retention = "daily 7, weekly 4, monthly 6"Padrões de Exclusão
Sintaxe Glob
| Padrão | Significado |
|---|---|
* |
Qualquer sequência exceto / |
** |
Qualquer sequência incluindo / |
? |
Qualquer caractere único |
[abc] |
Qualquer caractere do conjunto |
Exemplos Comuns
excludes = [
# Controle de versão
"**/.git",
"**/.svn",
"**/.hg",
# Node.js
"**/node_modules",
"**/package-lock.json",
# Python
"**/__pycache__",
"**/*.pyc",
"**/venv",
"**/.venv",
# Build
"**/dist",
"**/build",
"**/target",
# Logs e temporários
"**/*.log",
"**/logs",
"**/tmp",
"**/temp",
"**/cache",
# IDE
"**/.idea",
"**/.vscode",
# Sistema
"**/Thumbs.db",
"**/.DS_Store"
]Opções Avançadas
Seguir Symlinks
[target]
kind = "fileset"
includes = ["/data"]
follow_symlinks = trueNão Cruzar Filesystems
[target]
kind = "fileset"
includes = ["/"]
one_filesystem = true
excludes = ["/proc", "/sys", "/dev", "/run", "/tmp"]Validar e Executar
backupally task validate website
backupally backup --target websiteRestaurar Backup
Listar Snapshots
backupally history --target websiteRestaurar
backupally restore \
--target website \
--snapshot snap_20260211_040000 \
--path /restore/websiteRestaurar para Local Original
backupally restore \
--target website \
--snapshot snap_20260211_040000 \
--path /var/www/htmlBackup Incremental
Para economizar espaço e tempo:
[collector]
incremental = trueApenas arquivos modificados desde o último backup são incluídos.
Condições de Execução
Verificar Carga do Sistema
[condition]
when = "loadavg() < 2.0"Verificar Espaço em Disco
[condition]
when = "diskfree('/backup') > 50GB"Janela de Execução
[window]
start = "00:00"
end = "06:00"Monitoramento
[notification]
enabled = true
[notification.webhook]
url = "https://hooks.slack.com/services/xxx"Troubleshooting
Permissão Negada
Execute como root ou ajuste permissões:
sudo backupally backup --target websiteArquivos Muito Grandes
Aumente o timeout:
[network]
timeout_seconds = 1800Muitos Arquivos Pequenos
Use pack maior:
[packer]
pack_size_mb = 200
By Borlot.com.br on 11/02/2026