Score:0

How do disable a Swap partition to use Free space?

al flag

Hello I'm new at using Ubuntu. I'm using a Virtual box to run Ubuntu but I ran out of storage space so I added more storage to the Virtual box.

My issue here is that I cannot allocate the unallocated space to my Filesystem partition. From what I read is because I have a "Swap partition 2" between the Filesystem and the Free Space partitions.

I have read about using:

sudo swapoff /swapfile

But it says it cannot find the file. I also read that it may be dangerous to remove the partition so I wanted to know what's the best way to solve this issue.

Terrance avatar
id flag
Use `sudo swapoff -a` to disable all swaps, even if it is a partition. `/swapfile` is a file and not a partition.
heynnema avatar
ru flag
[Edit your question](https://askubuntu.com/posts/1345916/edit) and show me a screenshot of `gparted` when looking at your disk, and `grep -i swap /etc/fstab`.
Diego Pinto avatar
al flag
Thank you this worked!
Score:0
mx flag

If you have a swap partition it is not called /swapfile. Run the command swapon to see the ame of the sawp-partition.

Then run sudo swapoff /dev/sdxx where /dev/sdxx is the result from the command above.

You can then go on deleting the swap partition and expand your disk space.

You might also want to create a new swap space. You can look up how to create a swapfile. And remember to update /etc/fstab with the new swap information.

heynnema avatar
ru flag
Your answer lacks specific detail on how to do what you suggest.
Soren A avatar
mx flag
@heynnema it should be enough to get OP over the point he was stranded on ...
heynnema avatar
ru flag
OP says *"Swap partition 2"*, which suggests either LVM, or multiple swap partitions. Without asking the OP questions, you don't know what the configuration is, so it may not be as simple as you begin to suggest... esp for a new OP.
Soren A avatar
mx flag
@heynnema in my world it indicates that partition 1 is the os partition he tries to expand, and partition 2 is the one bnlocking for him to expand into the newly added space, eh. like /dev/sda1 and /dev/sda2. Anyway, the output of `swapon` will tell name(s) and number of swap spaces,
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.