I need to create backups of a Ubuntu system in a way that I can easily restore the data and system as it is exactly in a ready to go state. So, I decided to go with dd
to create a whole HHD images.
I created the image as follows:
dd if=/dev/current_drive of=/dev/backup_drive/backup.img conv=sync status=progress
The image was done without errors. After that I decided to restore the image to a test new drive:
dd if=/backup_drive/backup.img of=/dev/new_drive conv=sync status=progress
So far, so good. The image restore went without errors.
But when I tried to boot from the new hard which got the image restored on, I encountered initramfs
errors:
So after manual fsck
the errors were cleaned and I was able to boot from the new HDD. But I tried couple of times the procedure of restoring the image to the drive and each time I got problems with booting.
My original system drive and the new one are absolutely identical according to
sudo fdisk -l
:
/dev/sda/
is the new hard drive.
/dev/sdb/
is the original one from which the image was created.
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf11c2eb5
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 455024639 455022592 217G 83 Linux
/dev/sda2 455026686 488396799 33370114 15.9G 5 Extended
/dev/sda5 455026688 488396799 33370112 15.9G 82 Linux swap / Solaris
Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf11c2eb5
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 455024639 455022592 217G 83 Linux
/dev/sdb2 455026686 488396799 33370114 15.9G 5 Extended
/dev/sdb5 455026688 488396799 33370112 15.9G 82 Linux swap / Solaris
So, any ideas what I am doing wrong and why I get boot errors after image restore? I don't want in a real situation to have to fix the eventual new hard drive in case of failure of the original one.
Btw, the original drive is SSD, while the new one is HDD if this matters.