From c16a0c302e081e0d7e391e4d6493194cef33511a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 20 Mar 2018 22:29:18 +0100 Subject: [PATCH] anaconda: enable discard option for dom0 filesystems by default This may have performance impact on some older SSD, but on the other hand, without this option it's pretty easy to fill the whole LVM thin pool even if there is plenty free space in dom0. Note that this doesn't enable it on LUKS layer, this is still disabled by default. Fixes QubesOS/qubes-issues#3226 --- anaconda/pyanaconda/kickstart.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/anaconda/pyanaconda/kickstart.py b/anaconda/pyanaconda/kickstart.py index c0db1b61..5cd86d5f 100644 --- a/anaconda/pyanaconda/kickstart.py +++ b/anaconda/pyanaconda/kickstart.py @@ -885,6 +885,10 @@ def execute(self, storage, ksdata, instClass): self.mountpoint = "" ty = None + if self.mountpoint.startswith('/') and not self.fsopts: + # enable discard for normal filesystems in dom0 + self.fsopts = "defaults,discard" + # Sanity check mountpoint if self.mountpoint != "" and self.mountpoint[0] != '/': raise KickstartParseError(formatErrorMsg(self.lineno, @@ -1245,6 +1249,10 @@ def execute(self, storage, ksdata, instClass): else: ty = storage.default_fstype + if self.mountpoint.startswith('/') and not self.fsopts: + # enable discard for normal filesystems in dom0 + self.fsopts = "defaults,discard" + if not size and self.size: try: size = Size("%d MiB" % self.size) @@ -1490,6 +1498,10 @@ def execute(self, storage, ksdata, instClass): else: ty = storage.default_fstype + if self.mountpoint.startswith('/') and not self.fsopts: + # enable discard for normal filesystems in dom0 + self.fsopts = "defaults,discard" + # Sanity check mountpoint if self.mountpoint != "" and self.mountpoint[0] != '/': raise KickstartParseError(formatErrorMsg(self.lineno,