I just finished configuring a dedicated remote ubuntu server and want to create a backup with DD in order to be able to rebuild fast in case of hardware issues.
The system has 2 SSD drives with 500GB and a remote FTP server ready for backup. I created the following backups, but I am not sure if this was correctly done and would allow me to recover like intended. As it is a software raid, I assume it is enough to backup MBR and one SSD
Question: Is this backup procedure OK and sufficient to recover to the same server and what would be the savest way to rebuild from the backup files?
root@rescue ~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 465.8G 0 disk
|-sdb2 8:18 0 465.3G 0 part
| `-md1 9:1 0 465.1G 0 raid1
| |-vg0-swap 253:1 0 4G 0 lvm
| |-vg0-pro2 253:6 0 24G 0 lvm
| |-vg0-pro1 253:4 0 30G 0 lvm
| |-vg0-tmp 253:2 0 5G 0 lvm
| |-vg0-root 253:0 0 10G 0 lvm
| |-vg0-staging_pro1 253:7 0 30G 0 lvm
| |-vg0-restore 253:5 0 30G 0 lvm
| `-vg0-home 253:3 0 140G 0 lvm
`-sdb1 8:17 0 512M 0 part
`-md0 9:0 0 511.4M 0 raid1
loop0 7:0 0 2G 1 loop
sda 8:0 0 465.8G 0 disk
|-sda2 8:2 0 465.3G 0 part
| `-md1 9:1 0 465.1G 0 raid1
| |-vg0-swap 253:1 0 4G 0 lvm
| |-vg0-pro2 253:6 0 24G 0 lvm
| |-vg0-pro1 253:4 0 30G 0 lvm
| |-vg0-tmp 253:2 0 5G 0 lvm
| |-vg0-root 253:0 0 10G 0 lvm
| |-vg0-staging_pro1 253:7 0 30G 0 lvm
| |-vg0-restore 253:5 0 30G 0 lvm
| `-vg0-home 253:3 0 140G 0 lvm
`-sda1 8:1 0 512M 0 part
`-md0 9:0 0 511.4M 0 raid1
// MBR
dd if=/dev/sda bs=512 count=1 | gzip -fc | lftp userxx.your-backup.de -u uxx,pw -e "put /dev/stdin -o backup-MBR-$(date +%Y%m%d%H%M).gz; quit"
// SSDs
dd if=/dev/sda2 bs=2048 conv=noerror,sync | gzip -fc | lftp userxx.your-backup.de -u uxx,pw -e "put /dev/stdin -o backup-sda2-$(date +%Y%m%d%H%M).gz; quit"
// partition table
sfdisk /dev/sda –d | gzip -fc | lftp userxx.your-backup.de -u uxx,pw -e "put /dev/stdin -o backup-sda-part-table-$(date +%Y%m%d%H%M).gz; quit"
The backup files look OK:
ls -lh
-rw-r--r-- 1 486 Feb 10 12:51 backup-MBR-201702101351.gz
-rw-r--r-- 1 143 Feb 10 15:56 backup-sda-part-table-201702101656.gz
-rw-r--r-- 1 86.7M Feb 10 15:54 backup-sda1-201702101654.gz
-rw-r--r-- 1 182.3G Feb 10 15:42 backup-sda2-02-201702101440.gz