Ubuntu – How to copy /sda3 to /sda1? UUID’s can’t be similar

gpartedpartitioninguuid

/dev/sda is a 400 gig drive. It's partitions WERE: /sda1 – Windows boot partition (100 meg); /sda2 Windows "C:\" (68 gig); /sda3 is Linux boot partition; /sda5 is /home partition; /sda6 is linux-swap.

/sda1 and /sda2 have been deleted and /sda2 expanded into /sda1.

I want to clone /sda3 to /sda1 AND have the 12.04 (precise pangolin) know to boot from /sda1 and not from /sda3.

How do I edit both /etc/fstab and GRUB2 to have proper (I have no idea how to use words to express this idea) UUID? I know that using GParted to "copy" /sda3 to /sda1 requires editing to make the copied partition have a UUID that is not a match (or the same UUID number as) the original partition (/sda3). What other steps must I take to not confuse GRUB2 and the fstab so that they work harmoniously and I don't harm the OS/data/other stuff on the hard drive?

Next, I want to shrink /sda1 to 25 gig (currently 68 gig), and continue /sda1 as boot. Then I want to use 43 gig from shrinking /sda1, and add it to the (to be) unused /sda3 and then to expand /sda5 into the expanded /sda3

I cannot post a screenshot of gparted, so here is fdisk -l in stead:

mark@Lexington-19:~$ sudo fdisk -l
[sudo] password for mark: 

Disk /dev/sda: 400.1 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders, total 781422768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf3e1e104


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1            2048   143570943    71784448   83  Linux

/dev/sda3   *   143572905   174176729    15301912+  83  Linux

/dev/sda4       174176791   781417664   303620437    5  Extended

/dev/sda5       174176793   764420894   295122051   83  Linux

/dev/sda6       764420958   781417664     8498353+  82  Linux swap / Solaris

Best Answer

The easy way, IMO, is to boot the Ubuntu desktop CD. You can then use gparted to copy-paste your partitions.

The only trick with gparted is that you have to apply the changes one setp at a time.

Delete sda1 -> apply changes -> copy sda3 -> paste -> apply changes.

gparted

Once you have copied the partition you can also use gparted to create a new UUID

Select the partition → New UUID

Mount the partition at /mnt

sudo mount /dev/sda1 /mnt

Edit fstab, enter the new UUID under the entry for the root file system.

List the UUID, if needed, with blkid

blkid

gksu gedit /mnt/etc/fstab

Re-install / update grub

sudo grub-install --boot-directory=/mnt/boot /dev/sda

See also:

Related Question