User Tools

Site Tools


linux_faq:ubuntu_backup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
linux_faq:ubuntu_backup [2019/02/11 09:13]
127.0.0.1 external edit
linux_faq:ubuntu_backup [2019/08/07 08:36] (current)
admin
Line 5: Line 5:
   sudo apt-get install pigz   sudo apt-get install pigz
   sudo tar -cvpf - --use-compress-program=pigz --exclude=/​mnt --exclude=/​sys --exclude=/​run --exclude=/​dev --exclude=/​proc --exclude=/​media --exclude=/​tmp --exclude=/​var/​log/​lastlog --exclude=/​home/​local/​RIMOS_NT_01/​usikmi/​Desktop --exclude=/​var/​lib/​libvirt / | openssl enc -aes-192-cbc -pass pass:​1q2w3e4R1 -out /​mnt/​hdd/​backup_$(date +"​%d.%m.%y_%H-%M"​).tar.gz.enc   sudo tar -cvpf - --use-compress-program=pigz --exclude=/​mnt --exclude=/​sys --exclude=/​run --exclude=/​dev --exclude=/​proc --exclude=/​media --exclude=/​tmp --exclude=/​var/​log/​lastlog --exclude=/​home/​local/​RIMOS_NT_01/​usikmi/​Desktop --exclude=/​var/​lib/​libvirt / | openssl enc -aes-192-cbc -pass pass:​1q2w3e4R1 -out /​mnt/​hdd/​backup_$(date +"​%d.%m.%y_%H-%M"​).tar.gz.enc
 +====== Backup по расписанию ======
 +===== /​etc/​cron.daily/​backup =====
 +Скрипт бекапит систему в заданную папку и следит за количеством файлов бекапа.
 +<​code>#​!/​bin/​bash
 +backup_depth_days=14
 +backup_path='/​mnt/​hdd'​
 +backup_prefix='​backup_'​
 +
 +backup_files=`ls $backup_path/​$backup_prefix* -t`
 +backup_files=(${backup_files//​ / })
 +
 +if [[ ${#​backup_files[@]} -gt $backup_depth_days ]]; then
 +        for ((i = $backup_depth_days;​ i < ${#​backup_files[@]};​ i++))
 +        {
 +            sudo rm -r -f ${backup_files[$i]}
 +        }
 +fi
 +
 +sudo tar -cvpf $backup_path/​$backup_prefix$(date +"​%d.%m.%y_%H-%M"​).tar.gz --use-compress-program=pigz --exclude=/​mnt --exclude=/​sys --exclude=/​run --exclude=/​dev --exclude=/​proc --exclude=/​media --exclude=/​tmp --exclude=/​var/​log/​lastlog --exclude=/​home/​RDLEAS/​usik.ma/​Downloads /
 +</​code>​
 +
 ====== Restore ====== ====== Restore ======
 Загружаемся с Live-CD. Загружаемся с Live-CD.
linux_faq/ubuntu_backup.txt · Last modified: 2019/08/07 08:36 by admin