How to I copy bootable USB flash drive to larger drive?

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?


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.