My laptop's hard drive will fail soon (according to SMART), so I decided to clone the entire drive to another one:
sudo sh -c 'cat /dev/sda >/dev/sdc'
With the new hard drive the laptop shows these errors:
Failed to start File System Check on /dev/.../78c...b86
Dependency failed for /home
Dependency failed for Load File System
...
Cannot open access to console, the root account is locked
The UUID look equal on both drives:
> lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ntfs XP D6A46388A46369C7
├─sda3
├─sda5 ext4 f02a6d59-8411-4018-85da-bb6a521d91d0 /
├─sda6 swap 70bc8fb3-77e5-47e8-953f-63da54226679 [SWAP]
└─sda7 ext4 78c3867d-4382-4dff-ac7d-ed69c788db86 /home
sdc
├─sdc1 ntfs XP D6A46388A46369C7
├─sdc3
├─sdc5 ext4 f02a6d59-8411-4018-85da-bb6a521d91d0
├─sdc6 swap 70bc8fb3-77e5-47e8-953f-63da54226679
└─sdc7 ext4 78c3867d-4382-4dff-ac7d-ed69c788db86
The drives are of different size and different physical sector size. However, I couldn't prove it is an issue in this case.
> sudo fdisk -l
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 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: 0xd961d961
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 63 43015687 43015625 20.5G 7 HPFS/NTFS/exFAT
/dev/sda3 43016190 215076863 172060674 82G 5 Extended
/dev/sda5 43016192 62545919 19529728 9.3G 83 Linux
/dev/sda6 62547968 68737023 6189056 3G 82 Linux swap / Solaris
/dev/sda7 68739072 215076863 146337792 69.8G 83 Linux
Disk /dev/sdc: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0xd961d961
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 63 43015687 43015625 20.5G 7 HPFS/NTFS/exFAT
/dev/sdc3 43016190 215076863 172060674 82G 5 Extended
/dev/sdc5 43016192 62545919 19529728 9.3G 83 Linux
/dev/sdc6 62547968 68737023 6189056 3G 82 Linux swap / Solaris
/dev/sdc7 68739072 215076863 146337792 69.8G 83 Linux
Partition 1 does not start on physical sector boundary.
Partition 3 does not start on physical sector boundary.
The files /etc/fstab are equal, too.
The laptop has a broken screen, and I use an external monitor. This imposes some restrictions for tools which can be used, e.g. Clonezilla' Live CD shows no output.
What can be done in this case?
Update 1: Tried to accomplish the task with dd bs=1M if=/dev/sda of=/dev/sdc. Got the same errors. Have to say that the Windows boots from its partition properly with either cat or dd approach.
Update 2: The all bad blocks on the source hard drive are located in the /home partition /dev/sda7. The first LBA number is 127221317. I found about 300 bad blocks with the last LBA number 146938319, then stopped. Seems there are many of them further.
cat? I've only every done this withddwhich works great but does require that the from and to are not mounted. – user1794469 Jan 19 '19 at 19:08catthe speed is optimized automatically; it took one hour for me (didn't try dd though). – Dmitry Jan 19 '19 at 19:16dd, takes 10 minutes less. – Dmitry Jan 19 '19 at 22:26etckeeper. It has became a challenge, cloning a hard drive in a most simple way. – Dmitry Jan 20 '19 at 14:14