If you ever find yourself wanting to backup / image the entire drive because you're going to play around with or install questionable software , or if you are trying to dual boot Microsoft Windows and Linux etc. or anything else that jeopardizes your precious data then it would be wise to make an image of your drive. Boot from a Linux bootable USB and then use the
dd command from terminal to make a copy of your drive.
# Backup dd if=/dev/sda of=mydrive.img bs=512 count=1
/dev/sda is your disk. You can find your
boot drive/partition by running
df -h. If you have an NVMe drive like the newer systems then you'd see something like
/dev/nvme0n1. The command above will save your drive to a file called
mydrive.img in your current working directory.
To restore, again boot from a bootable Linux usb and run the following. It assumes that mydrive.img exists in your current directory.
# Restore dd if=mydrive.img of=/dev/sda
Pro Tip: mount another external USB drive or mount a network drive to save the mydrive.img because chances are that your Linux bootable drive is probably not big enough to store image of your entire disk.