You are not logged in.

#1 2015-01-05 10:06:10

krork
Member
Registered: 2013-06-08
Posts: 29

[SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Hi,
I created a swap partition as part of setting up a Linux From Scratch installation, and it was intended for that system only. However it is automounted every time I boot my arch.

It is neither mentioned in my fstab or my mtab. I tried # swapoff , and that disables it for that instance, but after boot it's mounted again. Tried giving it an fstab entry with the noauto option.

Last edited by krork (2015-01-05 18:11:24)

Offline

#2 2015-01-05 10:13:01

thearcherblog
Member
Registered: 2014-10-30
Posts: 165

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Not expert at all but if you check your systemd-analyze blame (or list all the services running) you can check if you have something like *mount.service

I hope it helps smile

Offline

#3 2015-01-05 11:33:27

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,731
Website

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Systemd does it for you.  Not sure how to disable it.  Google it and let us know.

Offline

#4 2015-01-05 12:49:38

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,893

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Krork,

http://www.freedesktop.org/wiki/Specifi … tionsSpec/ may help to understand how systemd does swap automounting.

There appear to be 2 workarounds to avoid it :

- Use MBR disks instead of GPT
- put the swap partition on a different drive then the / - partition .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2015-01-05 16:49:53

krork
Member
Registered: 2013-06-08
Posts: 29

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Thanks Guys!

I have not yet found a way to stop systemd from automounting the swap partition. I'm a bit busy this January. However, as a workaround I created a swapoff.service file in /etc/systemd/system with this content:

[Unit]
Description=Turns off Swap Partition
DefaultDependencies=no
After=getty.target
[Service]
ExecStart=/usr/bin/swapoff /dev/sdaX

[Install]
WantedBy=multi-user.target

Replace the /dev/sdaX with your according partition, of course.

Edit: Also you'll want to enable it: # systemctl enable swapoff.service

So in case anyone else is having this problem and just wants a dirty fix, this worked for me, for now. If I find out how to keep systemd from automounting in the first place I'll let you know.

Last edited by krork (2015-01-05 16:50:33)

Offline

#6 2015-01-05 17:19:55

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,731
Website

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Work around is nice... Why do you want earmark the swap partition for a specific distro and not for Arch?

Offline

#7 2015-01-05 17:27:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

graysky wrote:

Why do you want earmark the swap partition for a specific distro and not for Arch?

I'm also curious about this.  I never use a swap partition or file - but the presence of one should do no harm.  If it is there and memory is swapping to much this could be undesirable, but this can be adjusted through 'swapiness' settings to a point that it would only ever be used if you really were completely out of memory.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2015-01-05 17:38:07

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,952
Website

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

I think the proper way could be this

systemctl mask dev-sdaX.swap

Offline

#9 2015-01-05 18:03:20

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

Why do you want earmark the swap partition for a specific distro and not for Arch?

One reason to do so could be if hibernation is used for the other system. The hibernation image is stored on the swap and you wouldn't want to touch it then.

I think ugjka is suggesting the correct way. Would be nice to know if it works as well.


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#10 2015-01-05 18:10:01

krork
Member
Registered: 2013-06-08
Posts: 29

Re: [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

ugjka wrote:

I think the proper way could be this

systemctl mask dev-sdaX.swap

Thanks ugjka, this works!

As for why I think I needed this: I do have low swappiness and memory still swaps sometimes. However, the swap partition I created for LFS is at the opposite end, physically speaking, of my hard drive to my arch. So when memory swaps I think my hard drive starts writing to and from its opposite ends, making sounds like it's battling a rat.

It also took very long and made everything very slow.

I'm really not sure whether this is true, but I'm a vegetarian and prefer my hardware to not battle rodents.

Offline

Board footer

Powered by FluxBB