systemd如何删除自动激活的swap?

68 views
Skip to first unread message

Yu Changyuan

unread,
Dec 5, 2017, 8:18:44 AM12/5/17
to shlug
系统是有swap的,然后没有加到fstab,但systemd自动激活了。
在/run/systemd下面有诸如这样的文件:

/run/systemd/generator.late/
/run/systemd/generator.late/swap.target.wants
/run/systemd/generator.late/swap.target.wants/dev-sda2.swap
/run/systemd/generator.late/dev-sda2.swap

请问怎么去掉这些文件?

我手动swapoff,然后把swap分区格式化成非swap的文件系统。然后重启系统,好像没什么用,这些文件还在。

ps, 系统是nixos。对于从来就没有swap的机器,没有这个问题。

--
Best regards,
Changyuan

依云

unread,
Dec 5, 2017, 8:30:11 AM12/5/17
to sh...@googlegroups.com
这些是生成的文件,位于内存上,只可能是重新生成的。man systemd.swap 可以
看到,它是从 fstab 生成的。所以你的 fstab 是不是被 nixos 改回去了?

--
Best regards,
lilydjwg

Linux Vim Python 我的博客:
https://blog.lilydjwg.me/
--
A: Because it obfuscates the reading.
Q: Why is top posting so bad?

Yu Changyuan

unread,
Dec 11, 2017, 5:01:44 AM12/11/17
to shlug
fstab里面的会生成在/run/systemd/generator里面。我系统上是在 /run/systemd/generator.late 里面。

PS, 我最近gmail的stmp用不了了,所以现在才回复(在web上回的)。
> --
> -- You received this message because you are subscribed to the Google Groups Shanghai Linux User Group group. To post to this group, send email to sh...@googlegroups.com. To unsubscribe from this group, send email to shlug+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/shlug?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了 Google 网上论坛的“Shanghai Linux User Group”群组。
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到shlug+un...@googlegroups.com
> 要查看更多选项,请访问 https://groups.google.com/d/optout



--
Best regards,
Changyuan

依云

unread,
Dec 11, 2017, 8:56:30 AM12/11/17
to sh...@googlegroups.com
On Mon, Dec 11, 2017 at 06:01:35PM +0800, Yu Changyuan wrote:
> fstab里面的会生成在/run/systemd/generator里面。我系统上是在 /run/systemd/generator.late 里面。

那是其它 generator 做的?你检查一下?

> PS, 我最近gmail的stmp用不了了,所以现在才回复(在web上回的)。

Yu Changyuan

unread,
Dec 29, 2017, 5:46:08 AM12/29/17
to shlug
终于搞清楚问题了。我之前只是用mkfs.ext4重新把swap分区格式化成ext4。但这是不够的,systemd会根据gpt分区表,查找分区类型是8200的,自动激活。

所以把分区类型从8200改成8300,systemd就不自动激活了swap了。

依云

unread,
Dec 29, 2017, 6:25:50 AM12/29/17
to sh...@googlegroups.com
On Fri, Dec 29, 2017 at 06:46:04PM +0800, Yu Changyuan wrote:
> 终于搞清楚问题了。我之前只是用mkfs.ext4重新把swap分区格式化成ext4。但这是不够的,systemd会根据gpt分区表,查找分区类型是8200的,自动激活。
>
> 所以把分区类型从8200改成8300,systemd就不自动激活了swap了。

WOW 第一次见到分区类型起作用呢……

--
Best regards,
lilydjwg
Reply all
Reply to author
Forward
0 new messages