To create a full backup of your internal drive to your external HDD without touching the existing files, you can use the dd command to create a disk image of your internal drive and save it as a file on your external HDD.
-
Identify the device name of your internal drive (usually something like /dev/sda) and the mount point of your external HDD.
Open a terminal and run:
sudo fdisk -l
This will list all the disks and partitions. Look for your internal drive and note its device name (e.g., /dev/sda).
-
Ensure your external HDD is mounted.
If it's not automatically mounted, you can mount it manually. For example:
sudo mkdir -p /media/external
sudo mount /dev/sdb1 /media/external
Replace /dev/sdb1 with the appropriate partition of your external HDD.
-
Run the dd command to create the backup.
sudo dd if=/dev/sda of=/media/external/backup.img bs=4M status=progress
- Replace
/dev/sda with the device name of your internal drive.
- Replace
/media/external/backup.img with the path where you want to store the backup image on your external HDD.
This command will create a raw disk image (backup.img) of your internal drive and save it to your external HDD.
Explanation of the command:
sudo: Runs the command with administrative privileges.
dd: The command used to copy and convert files at a low level.
if=/dev/sda: Input file is your internal drive.
of=/media/external/backup.img: Output file is the disk image stored on your external HDD.
bs=4M: Sets the block size to 4 megabytes for faster copying.
status=progress: Displays the progress of the copy operation.
-
Optional: Compress the backup to save space.
If you want to save space on your external HDD, you can compress the disk image on the fly:
sudo dd if=/dev/sda bs=4M status=progress | gzip > /media/external/backup.img.gz
This command pipes the output of dd into gzip, creating a compressed backup file (backup.img.gz).
-
Verify the backup (optional but recommended).
After the backup is complete, you can verify it by comparing checksums:
sudo dd if=/dev/sda bs=4M | md5sum
And then compute the checksum of the backup image:
md5sum /media/external/backup.img
Compare the two checksums to ensure they match.