1

I want to move my unallocated space so I can expand my ext4 Linux partition. Here is what gparted shows now.

/dev/sda 465 GB

Partition   lock filesystem mount pt      size   used   free    flags
/dev/sda1   Y   FAT32       /boot/efi    260 MB  38 MB  222 MB   boot hidden esp
/dev/sda2   !   unknown                   16 MB                  mftres
/dev/sda3       bitlocker                243 GB                  msdtdata
unallocated     unallocated              124 GB
/dev/sda5   Y   linux-swap                19 GB  19 GB
/dev/sda6   Y   ext4        /             79 GB  70 GB    9 GB
/dev/sda4       ntfs                       1 GB 551 MB  449 MB   hidden diag

How do I do this? Thank you.

K7AAY
  • 17,705

2 Answers2

0

0) Changing partitions is risky. Please make a backup of your data, then verify the backup matches the source data; then backup again to a different drive or cloud, verify that matches the source, and only then start with partition changes.

00) Make one change at a time with gparted. After you specify a change (e.g., deleting the swap partition, if you decide that's OK), then click on the green check mark at top center to commit that change. Change-commit, change-commit, change-commit.

1) You can't change things unless the partition you want to change is unlocked. In this case, you must boot from a LiveDVD or a LiveUSB, such as was used to install Ubuntu in the first place.

2) If you are using Ubuntu 18.04 or newer, and you do not use Hibernation, you can eliminate the Swap Partition /dev/sda5 and give its space to /dev/sda6, then create a Swap File once you finish changing the partitions. Otherwise, if you either use Ubuntu 16.04 or older, or use Hibernation, you have to delete the Swap Partition and recreate it at the beginning of the unallocated space.

3) Once you have moved or deleted the Swap Partition, then you can move your ext4 Ubuntu partition, /dev/sda6, forward into unallocated space.

4) Once the move completes, then expand the end of the ext4 partition to occupy all remaining unused space. Thanks to heynnema https://askubuntu.com/users/4272/heynnema for the advice!

K7AAY
  • 17,705
0

Make sure that you have a good backup of your important Ubuntu files, as this procedure can corrupt or loose data.

Keep these things in mind:

  • always start the entire procedure with issuing a swapoff on any mounted swap partitions, and end the entire procedure with issuing a swapon on that same swap partition

  • a move is done by pointing the mouse pointer at the center of a partition and dragging it left/right with the hand cursor

  • a resize is done by dragging the left/right side of a partition to the left/right with the directional arrow cursor

  • if any partition can't be moved/resized graphically, you may have to manually enter the specific required numeric data (don't do this unless I instruct you to)

  • you begin any move/resize by right-clicking on the partition in the lower pane of the main window, and selecting the desired action from the popup menu, then finishing that action in the new move/resize window

Do the following...

Note: if the procedure doesn't work exactly as I outline, STOP immediately and DO NOT continue.

  • boot to a Ubuntu Live DVD/USB
  • open a terminal window by pressing Ctrl+Alt+T
  • type sudo fdisk -l
  • identify the /dev/sdXX device name for your "Linux Filesystem"
  • type sudo fsck -f /dev/sda6, replacing sdXX with the number you found earlier
  • quit fdisk
  • start gparted
  • move /dev/sda5 left
  • move /dev/sda6 left
  • resize /dev/sda6 right side to the right
  • click the Apply icon
  • wait for it to finish, then quit gparted
  • reboot
heynnema
  • 73,649