From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAD1FC4361B for ; Sun, 20 Dec 2020 11:45:17 +0000 (UTC) Received: from mail.server123.net (mail.server123.net [78.46.64.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4246522D50 for ; Sun, 20 Dec 2020 11:45:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4246522D50 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=countermail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-crypt-bounces@saout.de X-Virus-Scanned: amavisd-new at saout.de Authentication-Results: mail.server123.net (amavisd-new); dkim=pass (1024-bit key) header.d=countermail.com Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=158.174.5.46; helo=webmail.countermail.com; envelope-from=mistave@countermail.com; receiver= X-Greylist: delayed 499 seconds by postgrey-1.37 at siona; Sun, 20 Dec 2020 12:44:23 CET Received: from webmail.countermail.com (db1.countermail.com [158.174.5.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Sun, 20 Dec 2020 12:44:22 +0100 (CET) Received: from smtp.countermail.com ([158.174.5.46]) by webmail.countermail.com (Postfix) with ESMTPA id BE719605E3CA for ; Sun, 20 Dec 2020 12:36:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 webmail.countermail.com BE719605E3CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=countermail.com; s=default; t=1608464163; bh=J+Q+9Ie2SCASo9JhEA9FCL2y8bTrv90gp+FFWcwF72E=; h=To:From:Subject:Date:From; b=aiPVxB30+7Z5VQQ2viPR/3CgogQrjd9p8CAT2fRq+7CBy8oD/0H4nq6pTSOdMG4Pe AdAM3u5YwXZM7JeYf1gh6CROi5k9BijbqMPdU1fvOkIefW8ojZR0T12FKUsyk9Nyya OaOlxKezv3zDLGKkLjsz9sS2s5rWfKAH7YVACGKI= To: dm-crypt@saout.de From: Mistave Autocrypt: addr=mistave@countermail.com; keydata= mQENBFC6N5ABCACT/6LYkViesTff33gFzqzii2sdOi07er31P3MfMgetejDACIbuU3uRzapZ gGPRQtiyKcsyzNf7JkmFW+IvcOZEnZBGCaYClkrCHpHw10VR8E6GSIuNdGit9WOMd3gJChj8 KDxeZyzOo70svWtwcvfPvZfEANmgI4A2fiuuc/e9fTc4uOvI0fRH61wszSadQ2b1Dz8EJa1c DeWEmB4NYsXWJ5qLkyT4TwuVFc530X1EUdu3+eC34tT0iMozFNakoKAKTlHyONRVHEntFwoD r3VMSEb5DwWIjTuoCEepkdRJ0aKKeCx38Nkll+yc4i3qo9LkUa79Le/3sFeSwpq7P73xABEB AAGJATcEHwECACEFAlC6N5ACBwEXDIABv5BSpDSPFGRNcdTsQhGqt9CgPCMACgkQxCNglXGX UuVsbwf/baq4k1WJCvgQx+scrE5wWNngR6LW7kC1Yubv6Uk1rgik7ZA0uo+1OfzpOWS+v/fY 2jo29niioPfClR5w68Pvn024Y6HJ+sOyb2oIwy/Qn+/9lhbclRsDBEtFENUmE5lJQ19rn0eN e77T7uw1xKqscUfQahOoYvnqdp2xFx5FnNgYRSSbHRNgtOdykRBmgA+WC5xyBxxPseUJJaZq regGanTipbBs9apu7cmqxLZKhjc3tBeV2S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w+s9Dq2lz97/akQfwH0PWj8WUkxhvAw7yR8wHlDAZoMvz LJO7Y/3pXQ1slyehlaFTSa1Hf63fqYn0Ls5mtPH1MpNDLdCZya4eM6eb5JlohkHv4I7SC3qm 15LZJhn5MEhakjQ5NfhFT1jMTt4RWMGTjq/tbT1WCpjpcziwKDhOSN4ESAWRNv8gh93b5cOr uXT1VJOOiLZbAb7nWTTpDLdLA7tp5eE/8D1mKA== Message-ID: <1e91347d-24ba-a387-e148-b3dd96bf0adc@countermail.com> Date: Sun, 20 Dec 2020 12:36:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US Subject: [dm-crypt] Properly enabling TRIM for dm-crypt on an SSD X-BeenThere: dm-crypt@saout.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dm-crypt-bounces@saout.de Sender: "dm-crypt" Hello! I have some questions about the TRIM/discard for LUKS-encrypted SSDs. I currently have a custom Ubuntu 20.04 LTS setup with encrypted ext4 rootfs partition (it's /dev/sda2 and /dev/sda1 is the EFI partition) on an HDD that I'd like to migrate to an SSD. I was originally going to do a block-for-block copy using dd, but I figured it'd be better and faster to copy just the files from rootfs and the EFI partition rather than the entire disk. So I'm going to setup a new LUKS volume (same parameters) on the SSD and then sync the filesystem contents over there. This got me thinking about optimizing the system for SSD since it was originally installed on an HDD. While googling for information I found out about two types of TRIM: continuous and periodic. The docs say that the continuous mode is activated by adding a "discard" parameter to the rootfs mount options in /etc/fstab or by activating a certain flag by tune2fs. The periodic mode is activated by placing the fstrim utility on a timer i.e. a weekly cron job or systemd timer. I noticed the latter is already active on my system. Anyway, I was wondering how this is handled when dm-crypt lies between the SSD and the filesystem. Do I need to take any additional steps in this case or will fstrim do its thing as is? I'm just checking because there is so much contradicting information available online. Some people mentioned that a "discard" parameter should be added to /etc/crypttab entry, others claim they must be present on both files - fstab and crypttab. Some even suggest to add an "allow-discards" parameter to the GRUB kernel command line in /etc/default/grub file. I was also told that the continuous TRIM is discouraged and that periodic should be used instead. What's the correct thing to do here? Thanks in advance. _______________________________________________ dm-crypt mailing list dm-crypt@saout.de https://www.saout.de/mailman/listinfo/dm-crypt