Dont use DD or Clonezilla to clone a larger drive to a smaller one, to some this might be common sense, to me it was a valuable lesson, sort of like pissing on an electric fence, wont ever do that again.
I decided to make this tutorial for the reason that i just came across this issue a few days ago and finding the right help on it proved difficult. i had a sandisk z400 m.2 256gb and i wanted to add a samsung evo 860 that was 250gb and i wanted to clone my old drive so that my manjaro setup would run off the new drive, not have to re-install and i could then use my old drive for storage. but as we all know you cant fit 10 pounds of sh*t in a 5 pound bag, yet i was advised to use DD to clone the whole drive all at once, didnt work and caused drive errors, could not boot. tried the same with clonezilla, nope. tried using DD to clone each partition 1 at a time, wouldnt boot.
Cloning a drive to a new drive that is smaller than the original drive can get tricky as i learned the hard way that you cannot use DD or Clonezilla or any cloning software as far as i know because they will copy block for block (and in some cases also clone the UUID which you dont want if both drives are staying installed in the same machine) and since the new drive is smaller it will not fit regardless of how much data is on it or the size of the partitions.
in the end what i did was use Timeshift to create a backup of the old drive and then restore that backup to the new drive after partitioning it to match . my laptop has both a m.2 and a sata slot so i was able to use both at the same , this should work just as well if your using an external drive or a sata adapter to clone to the new drive before installing it. here are the steps i took:
you wont need a live usb, just your original drive, and your new drive accessible , Gparted and Timeshift.
if you dont already have timeshift/gparted installed:
sudo pacman -S timeshift gparted
open the timeshift gui and go to settings
-for sake of doing what i know works, i chose the rsync option.
-then for location to save backup, chose your original drive.
-for schedule you can select as you see fit (for the purpose of just making one backup and restoring it, you can uncheck all the boxes)
-for users listed you want to include all so all of your personal files will get backed up also.
-for filters you want to make sure nothing is excluded, (unless you have a preference as to what you dont want transferred onto the new drive).
create your backup
-click the “Create” button and Timeshift will begin making your backup.
-the amount of time it takes depends on the amount of data stored on it (be patient)
-your original drive now has a backup of itself stored on it.
Format/Partition your new drive so that it matches the table of your old drive (does not need to be exact , each partition just needs to be formatted properly) . i will use the setup i had as an example and use Gparted to accomplish this.
-open Gparted and select your new drive from the drop down menu.
-then click on the “Device” drop down on the menu bar and select “Create a new partition table”
-a warning will come up stating this action with wipe the drive, on this warning there is a drop-down menu to select what kind of partiton table to create, i chose “gpt” and hit ok.
-you should now see your drive table as “unallocated”
-now we need to create the partitions so they have the right format and enough space in each, matching your original drive partition within reason.
-click the “Create new partition in the selected unallocated space”
- my original drive partitions consisted of , in this order:
-so i first created a FAT32(300MiB) on the new drive partiton table.
you can use the slider or just type in 300 and make sure its MiB not GiB and select FAT32 from the “File system” drop down, then click “Add”.
-now create your ext4 partition the same way, size it the way you like but make sure its big enough to fit the data thats stored on your ext4 partition on your old drive, select “ext4” from the file system drop-down and click create.
-now if you use a swap partition, create that as well, i matched the size of mine to the amount of ram i have installed but you decide for yourself on its size, select “linux-swap” from the file system drop-down and click add.
-at this point you should be ready to finalize the changed to the new drive. (if you have other partitions you want created, do that and then move to the next step).
-after your done with the partition tabe click the check mark and Gparted will begin finalizing your changes.
-when this is done you want to right click the FAT32 partition on the new drive and select “manage flags” and then select “esp” and “boot”.
-your new drive layout should now look like your old drive layout.
-make note of which drive is which (my original drive was “sda” and the new one was “sdb”. you need to know this for the next step.
Restore the backup you created with timeshift to your new drive.
-open timeshift if its not already open.
-select the backup you just made and click the “Restore” button.
-a “Select Target Device” window will open.
-select the target according to where you want the backup to be restored to.
since my original drive was “sda” and the new drive “sdb”,
for the “/” drop-down i want to choose “sdb2” because its the ext4 partition on the new drive.
for the “/boot” drop-down i choose “keep on root device”.
for the “/boot/efi” i choose “sdb1” which is the fat32 partition you will boot from.
and for “/home” i chose “keep on root device”
-now that the target drive/partitions are selected click on the big “Bootloader options” button located below the drop-down’s on the same window.
-you should now see 3 check boxes and a drop down menu.
check all 3 boxes and select your new drive from the drop-down, (“sdb” in my case) and then click “close”
-now click “next” and timeshift should now be restoring your backup to your new drive.
-once it is finished you will want to restart and hold/tap your F12 key or whichever button you use to get to boot selection.
-once your at boot selection, select your new drive from the list and if all goes well it should boot up from your newly created cloned drive and put you into a grub menu.
-if everything boots up fine, then now is when you want to decide on which drive goes where.
drive placement (if you have 2 drive slots like me and you want to leave both the original and the new drive installed, skip this and move to step 6)
-new drive boots fine? great. now if you only have 1 drive slot , now is the time to power off and do the switch.
set boot order in bios. (if you removed your old drive and replaced it with the new one, this might not be necessary but it doesnt hurt to check)
- power on and go into bios (F2 key in my case) and go to the “boot” section and set which drive you want to boot first by default.
-if you replaced the drive its probably already the first boot device.
-if you added a drive to your second drive slot and you want it to boot from your new drive by default then move the new drive to where the old drive was in the boot order so your new drive is before the old one and by default the new drive will boot first.
-save and exit bios and restart.
*timeshift will automatically re-install/update grub when its finished and the UUID is not cloned so you shouldnt have an issue with having 2 drives with the same UUID.
your new drive should boot right up and put you into a grub menu like it did before, in my case the grub listed my new drive with manjaro on it as the default and even listed my old drive with manjaro on it and both boot just fine although you’ll probably want to make better use of your old drive rather than just having 2 drives to boot the same exact thing, so do what you will.
i hope this tutorial proves useful, i know it would have for me before i messed up both my original and new ssd using DD(aka data destroyer). which used properly is a very powerful tool when used correctly, but blindly using it without absolute certainty if it will work for your purposes is almost certainly going to end badly.
please do let me know if i missed anything, thanks.