2

enter image description here

I Want to merge my /sda1 and /dev/sda6. I have Ubuntu in both /sda1 and /dev/sda6. But just now I have formatted /dev/sda1, now I want to merge it with /dev/sda6 (it has Ubuntu).

Please suggest me step wise using gparted.

Ravexina
  • 55,668
  • 25
  • 164
  • 183
sam
  • 71
  • This is a complete guide to gparted, read it out in whatever pace you can, try to understand the terminology and consider editing your question with more details if you get into any issues Gparted Manual – Sumeet Deshmukh Apr 24 '17 at 06:45
  • 1
    sda1 and sda2 are Windows in the image. Not linux. So either the image is wrong or what you want is impossible with this setup. – Rinzwind Apr 24 '17 at 06:49
  • no sda1 and sda2 are now just partitions. they don't have any OS in them. I want to merge sda1 and sda6 – sam Apr 24 '17 at 07:43
  • 1
    Can't you just remove sda1, move partitions sda2 - sda5 to the left, and then expand sda6 to fit the empty area ? Note that execution might take a while on operations like that. – pLumo Apr 24 '17 at 07:51

1 Answers1

4

There are at least three problems with your question:

  • You cannot directly merge two partitions using common Linux tools. You can expand a partition into adjacent unpartitioned space, but merging partitions (which implies saving the contents of both partitions) is not supported by any Linux tools of which I am aware.
  • Your /dev/sda1 and /dev/sda6 are not adjacent to one another -- two other partitions exist in-between them. Also, /dev/sda1 is a primary partition and /dev/sda6 is a logical partition. Thus, even if you found some obscure tool to merge two partitions, it would be useless in this context, because a partition must be a continuous set of sectors, like sectors A to D, not A to B and C to D, with other partitions occupying sectors B to C.
  • Your /dev/sda1 is NTFS and /dev/sda6 is ext4fs. Thus, even if you found a tool to merge two partitions, and if they were adjacent to one another, you couldn't do it because they're different filesystem types.

All that said, I suspect that your /dev/sda1 is empty, and you simply want to expand the size of /dev/sda6, using the space of /dev/sda1. That task can be done, but it requires some intermediate tasks:

  1. Delete /dev/sda1.
  2. Move /dev/sda2 to the left. This will have the effect of moving the free space now occupied by /dev/sda1 to the right of /dev/sda2.
  3. Move /dev/sda3 to the left. Again, this has the effect of moving the free space to the right of /dev/sda3.
  4. Resize the extended partition, /dev/sda4, so that its start point is as far to the left as possible. It should now encompass the free space. (Note that an extended partition is a sort of placeholder that itself contains logical partitions. Thus, although the free space is within the extended partition, it's still available to logical partitions and so remains free, in some sense.)
  5. Resize /dev/sda6 to the left, so that it now consumes the free space.

This procedure carries some significant caveats:

  • You'll need to perform the last two of those operations from an emergency boot (like an Ubuntu installer in "try before installing" mode).
  • The partition-move operations and resizing the Ubuntu partition to the left are likely to be time-consuming. Precisely how time-consuming depends on the speed of your disk -- maybe just a few minutes, but maybe over an hour for each of them.
  • The partition-move and resizing operations carry some risk of damage to your partitions. Note that "damage to your partitions" could mean loss of important files. Thus, it's imperative that you back up anything important on these partitions before you begin.
  • This operation might render OS(es) on the partition(s) unbootable. Thus, you should be prepared to run Boot Repair to fix Ubuntu. Windows repair is likely to require running specialized Windows tools, and is beyond my expertise. Repairing Windows is beyond the scope of this forum, too. You may want to research this topic before beginning, and ask for help on a Windows forum if you need it.
  • DO NOT try to operate on this disk using the standard Windows tools. Although it might do a better job of keeping Windows bootable, the standard Windows partitioning tools are known to wreak havoc when dealing with disks, like yours, that have extended and logical partitions.

As an alternative to this procedure, you might consider using your existing /dev/sda1 more-or-less as-is. This question and answer, for instance, describe how to add a partition as a separate /home partition. You'd need to create a fresh ext4fs (or other Linux native) filesystem on the partition, but this approach bypasses all of the preceding caveats. OTOH, your current Ubuntu root (/) partition is tiny (16.28 GiB), so unless you want to increase its size for more user storage space, you might not free up enough space by using /dev/sda1 as /home. Maybe moving /var or something else to the new partition would work better, but that creates its own inflexibility. Moving the entire installation to /dev/sda1, which is 53.61 GiB, might be a better approach. See here for some discussions on this approach.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • Thanks a lot sir, your answer is very informative. I realised, one needs considerable experience to do this operation, because it may lead to boot error. As I have previous experiences of GRUB Rescue error, I can't take this risk. I just need to increase to my ubuntu file system size which is too low now, any way be going to continued. – sam Apr 25 '17 at 03:15
  • If you don't need any data on /dev/sda1, or if you can back it up easily, you might find it easiest to create a fresh Ubuntu installation on /dev/sda1. If you back up your data from the current Ubuntu installation, you could also re-use /dev/sda6 as something -- maybe /var or home, depending on your needs. – Rod Smith Apr 25 '17 at 13:24