How you would set up an automated nightly backup for the whole disk (boot and data partition) running Ubuntu Server?
I have a 1TB drive (current usage 200GB) and I want to have daily clone of this drive on another drive (the same capacity and model), on the same machine.
I was previously running dd
to have partition backup. But now I'm looking for some bulletproof solution to have a HDD clone to switch to in case of crash.
RAID is not an option, as when something is broken/deleted on the first drive, this happens on the other drive too (I know I should have RAID + the backup solution).
Copying the whole 1TB would take some time, so I'm looking for a tool which is able to find the daily differences and just update them.
The other problem is that that I need the clone of the whole disk (both partitions - ext2 and lvm + the boot record).
How would you set up this?
First of all, a backup isn't a backup if it's in the same machine that you're backing up. You should be backing up to another server or external media (tape, disk, whatever) and keeping it offsite.
Right now you have two problems:
You're not using RAID. You're correct that RAID isn't a backup. RAID is for availability during hardware (disk) failures. If this server is for anything client-facing or an important internal process, you should be using RAID. There's no excuse not to, disks are cheap.
You aren't doing backups. What you want is to be able to do a BMR (Bare Metal Restore) in the event of a crash, but you also don't want to be pushing 200+ GB over the wire each night. This is reasonable, and is why every backup solution on the planet does incremental and differential backups. In many cases, you take a full BMR backup over the weekend, and do daily or twice-daily incremental or differential backups throughout the week. If you have a failure, you restore the BMR backup first, then the latest differential.
There are, literally, hundreds of products that do what you're looking for. NetBackup, Backup Exec, FalconStor, Networker, Avamar, etc. Call a vendor that you trust, explain your requirements, and ask what they recommend that's in your price range or scour the web for an open-source solution that is compatible with your distro and meets your requirements.
tl;dr - Don't backup to another internal disk. Buy a product that suits your needs. Use RAID, but not as a replacement for backups.
BackupNinja, a frontend to rdiff-backup can do that quite easily. Its in the ubuntu repos.
That said you really should plan for having offsite backups as well. BackupNinja can copy your backups to an ftp server or more efficiently to another server with rdiff-backup installed.
You should really consider backing up to an external storage outside of the server - or better, outside the building and additionally put in some RAID hardware.
There are plenty of tools available, there's hundrets of tools, FOSS and proprietary.
If you don't have the money or want to save the dollars you would spend on, you can use tools like rsync or rdiff. There are plenty of tutorials on how to use them and what you can do with them. You can do rotating incremental backups, backups on filesystems that support snapshots(like zfs or btrfs), just whatever fits you best.
If you want some cheap failover inside the server without hardware raid, you could also use zfs oder software RAID mirroring, but in the end this is no real replacement for a good hardware RAID controller with a BBU and a large, fast cache.