I'm upgrading a 30gb ssd to a bigger one.

I used dd to clone and this worked as expected, but I cannot expand the partition on the new drive. The only thing at the end of the drive, is the swap partition. I've deleted that but there is still apparently no room to expand the main partition into.

If needed, I can do the clone again if I've got something wrong.

I've done some investigations on Google but haven't really found any clues.

The command I used was

dd if=/dev/mmcblko of=/dev/sda

Attached is a screenshot of KDE Partition Manager (this is Kubuntu...)

As you'll see the left hand pane says it's 119Gb but the right-hand pane only adds up to around 30Gb (the size of the source ssd).

enter image description here

  • 1
    Can you add a screenshot of what it looks like in gparted? – Potassium Ion Dec 4 '16 at 21:16
  • 1
    Also, a list of commands you've used and the outputs would be helpful. – ThatGuy Dec 4 '16 at 21:22
  • 1
    Here's the screenshot... – Sam Dec 4 '16 at 21:42
  • 2
    Run gdisk sudo gdisk -l /dev/sda and see if it gives errors. You probably have backup gpt partition table in middle of drive, it should be at end. You also cannot have both drives plugged in at same time as then you have duplicate UUIDs & GUIDs. Better to just partition in advance and use cp or rync to copy all files. You would have to totally reinstall grub & edit fstab with new UUIDs. – oldfred Dec 4 '16 at 22:08

KDE Partition Manager developer here... As was mentioned earlier, your second GPT entry is in the middle of the drive, so you don't see the whole size. In fact KDE Partition Manager tells you exactly that in the log output. Although you seem to have disabled log output in the View menu...

The easiest way to fix it is to open Konsole and run

sudo apt install gdisk
sudo gdisk /dev/sda

Then press w to write changes to disk and gdisk will ask you:

Warning! Secondary header is placed too early on the disk! Do you want to correct this problem? (Y/N):

Press Y and enjoy your full disk space.

| improve this answer | |
  • Gdisk worked. Thanks. For info, logging in kde partition manager was switched off by default. Sam – Sam Dec 6 '16 at 6:48
  • Hmm, yes it is switched off by default. Usualy it doesn't contain any information to users, so I guess it's better to keep it that way to prevent GUI interface from getting too complicated. – Andrius Štikonas Dec 6 '16 at 16:12
  • This is first thing that I've found in years that is better implemented in gparted - it will prompt you about that issue at start and suggest fixing it for you. KDE partition manager doesn't do that unfortunately and info about it is hidden. – GwynBleidD Nov 22 '19 at 15:49

I think it will work to clone the drive with mkusb. It can fix the backup gpt partition table automatically (write it at the end of the drive).

sudo -H mkusb /dev/mmcblk0

mkusb will help you select the target drive (and help you avoid overwriting a drive with valuable data).

When the cloning is done, the partitions on the source drive and the target drive are not mounted. But as explained by oldfred, please remove the original source drive (the card seen as mmcblk0) to avoid confusion with the UUIDs and GUIDs, and never connect them to the same computer at the same time.

After that you can use gparted to edit the partition table in the new drive (move and expand the partitions to use the whole drive). See this link.

| improve this answer | |
  • Thanks...that's useful. I still have both ssds plugged in so it's likely then that what I'm seeing is details from the wrong ssd. Unfortunately any ore work on this will have to wait until next weekend now... Thanks for the suggestions. I'll update this once I've had a further dig Sam – Sam Dec 5 '16 at 8:45

Use Macrium Reflect Free ... this is relative straight forward, and basically follow the defaults, ensuring you have checked all the sectors on the drive to CLONE.

However, sometimes you might find that the cloned drive doesn't work, so also make sure you also Create a Rescue Media ... and use a USB drive to create this to. If you don't do this step, you will come unstuck when you install the new drive, and it doesn't boot.

So, if the PC doesn't boot, you will need to drop into BIOS and set the boot sequence to USB first, and go through the recovery.

If you are later wanting to upgrade your 500Gb SSD to a 1Tb SSD (as I did last night), you might not be able to expand your C: to the full drive capacity.

This is where you need to use something more powerful than Windows: Linux.

Obtain a copy of a Linux ISO (eg Ubuntu's Xubuntu), and also download Rufus.exe, which will let you set up a USB boot drive from the ISO. ... follow the defaults and specify the linux.ISO file as the install.

Now, again, reset the BIOS boot order, and reboot to Linux.
Find the program "gparted" .... this will allow you to resequence the drive sector order. If you don't find "gparted", you will need to obtain a copy off the web.

gparted will show you all the sectors, and you may find your main sector has a smaller boot/system sector after it, and between the unallocated portion of the disk. To move the sector, follow these instructions:

  1. right-click on the unallocated portion, and Add a new extent with a TRAILING (or "after") segment that is exactly the size (in Mb) as the sector you want to move. (you should see a new extent that is grabbing most of the remaining disk, and a smaller unallocated portion at the end of the drive.

  2. right-click on the sector you want to move (eg, /dev/sda5), and copy it, and then paste this to the unallocated sector ... this will show a "xxx_copy(1)" name, or something similar (eg, /dev/sda5_copy(1). By now, your entire drive is used. Don't try and rename it, as you can't.

  3. right-click on the sector that you just copied from (/dev/sda5) ... and delete it. This will now show as "Unallocated"

  4. right-click on the new large extent you previously created, and delete that too. This will now show as "Unallocated"

  5. right-click on the original main sector that you want to extend from 450Gb to the remaining disk, and select the "Extend" option, and use up the maximum disk you can.

  6. Click on the GREEN tick button and apply your changes. Please note, that none of the changes you have made will apply until you run this command. This will only take a minute or less, and you can exit the gparted, and reboot your PC (having removed the USB).

Now you will have a large C:

| improve this answer | |
  • The software you recommend is Windows only. – Kevin Bowen Jul 27 '18 at 2:01

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.