Score:1

New Harddrive Partition Expansion Problem

us flag

I have upgraded my Ubuntu hardrive from from 1 tb to 2 tb. I successfully cloned the original drive with "dd" but had problems expanding the disk partitions to utilize the new space. After resizing the partitions, the computer booted normally, but Ubuntu went into "emergency mode" and would not start. I re-cloned the old drive to the new and now everything works normally, albeit without the new disk space being available.

The attached screenshot is a Gparted look at my new drive taken via a live boot USB. In more reading about this problem, I now know that I should have unmounted the swap partition before attempting to resize the expanded partition in which it resides.

Gparted Screen Shot

I suspect my problem was found in resizing the expanded partition which contained the mounted swap partition. I am writing here to ask if there is anything else of which I should be aware. I expect the steps to follow, after unmounting the swap, are:

  1. Delete partition SDA6 (a sliver of an old windows install serving no purpose)
  2. Expand SDA2 (expanded partition) all the way to the right.
  3. Expand SDA7 (home partition) all the way to the right.

Also, there is now a drive SDC that appears to be the same drive as SDA. I do not know what this is, perhaps a leftover from my first attempt at expanding partitions? Here is a screen shot of that as well.

SDC Drive

Is there anything else I should know and/or do? In reading through many posts on this forum, it sounds like this is a straight forward process with Gparted, but I am asking here for advice before I make a second attempt.

oldfred avatar
cn flag
You have to unmount swap & extended before you can resize or edit partitions. I prefer to have swap at end of drive, so out of the way. But is this a newer UEFI system? If so I would suggest converting to gpt (which may totally erase drive) and install in UEFI mode. Now would be a better time to make that change. Is sdc the old drive, but it is showing different partitions. https://wiki.archlinux.org/index.php/GUID_Partition_Table#Advantages_of_GPT the only reason to use MBR(msdos) anymore is if installing Windows in the old BIOS boot mode.
ar flag
See [this answer](https://askubuntu.com/questions/510393/cannot-move-swap-space/510411#510411) for a solution to a similar problem.
heynnema avatar
ru flag
@oldfred Placing your swap partition at the end/rear/right decreases your system performance, as the disk has to travel further to use it. Best to have it in the beginning/front/left... or use a /swapfile instead of a partition.
heynnema avatar
ru flag
Status please...
oldfred avatar
cn flag
Even my 2006 system with 4GB of RAM never used swap. So it did not really matter where on drive it was. It was more for some emergency use. And now SSD does not matter. You can see swap use `free -m`
Score:2
ru flag

Your problem is that you have a 2TB HDD, but you're using a MBR partition table. Your 1TB source disk was MBR and was using extended partitioning. Disks larger than 2TB require a GPT partition table, and don't require extended partitioning. Cloning is not the best choice in this case.

You can check the partition tables by using sudo fdisk -l.

Note: There are some partitioning problems on your original 1TB HDD that you don't necessarily want to clone to the new 2TB HDD.

Backup any new data on the 2TB, lay down a fresh GPT partition table (this WILL wipe the drive) using gparted. Then copy over partitions using gparted, clonezilla, or some other application. (Not recommended plan).

Or, better yet, just do a fresh Ubuntu install to the 2TB (with the fresh GPT partition table from above). Don't manually allocate partitions, accept the Ubuntu installer's default partition scheme, unless you wish to create additional ext4 partitions, or NTFS partitions to share data with a Windows installation. Then copy over any data from the 1TB to the new 2TB HDD. (Best plan).

Note: If you wish to create a dual-boot configuration with Windows, install Windows FIRST, and then Ubuntu second.

Score:2
us flag

Thank you all for your help. I asked in my original post "Is there anything else of which I should be aware" the clear answer is yes. I knew nothing of MBR vs GPT partitions. After reading the answers and comments and doing some more research, I have decided to redo the new 2TB drive as GPT and start with a fresh install with default partitioning before moving my data from the original drive.

Score:0
mx flag

dd will create the same size partitions from the old drive to the new larger drive, which is of no use. I suggest a more simpler approach:

  1. Boot with live usb with both hard drives present.

  2. Create a new root partition on your new drive utilizing all hard drive space (using fdisk).

  3. Mount your old hard drive (filesystem) to /mnt and use cpio or cp -a to copy all your files to the new hard drive, then umnount and repeat for all the filesystems on your old hard drive to copy to the new hard drive except for "linux-swap".

  4. Install grub on your new drive ie grub-install /dev/sdb

  5. Update (Edit) /etc/fstab with UUID on the new hard drive. (this is found by running sudo blkid

  6. Power off your system and pull the old hard drive.

  7. Reboot and create a new /swapfile, then run sudo mkswap /swapfile

  8. Activate the swap file by running sudo swapon /swapfile

  9. To make the change permanent, Edit /etc/fstab and add the following line:

    /swapfile swap swap defaults 0 0

FYI - A swapfile is easier to resize (if needed) than a swap partition.

heynnema avatar
ru flag
You forgot to add /swapfile to /etc/fstab.
stumblebee avatar
mx flag
@heynnema Thx! I updated my answer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.