The stock answer is
clonezilla - should be in the Ubuntu repos.
If you want to get funky you could use timeshift to take a snapshot and simply boot from the "before" image without having to physically restore. I might use both, and use timeshift on a day-to-day basis with the clonezilla image as a fallback when things break.