You are not logged in.
Recently I set up zswap, and decided to shrink my swap partition and enlarge my root partition by that little bit.
However, the swap partition is before the root partition, and I can't figure out how to extend my root partition into it.
https://i.imgur.com/PKYGRla.png
How would I go about extending my root partition into that space?
Offline
get a gparted usb drive and extend it.
Offline
Note that when you want to extend a filesystem to the left, you effectively need to shift/move it the required amount left (1) and then extend it to the right (2). This takes a long time and is also what gparted does. One can manually do this using `dd' in a for-loop (3). Always, make a backup first.
Alternatively one could copy the data elsewhere, recreate the filesystem further left and copy the data back. Since you would anyways want to have a backup, this is possibly the best way.
You might also be interested in LVM, which would have avoided this issue. I assume it should even be somehow possible to convert your mbr/gpt partition to an lvm one, without the need for moving (much) data.
(1) I assume it is theoretically possible for filesystems to be extended directly to the left, but I am unaware of any tools supporting this.
(2) Not all filesystems support extending (to the right). ext4 does (and likely most).
(3) Copy in chunks sized the recently freed space. Also, update the mbr/gpt. You would want to do this with your root partition unmounted / mounted read-only.
Offline
For some context:
- you must perform this offline (ie. from a "gparted usb drive", ie. not while the system on that partition is running)
- this is probably going to take a while (since the data on the partition must be copied in-place; you cannot "just" grow the partition this direction - it's effectively re-created)
- the process is far more fragile than growing the partition the other direction.
=> figure whether that's actually worth the hassle and BACKUP IMPORTANT DATA FROM THAT PARTITION
Edit: fuck.
Last edited by seth (2020-11-27 07:53:24)
Offline