Enlarge a partition on a previous space

Hello everyone !
I've run out of storage space on my hard disk, but I noticed in the disk utility that an empty partition was available before my main partition. So the question is : How I expand my partition on this free space? Because when I look at my partition settings and go to "resize", I can only extend it forwards. Do you know how I can do it?

Here is a picture of the disk utility :

Thanks in advance!

Back It Up

To mitigate some risk, highly recommend booting into Windows and utilizing their disk management tool to safely resize your already-filled partition, so that it uses available space on either side. It is ridiculously easy to make those changes and reboot back into your ZOS installation.

  1. Open Disk Management...
    Press Win + X and select "Disk Management" from the menu, or right-click on "This PC" or "My Computer," select "Manage," then choose "Disk Management" from the left pane.

  2. Select Partition...
    Locate the partition you want to resize.

  3. Shrink or Extend Volume...
    Right-click on the partition and choose "Shrink Volume" to reduce its size or "Extend Volume" to increase its size.

  4. Follow Wizard...
    Follow the prompts in the wizard to specify the amount by which you want to shrink or extend the partition.

  5. Apply Changes...
    Once you've made your selections, apply the changes.


Note: As you stated above, I haven't previously had luck with the Linux GUIs for disk and partition management for the purposes of resizing partitions, which is why I suggested utilizing Windows' Disk Management tool. The Windows tool seems to have a much better time actually managing your disk in comparison with Linux.

If utilizing Windows is not an option for you, and if there are no additional details you can provide to further describe your problem, you might consider the following instead:

  1. Boot from Live CD/USB...
    You can't resize a partition while it's mounted, so boot from a live CD or USB containing a Linux distribution.

  2. Open Partition Manager...
    Use a partition manager tool like GParted or KDE Partition Manager.

  3. Resize Partition...
    Select the Linux partition you want to resize and choose the option to resize/move it. The particular partition you select will likely show the free space on either side of it.

  4. Adjust Partition Size...
    Drag the partition boundaries to allocate space on either side as desired.

  5. Apply Changes...
    Once you're satisfied with the partition layout, apply the changes.

  6. Wait for Process to Complete...
    Resizing partitions can take some time depending on the size of the partition and the speed of your disk.

  7. Reboot...
    After the resizing process is complete, reboot your system.


Another way that might work:

Regarding adding extra partition space to an existing partition in Linux, tools like resize2fs or lvresize have been used successfully in the past by many users... depending on their filesystem type (ext4, XFS, LVM, etc.).

Always ensure you have backups before performing disk partition operations, especially when using command-line tools.

  1. Identify the Partition...
    Determine the identifier of the partition you resized. You can use tools like lsblk or fdisk to list partitions and their identifiers. You can also find this information easily from within tools like GParted.

  2. Unmount the Partition (if necessary)...
    If the partition is currently mounted, you'll need to unmount it before resizing the filesystem. Use the umount command:

    • sudo umount /dev/sdxY...

      • Replace /dev/sdxY with the appropriate partition identifier you found in step one immediately above.
  • Resize the Filesystem...
    Use the appropriate command to resize the filesystem. For ext4 filesystems, you can use resize2fs. For XFS filesystems, you can use xfs_growfs. For LVM logical volumes, you can use lvresize followed by resize2fs or other filesystem-specific commands. For ext4 filesystem:

    • sudo resize2fs /dev/sdxY

      • Replace /dev/sdxY with the appropriate partition identifier.
  • Remount the Partition (if necessary)...
    Once the filesystem has been resized, you can remount the partition if it was unmounted earlier:

    • sudo mount /dev/sdxY /mount/point

      • Replace /dev/sdxY with the appropriate partition identifier and /mount/point with the mount point of the partition.
  • Verify Changes...
    After completing the above steps, verify that the partition and filesystem have been resized correctly using tools like df to check disk usage and lsblk to check partition sizes.

Again, it's essential to ensure you have backups of your data before performing any disk partition or filesystem operations.

Let us know if this works, and if it doesn't, can you provide further detail?

edit: I wish bullet formatting was easier on forums... :face_holding_back_tears:

4 Likes

Historically, GNU/Linux has only been able to shrink partitions. To be able to expand in GNU/Linux I believe you need to enable LVM at point of install.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.