Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] mkswap error on new installations? (Read 5297 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] mkswap error on new installations?

When I try to run this on new installations:
Code: [Select]
mkswap /dev/sda3
I get this error:
Code: [Select]
mkswap: error: /dev/sda3 is mounted: will not make swapspace
I seem to fix this with swapoff /dev/sda3, but I just want to know if this is normal for new installations, if not, what might be causing it?


Re: mkswap error on new installations?

Reply #2
the output of lsblk is:
Code: [Select]
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT 
sda      8:0    0 238.5G  0 disk
├─sda1   8:1    0     1G  0 part /boot
├─sda2   8:2    0    30G  0 part /
├─sda3   8:3    0     2G  0 part [SWAP]
└─sda4   8:4    0 205.5G  0 part /home

and the contents of fstab are:
Code: [Select]
# Static information about the filesystems. 
# See fstab(5) for details.
 
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=ea736870-1e61-4510-af54-94d884057cb5       /               ext4            rw,relatime     0 1
 
# /dev/sda1
UUID=A6AD-3678          /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro    0 2
 
# /dev/sda4
UUID=e08c421d-d76a-41f9-81db-04cc0572a936       /home           ext4            rw,relatime     0 2
 
# /dev/sda3
UUID=16436cb8-158f-44bf-8a96-dfbe5605bb2c       none            swap            defaults        0 0
 

Re: mkswap error on new installations?

Reply #3
Ah, I wasn't very specific at first, when I said "new installations" what I really meant was "during installation"

Re: mkswap error on new installations?

Reply #4
Both the partition table and the fstab look normal. My guess is the installer finds the swap partition and automatically activates it. Since you haven't provided full details in your original post, I'll assume you keep the same partition table and make re-installations on /dev/sda2, but if you intend to swap on /dev/sda3 which is type swap anyway why then would you want to run mkswap on it?

Re: mkswap error on new installations?

Reply #5
I had to reinstall artix linux a few times, so I made a new gpt partition table and created new partitions for it, this includes a new swap partition, and everytime I had to format the swap with mkswap I kept receiving the error that it's already mounted, so I always had to do swapoff first, i'm still kinda new to this so do I not have to run mkswap on /dev/sda3 when reinstalling? is it redundant?

Re: mkswap error on new installations?

Reply #6
If you create a swap partition during install it will be used automatically. It was active when you tried mkswap. For this reason you had to unmount it.