I have a hard drive in my laptop with a windows and an ubuntu partition. I got an SSD to replace my hard drive, but it has a slightly lower capacity. I've already partitioned the SSD to the sizes I want, and each partition on the new disk is larger than the amount of used space on my old hard drive.
I was going to use dd
, but it appears that it requires partitions to be the same size.
How can I copy my old partitions onto my new ssd? I'm copying my boot partition too, so how can I make sure the new disk is bootable, and the new partitions are exactly the same as the old ones (but with less free space)?
Don't bother to partition SSD disk.
I would suggest to shrink the partitions on the old disk first to fit the size of the SSD, then dd old disk to new one
But make a backup first.
You can definitely use dd, as long as the data on the larger drive is notably smaller than the SSD and that no data exists in the area that is beyond the SSD's storage limits.
Just do a straight up dd sector by sector from the source drive to the SSD until the SSD is "full" and then use parted to fix up the incorrect partition table that says the SSD has larger geometry than it really does by "deleting" and "recreating" the truncated partition with the correct geometry (this doesn't delete data in that partition, it simply changes the start and end of that partition).
Alternatively, as already mentioned, use a tool like GParted to shrink down the partition to less than the size of the SSD, clone it over using either dd (it will have correct geometry and no risk of data loss this time) or Clonezilla (faster than dd because it only clones the occupied areas of the drive rather than everything - you still need to resize the partition down beforehand), and then resize the partition on the SSD up again afterwards to fill any empty space below the total capacity.
Disclaimer: I am the author of the WereSync software
WereSync can do this with one command. Install the program with:
And then run it:
This will copy the data from /dev/sda to /dev/sdb. The
-C
flag makes weresync copy the partitions to the target drive, then resize them so they fit.--grub-partition
is the number of the partition you want weresync to install grub on, and--efi-partition
is the partition number you want to be mounted and passed to grub-installs--efi-directory
flag. Generally--grub-partition
should be your root drive, so if /dev/sda2 is mounted on /, pass a 2 to--grub-partition
. If you have your boot folder on a seperate partition, you will need to pass that number to the--boot-partition
flag. For more detailed information, see the WereSync Documentation.Note: As of yet, WereSync only supports GPT drives as the source drive. Support for MBR drives is being actively developed.
Use lsblk to get your device ID and do (running it without arguments)
This is to get the exact size of the disks and make dd from there.
Before dd you might need to use Gparted to resize it to fit. Go to the device picker on the top right of Gparted, right click on the partition to be resized and hit the Apply button (and make a Home run) but watch for your finger. And you'll be ready to "dd" the disk.