0

So I'm trying to give my ubuntu 16.04 partition more disk space by booting from a pendrive with ubuntu and gparted. I already have a 40gb unallocated disk space, however after watching a few videos, and reading, I saw that it was necessary for the Free Space to be together with the Swap Space and the Ubuntu filesystem root. In my case there is an unknown 1.0MB linux filesystem between the Ubuntu root and the swap space, so I can't do it. Somebody told me it was probably created to protect the swap space. What should I do? Disks

(edit)...After moving partition 7 to the left, I got this enter image description here

however, when I right click on the 8th partition, I don't get the option to resize the partition, and when I try to resize the 9th partition, I can't move it either to the left or to the right (since the unknown or 8th partition is at the left).

Anto
  • 13
  • 1
    Is this an UEFI system booting from ESP - FAT32 partition? And then did you install at some point in BIOS/CSM mode? That requires a 1MB unformatted partition that always shows as an error since unformatted. But it should have flag saying bios_grub in gparted. Post this sudo parted -l and sudo gdisk -l /dev/sda – oldfred Oct 12 '16 at 20:45

2 Answers2

0

I would begin by making a backup utilizing my method here: What's a good back-up strategy for 1 desktop PC? for although I've moved and resized many partitions without error or data loss a power or hardware failure during the process can ruin your day.

I would then continue by issuing the command sudo swapoff -a to insure that the swap partition (7) is not in use.

Then I would move partition 7 to the beginning of the free space to the left until all your free space is next to partition 9. Since p8 is unallocated you might be tempted to delete it but you will want to insure that your fstab is using UUID rather than /dev/sdX entried to insure that you don't impact mounting in some unexpected way.

When all this is complete select partition 9 and select Resize/Move and drag the bounderies left and right as necessary to utilize the space

Specifying Partition Alignment

To specify the alignment of the partition, click the Align to arrow button, and select from the list.

Use MiB alignment for modern operating systems. This setting aligns partitions to start and end on precise mebibyte (1,048,576 byte) boundaries.

MiB alignment provides enhanced performance when used with RAID systems and with Solid State Drives, such as USB flash drives.

Sources: memory and http://gparted.org/display-doc.php?name=help-manual#gparted-resize-partition http://gparted.org/display-doc.php?name=help-manual#gparted-specify-partition-size-and-location

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • p8 isn't a partition, it's unallocated space, and it's used to align p9 on a MiB boundry. My solution is similar to yours, except I always resize a partition from the right. I don't know if resizing from the left side moves the data to the front of the larger partition, or if it just changes the start of the new partition and leaves the data in the middle. Cheers, Al – heynnema Oct 13 '16 at 14:04
  • @heynnema Thanks for pointing that out. I'm not sure how I missed the ..Un in the image. moving and resizing can be done in a single operation: http://gparted.org/display-doc.php?name=help-manual#gparted-resize-partition – Elder Geek Oct 13 '16 at 15:04
  • Not to nitpick, but... you can't delete p8, it's just empty space (unallocated). And you're still moving the left (start) of p9, and as I mentioned, I suspect that leaves data in the middle of the new partition. If you check my answer, I do the move and resize in one step... but I resize to the right, and end up with data in the beginning of the partition. Cheers, Al – heynnema Oct 13 '16 at 15:09
  • MiB alignment is best practice for ALL disk devices, not just RAID or SSD. It will slow down all disk operations if a partition is misaligned. Cheers, Al – heynnema Oct 13 '16 at 15:36
  • @heynnema Ok, I'll bite. Source? – Elder Geek Oct 13 '16 at 15:39
  • Google "disk partition alignment best practice" and be prepared for a big read. Newer "advanced format" drives with 4K sectors require a little more handling. Cheers, Al – heynnema Oct 13 '16 at 15:51
  • A google search is not a source. – Elder Geek Oct 13 '16 at 15:53
  • No, but if you read any of the hits from the Google search, it'll say what I said. Partition alignment effects disk performance. Proof enough. Cheers, Al – heynnema Oct 13 '16 at 15:56
  • I'm sorry for answering so late. So I already moved the 7th partition to the left, how can "I insure that your fstab is using UUID rather than /dev/sdX entried"? And after doing that, should I delete it? I can't move partition 9 to the left since the 1mb partition is over there. – Anto Oct 22 '16 at 17:21
  • @Anto http://askubuntu.com/questions/303497/adding-an-entry-to-fstab – Elder Geek Oct 23 '16 at 01:25
0

This one is easy...

update: added steps 5.1 through 5.3.

update: sda8 was unrecognized partition, not unallocated as I first thought, and it just wouldn't move, so we deleted it. Steps 5.1-5.3 not used.

Backup your Ubuntu data in partition 9.

Boot to the Ubuntu Live DVD or USB flash and start gparted.

  1. Right-click on partition 7 and issue a swapoff command.
  2. Right-click on partition 7 and issue a resize/move command.
  3. Drag the center of partition 7 all the way to the left. Click OK.
  4. Right-click on partition 7 and issue a swapon command.
  5. Click the APPLY checkmark icon.

5.1. Right-click on partition 8 and issue a resize/move command.
5.2. Drag the center of partition 8 all the way to the left. Click OK.
5.3. Click the APPLY checkmark icon.

  1. Right-click on partition 9, issue a resize/move command, then drag the center of the partition all the way left, then grab the partition's right-edge handle and drag it all the way to the right. Click OK.
  2. Click the APPLY checkmark icon.
  3. Quit gparted.
  4. In terminal, issue a sudo fdisk -l /dev/sda to make sure that you don't have any misaligned partitions.
  5. Reboot

Cheers, Al

heynnema
  • 70,711
  • fdisk doesn't support GPT partitions. gdisk is recommended – Elder Geek Oct 13 '16 at 15:07
  • @ElderGeek technically correct, but it does work, and it's shorter to type sudo fdisk -l than sudo gdisk -l /dev/sda (device mandatory). And I only cared about the alignment report that fdisk produces if there's a problem. Cheers, Al – heynnema Oct 13 '16 at 15:11
  • Wouldn't parted be a better choice then? http://unix.stackexchange.com/questions/247387/check-if-partitions-are-aligned-properly-for-performance – Elder Geek Oct 13 '16 at 15:16
  • Again, probably technically correct, but parted requires the use of the align-check type partition option. Still more typing. Cheers, Al – heynnema Oct 13 '16 at 15:24
  • I got to step 5. However, it doesn't let me move partition 9 to the left since the 1mb partition is next to it. – Anto Oct 22 '16 at 17:23
  • Doesn't partition 8 in your screenshot show as unallocated? If not, drag partition 8 all the way left by placing the hand icon in the center of the partition. Post a screenshot of gparted. Cheers, Al – heynnema Oct 22 '16 at 17:29
  • I added steps 5.1 and 5.2 to the procedure. Cheers, Al – heynnema Oct 22 '16 at 17:35
  • I don't know how to post pics on comments, so I made a change to the original question. – Anto Oct 22 '16 at 17:42
  • Did steps 5.1 and 5.2 help you? I go look closer at your screenshot. Cheers, Al – heynnema Oct 22 '16 at 17:54
  • Ah, partition 8 (sda8) wasn't unallocated like I thought from the first screenshot... it was unknown! Steps 5.1 and 5.2 will fix you right up. Cheers, Al – heynnema Oct 22 '16 at 17:58
  • As I said, gparted doesn't give me the option to resize partition 8, as it does with the others – Anto Oct 22 '16 at 18:11
  • You don't want to resize sda8, you want to move it. Hover the cursor over the middle of the partition, it'll change to a hand, and like you did with partition 7, you'll just drag (move) the entire partition to the left. If you can't drag it, you'll have to change the numbers down below in the resize/move window. Note the partition size, and then change the "space in front of" to zero. Recheck your partition size and make sure its the same as before. Change if need be. All the free space should be "behind" the partition. Cheers, Al – heynnema Oct 22 '16 at 18:14
  • minor re-edit of steps 5.1-5.3. Sorry. Cheers, Al – heynnema Oct 22 '16 at 18:34
  • I'm sorry, I can't resize neither can I move it. The only thing it lets me do are formatting, delete, rename, manage flags and see information. It doesn't change to a hand either. – Anto Oct 22 '16 at 18:38
  • You saw my slightly changed steps 5.1-5.3, yes? You have your data backed up, yes? I'm pretty sure that you can just delete sda8 without causing any grief. Then continue on with step 6. Let me know. Cheers, Al – heynnema Oct 22 '16 at 18:44
  • So, I just deleted partition 8 and continued the steps, and it worked. Thanks! – Anto Oct 22 '16 at 20:09