0

So I have dual booted my 1 TB hard disk with Windows and Ubuntu.

The disk partition looks as following Disk Partition

As you can see there is 326 GB of unallocated space that is not usable. It is an MBR disk so I am aware that the maximum number of partitions can be 4. Current primary partitions run contain the following:

  • Partition 2 /dev/sda2 Windows Filesystem
  • Partition 5 /dev/sda5 Linux Filesystem
  • Partition 6 /dev/sda6 Linux Swap
  • Partition 7 /dev/sda7 Linux Files

Is it possible to make this space usable?

Please link any previously answered questions if this has already been answered.

The output of sudo fdisk -l is

Disk /dev/loop0: 202.9 MiB, 212713472 bytes, 415456 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 /dev/loop1: 320.2 MiB, 335728640 bytes, 655720 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 /dev/loop2: 320.2 MiB, 335794176 bytes, 655848 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 /dev/loop3: 202.3 MiB, 212099072 bytes, 414256 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 /dev/loop4: 181.1 MiB, 189870080 bytes, 370840 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 /dev/loop5: 89 MiB, 93327360 bytes, 182280 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 /dev/loop6: 8.4 MiB, 8839168 bytes, 17264 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 /dev/loop7: 180.2 MiB, 188928000 bytes, 369000 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 /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x6436f9fc

Device     Boot      Start        End   Sectors   Size Id Type
/dev/sda1  *          2048    1026047   1024000   500M  7 HPFS/NTFS/exFAT
/dev/sda2          1026048  686035516 685009469 326.7G  7 HPFS/NTFS/exFAT
/dev/sda3       1323407360 1324374015    966656   472M 27 Hidden NTFS WinRE
/dev/sda4       1324378110 1953523711 629145602   300G  5 Extended
/dev/sda5       1324378112 1359499263  35121152  16.8G 83 Linux
/dev/sda6       1359501312 1375123455  15622144   7.5G 82 Linux swap / Solaris
/dev/sda7       1375125504 1953523711 578398208 275.8G 83 Linux

Partition 4 does not start on physical sector boundary.




Disk /dev/loop8: 85 MiB, 89128960 bytes, 174080 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 /dev/loop9: 88.7 MiB, 92983296 bytes, 181608 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 /dev/loop10: 8.4 MiB, 8835072 bytes, 17256 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 /dev/loop11: 8.6 MiB, 9019392 bytes, 17616 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

EDIT

Ok from other answers I figured that if I boot using a live CD/USB then I can resize the disk using GParted by bringing the unallocated disk next to the other disk and merging them.

Here is a screenshot of GParted GParted

Now I want to merge some of the unallocated space to /dev/sda5 and remaining to /dev/sda7.

Is it possible to do this? Will this work using a live CD/USB?

shardul08
  • 41
  • 1
  • 8
  • 1
    Almost the same question: https://askubuntu.com/questions/1174113/how-do-i-extend-an-existing-partion-to-add-more-space-to-it/1174114#1174114 The answer will be valid for your situation. – mook765 Sep 22 '19 at 20:28
  • @mook765 Thanks for the answer. Is it possible to merge the part of unallocated space to one partition and other part to the other? – shardul08 Sep 22 '19 at 21:05
  • Sure, just remind that the free space must be adjacent to the partition you want to merge with. How much space you want to add to a partition is up to you. You can first add some space to sda2, then move sda3, then add the rest of space to sda4 and so on... And of course, you need to use a live-USB! – mook765 Sep 22 '19 at 21:14
  • sda7 has plenty of free space, no need to add there. Better you add some space to sda2 which is ntfs and doesn't have much space left. ntfs needs more free space for the purpose of defragmentation. – mook765 Sep 22 '19 at 21:21
  • @mook765 What will be better creating logical partitions for merging or moving the unallocated partition? And would there be any problem in creating logical partition if there are already 4 primary partitions? And what are the chances of loosing data during the process? – shardul08 Sep 22 '19 at 21:33
  • You can create as much logical partitions as you want, but to create a logical partition you must have free space in the extended partition (sda4). Please understand that unallocated space is not a partition, you cannot move it, you move partitions, the result is basically the same. https://askubuntu.com/q/151968/590937 – mook765 Sep 22 '19 at 21:46
  • 1
    If your computer is EFI/UEFI, then your disk should be GPT, not MBR. If sda2 is your Windows C: drive, you shouldn't be mounting it in Ubuntu. Since it looks like your Ubuntu is relatively fresh, move sda3 left, and then either move sda4 partition left and move/resize sda4/5/6/7, or move the LEFT SIDE of sda4 left, then move/resize sda5/6/7. Make good backups FIRST. – heynnema Sep 22 '19 at 21:47

1 Answers1

1

Unallocated space is always usable!

But, as you experienecd, not all actions might be possible, so in your case you can't create a partition in the unallocated space due to the limit of the MBR which can't hold more than for partition-table-entries.

But you could grow or move adjacent partitions into the allocated space, thus the space is usable.

The unallocated space is not a partition!

A partition is just disk-space defined in a partition-table-entry, from the partition-table-entry we know where a partitions starts and where it ends. When we move or resize a partition, we actually edit the data in the partition-table-entry.

Unallocated space is just space which is not covered by any partition, no partition-table-entry exists for the unallocated space. The size and location of unallocated space depends on the existing partitions.

We can't move or resize unallocated space directly, we move or resize the adjacent partitions, the result is basically the same, the unallocated space appears to be moved or resized.

You can't merge partitions!

If you want to increase the size of a partition, you need unallocated space adjacent to the partition, you can't use the space which is occupied by another partition, partitions cannot overlap.

If another partition is between the unallocated space and the partition you want to grow, move that other partition to the other end of the unallocated space.

Extended and logical partitions

With the MBR partitionig scheme we can have up to four primary partitions, one of them can be used as extended partition which is a container for the so called logical partitions.

If you want to create or grow a logical partition, you need some unallocated space inside the extended partition, space which is not occupied by a logical partition. Of course, also here the unallocated space must be adjacent to the partition you want to grow.

To create unallocated space in the extended partition, we can either shrink one or more of the logical partitions or we increase the size of the extended partition.

What to take care of when editing partitions?

  • Editing partitions always comes together with the risk of data loss, So it's strongly recommended to back up your data first.

  • Be patient, moving or resizing means moving data, in some cases this may take a while, do not abort the process, you'd end up with broken partitions and data loss.

  • If you use a laptop, make sure your power supply is connected properly, you don't want to run out of battery while editing partitions.

mook765
  • 15,925