So recently my old SSD (containing /root + /home partitions for my system) broke (details in this question) and I went to get a new one. Now I wanted to clone it but ran into the following issues:
$ pv /dev/sdd > /dev/sda
4.24GiB 0:00:18 [ 234MiB/s] [==> ] 7% ETA 0:03:55
pv: /dev/sdd: read failed: Input/output error
$ dd if=/dev/sdd of=/dev/sda bs=1M status=progress
dd: error reading '/dev/sdd': Input/output error
4397+1 records in
4397+1 records out
4611493888 bytes (4.6 GB, 4.3 GiB) copied, 22.0249 s, 209 MB/s
The old SSD still kinda works. There are lots of system freezes due to it being damaged but I can unlock, mount and use it quite fine still. I can access all data (AFAIK) and a full backup using tar
worked well too.
The reasons I would greatly prefer a direct clone over file-by-file (or tar
) copying is:
- Convenience
- Speed
- Rather complex encryption on the disk, that I'd rather not re-setup again
This website suggests using conv=noerror
with dd
, but I'm unsure whether this is safe or not. I have the same concerns about dd_rescue
and clonezilla's -rescue
.
Question: How can I safely clone my old SSD onto the new one, and is a md5sum
check afterwards sufficient to make sure the clone was 100% successful?
The website I've linked above suggests using gparted to check if the clone was successful, but AFAIK gparted doesn't work with LUKS encrypted partitions. (To make things more complicated: The LUKS header is detached.)
Bonus question: My drive's decryption is done at boot, using grub and the partitions's ID (not UUID). Is it enough for me to update the ID in my crypttab and grub's config or do I need to do more?
Edit: I just realized that md5sum
will most likely fail to read the drive aswell. Is there any other way to safely tell if the clone was successful?
UPDATE: So I've tried clonezilla with the -rescue
option. It seemed to work and I can unlock the LUKS container to reveal the LVM but when I try to mount the root partition I get the following:
$ sudo mount /dev/mapper/vvg-root /mnt/sda
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vvg-root,
missing codepage or helper program, or other error
Relevant data from dmesg
:
[ 4686.401702] JBD2: no valid journal superblock found
[ 4686.401707] EXT4-fs (dm-3): error loading journal
So I guess that didn't work as planned. Has anyone a better idea, please?
UPDATE2: I ran a fsck.ext4 -yv
on the new drive's partition. I was flooded with errors. In the millions. Now I'm able to mount it, but pretty much all of my files are missing. The /home directory, among many others, is gone entirely. There should be around 30-35GB of data on it. Now it's 53MB.
Is my only option really to rollback the tar
backup I have? I'm thinking maybe a one-on-one rsync copy is better, since that would report if a specific file is damaged/unreadable, right? I used --verify
when I made the tar
archive though and it didn't report any errors.
-rescue
option in the "Expert" mode.dd_rescue
, by simply ignoring/skipping IO errors? That scares me off a bit, I'd greatly appreciate an elaboration on how this works and how safe it is to use.dd_rescue
doing it. I would try first to make an image with clonezilla to be make sure that at least existing data saved then try to "cure" ssd with low level tool such as mhdd or victoria in attempt to force internal ssd controller to replace broken sectors. Low level tool work good on mechanical drives but rarely helpful on ssd drives.dd_rescue
and then look into those tools.dd_rescue
, it trying very hard to read broken part of the disk that may trigger even more damage to SSD (when internal firmware trying to replace broken sectors with healthy ones but there no left spare cells).