Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The reason for this is that I want to increase my Ubuntu partition size but I unable to so because of some error like "cant have overlapping partition" so now I want to copy the contents of my whole partition and paste it in to another ext4 partition.

I just want to know how to instruct grub to boot from that particular partition (if needed)?

Here is the screenshot:
screenshot

share|improve this question
    
I think it will be much easier (and safer) to actually fix the "overlapping partition" error, rather than copy everything to another partition. How did you get this overlapping partition error? What exactly were you trying to do? –  Alaa Ali Aug 14 '13 at 13:09
    
after moving my swap space I got this error –  user177282 Aug 15 '13 at 6:40

2 Answers 2

I've done this a number of times, but there are some tricky manual steps. If you are new to Linux, this method might be daunting (sorry):

I assume you deleted the sda1 partition earlier, which is why you have the unallocated space at the beginning of the disk, the high-level procedure is:

  • re-create the sda1 partition
  • format the new sda1 partition as ext4
  • I recommend you label the new partition something like:
    • e2label /dev/sda1 ssdroot1
  • mount the new sda1 partition
  • copy your current system to the new sda1
    • To do this, I use a trick to copy a running system:

Assuming your new sda1 is mounted at /mnt/sda1/:

 mkdir /bind
 mount -o bind / /bind
 cd /bind
 cp -a . /mnt/sda1/
 cd
 umount /bind
  • Finally, you will need to edit the /mnt/sda1/etc/fstab to make the new sda1 the / (root) partition.
    • put the new UUID in place of the sda5 UUID

You can see the UUID and labels by doing:

blkid | grep sda

Before rebooting, make note of the sda1 label or UUID.

For the first boot into sda1 you will need to manually override the root at the grub prompt by editing the boot parameters. Not that these edits only affect this boot, they will not be persisted to disk.

Press 'e' to edit
find the linux line with root=UUID=....
change it to the new UUID, or remove the root=UUID=... and put in root=LABEL=ssdroot1
(assuming you labeled your new sda1 partition)

Press F10 to continue the boot, with any luck you will boot into your sda1 copy of Linux.

Check that you are really in your new Linux:

df
cat /proc/mounts

Once into your new Linux copy, I recommend you run:

update-grub

Note that the Master Boot Record will still refer to your old sda5 Linux.

If you want to make these changes permanent, so you can remove sda5, you must update the MBR to refer to the sda1 Linux by running, from the sda1 Linux:

grub-install /dev/sda

Good luck! - Greg

share|improve this answer
    
thanks for the reply but I impatiently deleted my other pations and now i only have a swap partition and another ext4 single partition occupying my entire disk and my copied Ubuntu system on it. Can I now boot into it.(with the help of live dvd)please help. –  user177282 Aug 15 '13 at 6:47
    
In this situation, I guess I would boot into rescue mode with the DVD (root prompt) and try and fix things up by doing a grub-install /dev/sda Also, I might mount the Linux system and edit etc/fstab to ensure the root (/) filesystem UUID is correct. Also might edit boot/grub/grub.cfg to see if UUID is correct there also in case the process you used changed the UUID on the partitions. –  Gregor Aug 15 '13 at 19:59

I thought I would provide another option. I know you said in your title that you wanted to copy the current Linux partition and boot from it, which I addressed in my other answer, however, if all you are really trying to do is to better utilize your SSD drive, you have other options.

You still need to re-create and format the sda1 partition, however, you could then mount that new sda1 partition as /data (for example) and then have access to the additional storage.

This would be significantly easier and less complicated than my first answer, however, your Linux system would not be copied. It would remain as sda5

  • Greg
share|improve this answer

Your Answer

 
discard

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.