2

I have a dual boot machine with Windows 10 and Ubuntu 16.04 LTS.

I want to allocate my space to my home partition but I have to move my Linux Swap Partition.

How can I do it?

Here are my partitions before I shrink C volume in windows:

Partitions before C drive shrink:

enter image description here

Here it's my partition now with no allocate space:

No allocated partition:

enter image description here

3 Answers 3

3

Use swapoff to deactivate the swap partition.

Note that once deactivated, the swap partition can also simply be deleted (and removed from /etc/fstab), because it really just stores temporary data. Later you can create a new empty swap partition of the desired size and activate it again.

1
  • I did that. But I can't expand the partition now... It says that I don't have free space to expand my home partition... Commented Feb 21, 2021 at 15:58
0

The unallocated space that you have created follows partition /dev/nvme0n1p3 which is the Windows partition. I assume that you wish to resize /dev/nvme0n1p7 which is the Linux partition of /.

To do that, you need to move the unallocated space to follow /dev/nvme0n1p7. You can do that by moving left (up) the partitions of /dev/nvme0n1p6 (linux-swap) and /dev/nvme0n1p7 itself.

Once the unallocated space follows /dev/nvme0n1p7, then you may extend it over this space.

As an error during such an operation can be disastrous, I suggest to take good backups before starting, even taking a backup image of the entire disk (if you have enough external disk space).

0

Gparted only showed grow the swap to the right and moving the beginning to be possible, even when deactivating the swap (swapoff).

What allowed the move was to also close the currently active LUKS volume which the swap was placed on (right click on the swap in gparted and close encryption).

This moving without size change should be safe for the LUKS volume in it because moving an encrypted value is invisible to LUKS. Even expanding should be okay (though you then have to expand the LUKS volume inside it, or let gparted do it) and for shrinking you or the program (like gparted) first needs to shrink what's inside and then shrink the partition.

If you want the swap to work again afterwards without rebooting, you have to decrypt the partition again to the same name (the name in /dev/mapper/<name_here>) it used before and then activate the swap on the decrypted luks volume again.

New contributor
xuiqzy is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .