Hello,
In the picture above I want to move the swap partition (sda6) to the end of the disk and the boot partition (sda5) to the beginning of the disk.
The goal is to have continuous partitions (sda1 and sda7) in my dual boot set up (Manjaro Xfce/MX Linux Xfce) so I can resize/shrink sda1 and resize/expand sda7.
I’ve tried using gparted on live usb and I can’t move those partitions (swap and boot).
The unallocated space I get from shinking sda1 can’t be moved to the end and thus expand sda7.
You can’t move free space - or freed up space.
You need to shrink the partition, to then have space to relocate what you want to relocate to that freed up space.
This doesn’t make sense for swap.
Just make space and create new swap - re-use the space the “old” swap was in.
I do not advise moving/shrinking sda1 from the left, since it is the root and that might cause problems. Leave it be. Delete swap and ESP. Shrink sda1 from the right side. Move sda7 to the left until it touches sda1. Since it is only media partition, moving it should in theory be safe. Evtl. shrink or expand sda 7 to the right, so that you have 300-400-500 mb for ESP and maybe 11-12 GB for swap if you have 8 GB ram and maybe decide to use hibernation in the future. Recreate the swap, partition type swap (leaving space for ESP, obviously). Recreate the ESP after the swap to the right, which means at the far right till the end of the disk. It has to be fat, with flags esp AND boot. Apply all the changes.
Note the new uuid-s of the recreated or moved 3 partitions (sda7, swap and esp)
Edit the /etc/fstab and put the new UUIDs (depending of your config, maybe edit systemd mountpoints, or the grub bootline if you use hibernate)
Finally, chroot (it should work after updating the uuid in the fstab)reinstall GRUB
p.s. and what i forgot (thx Andreas) was the UUIDs in the fstab and bootline
Only yesterday - perhaps the day before - I played with the consequences of moving the root partition to the right - and I failed.
I couldn’t boot the system afterwards - even KDE partition manager ensured the same UUID - no boot.
It is fairly easy to shrink a partition and move it to the left - but moving the the right - should be avoided - all data need to be shifted to the right - making data loss a highly probable and likely the outcome.
When fiddling with partitions - you are actually deleting the partition and recreating it with new boundaries.
Swap is the least of your problems - you can do a swapoff /dev/sda6 and remove the partition - but the other partitions
It would require the software to
remove the $esp and the swap.
move the first partition to the right!!
which requires shifting all data
data loss is likely to occur
moving the remaining partition to the left
recreate $esp partition in the beginning
creating a new swap at then
You will get into so much trouble - that I would suggest a full backup of your data then reinstall a single system.
To avoid dealing with UUIDs you can use labels to identify the partitions in fstab e.g.