Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tired a number of things to get this to work and I'm missing something.

I ran out of space on my 8gb bootable flash drive. I'm running 12.04 server. The drive has sda1 (primary 4gb), sda2 (extended 4GB) and sda5 (swap 4gb).

I tried copying old drive to new drive using ddrescue (whole drive copy) and then resizing on another linux box using gparted. I made sda1 ~22Gb (75% of the drive) and used the remaining space for sda2 and sda5. When I tried booting it I get to the GRUB menu and when I select the OS I get a message about not enough room or space.

Next try.

I dd'd the MBR of the new drive and then created sda1 - primary linux 83 (75% of sectors on drive), sda2 - extended 5 (25% - remaining sectors), sd5 - logical linux 82 swap (same sectors as sda2). I then wrote the changes and exited fdisk. I then ran ddrescue with the following command: ddrescue -d -f -r3 /dev/sda1 /dev/sdb1 (old drive copied to new drive). It competed successfully. I mounted the new copied partition and ran df to see the free space and it shows the same amount as the old small drive -97% used. I thought I had to resize or something so I moved drive to other linux box and ran gparted. Didn't find that the partiion needed resizing.

The new partition has the same UUID as the original but I think i might need to copy the old swap partition UUID to the new one and I don't know how - only how to randmly generate a new one.

So, where did I go wrong here. Am I close to getting this right?

share|improve this question

Ok, this is what i would do:

Assuming your old disk is /dev/sda and the new one is sdb.

dd if=/dev/sda of=/dev/sdb

After that, check if it is booting.

If it does, you can resize the partitions with your tool of choice.

share|improve this answer

Also you can use clonezilla ( It offer many options, but with dd command is good in your case.

share|improve this answer

Yeah.. I would nuke the swap partition.. comment it out of your /etc/fstab, then after cloning it w/dd (use bs=4096) then boot off the new drive.. grow your root fs (as you commented) and then when working.. jsut create a new partition, type "swap".. and after you can see it with "fdisk -l", then just set it up as a usable swap system with "mkswap [-c] [-f] [-p PSZ] [-L label] [-U uuid] device [size]" and run "swapon -a" to test it.

Or.. Just use clonezilla.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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