The following is the current partitioning on my friend's Ubuntu machine.Here, /dev/sda5 is root file system. This is located on extended file system. I want to add the 80GB ext4 (/dev/sda3) and 250GB unallocated to root (/dev/sda5 - ext4). I am able to extend only 80GB /dev/sda3. But could not extend /dev/sda5. Even with live cd, I have to delete both /dev/sda5 and /dev/sda2 to extend but that's resulting grub error. How can I achieve it without losing data? enter image description here

  • Partitions must be unmounted to work on them from live cd/USB. Best way to not lose data is backup data. Data lost should be expected when working on partitions. – crip659 Dec 4 '20 at 19:34
  • yeah, correct. Atleast I want the machine to boot up after changes. – Vamshi Dec 4 '20 at 19:36
  • Don't mention Ubuntu version, so after backup if wanting to upgrade just install newer version with partitions you want. – crip659 Dec 4 '20 at 19:43
  • 1
    Move /dev/sda3 to the end of the unallocated space. Then grow (resize) /dev/sda2. Then /dev/sda5 can be resized after. – Terrance Dec 4 '20 at 19:50
  • 1
    Does this answer your question? How to resize partitions? – karel Dec 6 '20 at 11:08

You need to do it from live CD(USB) in this order:

  1. If there are any data on sda3 you want to keep, back them up first.
  2. delete sda3
  3. select the extended partition sda2 and grow it's size to the most right.
  4. select sda5 and grow it's size to the most right.
  • sda3 contains his data. Add backup of data first or he will be mad at you. – crip659 Dec 4 '20 at 19:36
  • @crip659 sda3 appears pretty empty to me. – mook765 Dec 4 '20 at 19:37
  • Almost a GB is used, could contain very important non replaceable data or just cat pictures from internet. – crip659 Dec 4 '20 at 19:40
  • 1
    @crip659 From the amount this are most likely reseved blocks, looks like a fresh partition. But your right anyway, added this step to the instructions, safety first. – mook765 Dec 4 '20 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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