Fallocate failed: Invalid argument/No space Left on device

Hello all, I've been trying to increase my swap space as outlined in the tutorial from this forum.

When trying to increase my existing swapfile, the following happens:

user@AntiClover:~$ swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/dm-2 partition 1,9G   0B   -2
user@AntiClover:~$ sudo swapoff /dev/dm-2 
[sudo] password for user:                       
user@AntiClover:~$ sudo fallocate -l 16G /dev/dm-2
fallocate: fallocate failed: Invalid argument

I also tried using fallocate -x -l 16G after reading this answer; It doesn't print an error, but it appears to have no effect.

After hitting a wall, I thought of creating a new, bigger swapfile instead and deleting the old one. However, this happens:

user@AntiClover:~$ sudo fallocate -l 16G /dev/dm-3
fallocate: fallocate failed: No space left on device

However, I do still have enough space on my drive to house a 16 Gigabyte file:

user@AntiClover:~$ df -h
Filesystem                Size  Used Avail Use% Mounted on
tmpfs                     1,6G  2,3M  1,6G   1% /run
/dev/mapper/vgzorin-root  914G  649G  219G  75% /
tmpfs                     7,8G  808K  7,8G   1% /dev/shm
tmpfs                     5,0M     0  5,0M   0% /run/lock
efivarfs                  192K  158K   30K  84% /sys/firmware/efi/efivars
/dev/nvme0n1p2            1,7G  342M  1,2G  23% /boot
/dev/nvme0n1p1            511M  6,1M  505M   2% /boot/efi
tmpfs                     1,6G   45M  1,5G   3% /run/user/1000

I thought maybe dm-2 links somewhere and that's why there's no space, but it doesn't appear so.

user@AntiClover:~$ readlink -f /dev/dm-2
/dev/dm-2

I also tried resizing /dev/vgzorin/swap_1 after seeing that GNOME Disk listing it, but with the same results.

Did I miss something? What else could I try to either increase my existing swapfile, or create a new, bigger one? Thanks in advance for any help!

The problem is in the location you are trying to set swapfile. /dev directory is reserved for device files only. /dev/dm-3 probably reserved for some specific device and its size can't be increased.

I will suggest to create the swapfile in a different place, either directly under root (/swapfile) or in /mnt (/mnt/swapfile)

Try with:

sudo fallocate -l 16G /swapfile

Or

sudo fallocate -l 16G /mnt/swapfile

And then follow along with the rest of your tutorial.

5 Likes

That file doesn't exist yet and I was trying to create it, not increase it's space, but I understand your point.

I created my new swapfile at the root of the device as you suggested and it works as intended. Thanks a lot for the help!! :grinning_face_with_smiling_eyes:

1 Like

This is why I prefer manual partitioning when installing any GNU/Linux. :wink:

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