0

I cloned a 250GB SSD to a 500GB one using this command:

sudo dd if=/dev/sda of=/dev/sdb bs=64K conv=noerror,sync status=progress

The cloning process seem to have gone well looking at the progress. It did start giving error after it started cloning unexisting space from the smaller disk to the larger one (Input/Output error after trying to copy data after 239 GB or so) but I suppose that is normal.

I performed this operation connecting both SSDs externally to a computer running Ubuntu 16.04. Afterwards, I put my original SSD drive back to my laptop, booted, and tried to visualize the content of the new cloned SSD which I connected via USB:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

This is what I expected (roughly):

sdb            460G            
├─sda4 ntfs     1000M            WinRE_DRV
├─sda2            16M            
├─sda5 ext4       28G /          
├─sda3 ntfs    139,6G            Windows
├─sda1 vfat      260M /boot/efi  SYSTEM
└─sda6 ext4     69,7G /home 
[sd7 with extra space?]

sda            238,5G            
├─sda4 ntfs     1000M            WinRE_DRV
├─sda2            16M            
├─sda5 ext4       28G /          
├─sda3 ntfs    139,6G            Windows
├─sda1 vfat      260M /boot/efi  SYSTEM
└─sda6 ext4     69,7G /home    

...But this is what I get:

sdb           1023,8M            
sda            238,5G            
├─sda4 ntfs     1000M            WinRE_DRV
├─sda2            16M            
├─sda5 ext4       28G /          
├─sda3 ntfs    139,6G            Windows
├─sda1 vfat      260M /boot/efi  SYSTEM
└─sda6 ext4     69,7G /home    

Above, sda is my main 250GB drive, and sdb is the new one. Before the cloning, sdb was associated to about 460G of space, and no partition.

Why is sdb displayed without any partition? And why is it associated to 1023,8M instead of ~500G?

Edit: after restarting, leaving the second SSD connected via USB, I get:

NAME   FSTYPE   SIZE MOUNTPOINT LABEL
sdb           465,8G            
├─sdb4         1000M            
├─sdb2           16M            
├─sdb5           28G            
├─sdb3        139,6G            
├─sdb1 vfat     260M            SYSTEM
└─sdb6         69,7G            
sda           238,5G            
├─sda4 ntfs    1000M            WinRE_DRV
├─sda2           16M            
├─sda5 ext4      28G /          
├─sda3 ntfs   139,6G            Windows
├─sda1 vfat     260M /boot/efi  SYSTEM
└─sda6 ext4    69,7G /home 

Which is way better, but still not exactly what I'd have liked to see. Why are the ntfs and ext4 file system types not visible? And why is the remaining ~220G not shown anywhere?

Edit #2: This is the output of sudo fdisk -l:

Disk /dev/sda: 238,5 GiB, 256060514304 bytes, 500118192 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: gpt
Disk identifier: 214236EA-A3F6-48D6-876E-E94A1F829226

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    534527    532480   260M EFI System
/dev/sda2     534528    567295     32768    16M Microsoft reserved
/dev/sda3     567296 293269503 292702208 139,6G Microsoft basic data
/dev/sda4  498069504 500117503   2048000  1000M Windows recovery environment
/dev/sda5  293269504 351862783  58593280    28G Linux filesystem
/dev/sda6  351862784 498069503 146206720  69,7G Linux filesystem

Partition table entries are not in disk order.


GPT PMBR size mismatch (500118191 != 976773166) will be corrected by w(rite).
Disk /dev/sdb: 465,8 GiB, 500107861504 bytes, 976773167 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: gpt
Disk identifier: 214236EA-A3F6-48D6-876E-E94A1F829226

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048    534527    532480   260M EFI System
/dev/sdb2     534528    567295     32768    16M Microsoft reserved
/dev/sdb3     567296 293269503 292702208 139,6G Microsoft basic data
/dev/sdb4  498069504 500117503   2048000  1000M Windows recovery environment
/dev/sdb5  293269504 351862783  58593280    28G Linux filesystem
/dev/sdb6  351862784 498069503 146206720  69,7G Linux filesystem

I notice two things that don't look right. First, the display of this warning/error in red: GPT PMBR size mismatch (500118191 != 976773166) will be corrected by w(rite).. Second, the two SSDs have the same Disk identifier number.

  • 2
    Did you make sure that your UUIDs are unique after cloning with tune2fs -U? – emk2203 Feb 9 '18 at 9:28
  • 1
    That looks fine, except the disk identifier which is the UUID is the same, as @emk2203 already told you. Please use tune2fs -U random /dev/sdbto remedy the problem. Regarding the GPT PMBR issue, look at this answer here – Robert Riedl Feb 9 '18 at 11:21
  • 1
    @RobertRiedl I tried to follow those instructions (gdisk /dev/sdb, x, e in order) but nothing changed. If I run sudo tune2fs -U random /dev/sdb I get the same output – raggot Feb 9 '18 at 13:35
  • 1
    You need to run tune2fs on the partition, not the disk. So it needs to be the partition(s) with the ext4 filesystem. You can use uuidgen to generate a UUID. sudo tune2fs -U $(uuidgen) /dev/sdb5 would be ideal. – emk2203 Feb 9 '18 at 14:01
  • 1
    It would also help to know the purpose of the cloning. If both disks are to stay in the system, you need to change UUIDs not only for the ext4 partitions, but also the partuuid via fdisk / gdisk and the pseudo-UUIDs of the vfat/ntfs partions via mtools or the like. This can break Windows, for example. All this is a lot of work. If you just want to switch to a larger disk, decommission the old one and leave the new one alone in the system is the best option. – emk2203 Feb 9 '18 at 14:04
0

It seems to me, that something is wrong, at least with the cloned copy. Maybe something was damaged when you booted from one of the drives while both [the original drive and the cloned copy] were connected.

  • Please check very carefully, that the original drive is still working correctly, when it is alone in the computer.

    If it is, I think it is best to clone again. Please boot from a third drive (e.g. a USB pendrive with a live Ubuntu system or a Clonezilla live drive). You can download a Clonezilla iso file and create a boot drive and clone with Clonezilla,

    clonezilla.org

    It is safer and faster than dd.

  • Shutdown the computer after the cloning operation.

  • Keep the original drive and the cloned copy away from each other. Never boot from one of them, while the other drive is connected.

  • Boot a live system and run gdisk to fix the backup partition table at the end of the cloned copy. Check afterwards that gdisk is happy with the drive, that is does not complain about the partition table. You may find the script gpt-fix convenient according to this link,

    help.ubuntu.com/community/Installation/UEFI-and-BIOS/stable-alternative#gpt-fix

  • Now you are ready to boot your computer from the cloned copy (the original drive should be removed). It should work exactly like the original system.

  • After this test you can edit the partition table to start using the still unallocated drive space (either by increasing the size of some existing partition(s) or by creating new partitions). Please be aware, that if you move the head end of the partition with /boot (the root partition or a separate boot partition), you must also repair/re-install grub.

|improve this answer|||||
  • I successfully managed to clone my drive with Clonezilla. I actually did it before reading your answer and came here to explain how I fixed the issue. I believe you are right and something went wrong with the cloning via dd. I can now normally boot from either of the 2 disks, in both Ubuntu and Windows 10. I haven't experienced any anomaly so far. Thanks for your time. I can't +1 your answer because I lack reputation – raggot Feb 11 '18 at 20:10
  • Congratulations and thanks for sharing your solution :-) – sudodus Feb 11 '18 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.