You are not logged in.
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
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 ![]()
Offline
Systemd does it for you. Not sure how to disable it. Google it and let us know.
Offline
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
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
Work around is nice... Why do you want earmark the swap partition for a specific distro and not for Arch?
Offline
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
I think the proper way could be this
systemctl mask dev-sdaX.swapOffline
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
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