diff --git a/pyanaconda/install.py b/pyanaconda/install.py index a11b6b43b65..324e136c749 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -211,6 +211,17 @@ def doInstall(storage, payload, ksdata, instClass): wait_for_entropy=entropy_wait_clbk) turn_on_filesystems(storage, mount_only=flags.flags.dirInstall, callbacks=callbacks_reg) + + # For autopart, actual partition related objects (especially + # blivet.format.FS objects) are created by the above call. And autopart + # does not provide any way to specify default mount options (unlike manual + # partitioning). Because of this, patch it now to add 'discard' option. + if storage.root_device.format.options and \ + 'discard' not in storage.root_device.format.options: + storage.root_device.format.options += ',discard' + else: + storage.root_device.format.options = 'defaults,discard' + payload.writeStorageEarly() # Run %pre-install scripts with the filesystem mounted and no packages diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index c0db1b6145c..5cd86d5fb24 100644 --- a/pyanaconda/kickstart.py +++ b/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,