From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: fstrim and SSDs and cron; was: Re: cron-service Date: Wed, 18 May 2016 11:50:46 +0300 Message-ID: <20160518085046.GB13276@debian-netbook> References: <20160430192744.1fbe081f@scratchpost.org> <871t5lc432.fsf@gnu.org> <20160517192857.0bab0560@scratchpost.org> <87zirotm2n.fsf@gnu.org> <20160518072118.6039bd22@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="eRtJSFbw+EEWtPj3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2xC6-0007Pl-8A for guix-devel@gnu.org; Wed, 18 May 2016 04:51:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2xC0-0007L0-B4 for guix-devel@gnu.org; Wed, 18 May 2016 04:51:05 -0400 Content-Disposition: inline In-Reply-To: <20160518072118.6039bd22@scratchpost.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Danny Milosavljevic Cc: guix-devel@gnu.org --eRtJSFbw+EEWtPj3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 18, 2016 at 07:21:18AM +0200, Danny Milosavljevic wrote: > > I had never thought of it, but maybe it=E2=80=99s a good idea. How do = other > > distros handle it? >=20 > On they say: > >Ubuntu 14.10 onwards: > >In Ubuntu 14.10 and 15.04, TRIMming happens automatically every week on = all SSDs supported by fstrim. > >$ tail -n1 /etc/cron.weekly/fstrim=20 > >/sbin/fstrim --all || true >=20 >=20 >=20 >=20 > >Automatic TRIM (Deprecated, Slow): > > [fstab...] >=20 > >Encrypted Filesystems > >The last step is not enough though. As long as LUKS is not aware that yo= u want to use TRIM it will effectively block all TRIM operations coming fro= m the LVM partition's file system, for security reasons. Add discard parame= ter to the cryptdevice options in /etc/crypttab to make LUKS accept the dis= card behavior of the LVM partition. > >sda5_crypt UUID=3De364d03f-[...]6cd7e none luks,discard >=20 > More info about the latter: >=20 > http://blog.neutrino.es/2013/howto-properly-activate-trim-for-your-ssd-on= -linux-fstrim-lvm-and-dmcrypt/ >=20 > Note that guix /gnu/store/8vg9124cgm8d36zsy9ldcw53b1vrfy2w-lvm2-2.02.109/= etc/lvm/lvm.conf explicitly disables (!) "discard". >=20 I have an SSD in my netbook, and I've had it a bit more than 4 years now. According to the smart data, it's been powered on for ~18,000 hours, and recently I saw the drive life percentage used counter tick =66rom 2 to 3%, somewhere around 90 full disk writes. When changing data: Read block A, Write block B. With "dirty" block B: Read block A, Scrub block B, Write block B. Trim goes and scrubs all the now unused blocks so that they're ready for use. In many cases (aka not my machine, which is cpu bound on reads/writes) reading/writing to an SSD is limited by the SATA port's speed and the HDD based protocol. By trimming regularly (for me somewhere between weekly and monthly) you can save the bandwidth-limited transactions to the SSD for actual writes if you trim ahead of time. If we wanted to automatically trim for people without making mcron and its service part of %base-packages or %desktop-services we could add it as a hook before/after a `guix pull', but that seems too intrusive to me. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --eRtJSFbw+EEWtPj3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJXPCzfAAoJEPTB05F+rO6TbGMP/3DDfxYqFpiOVDGmF8eJpKqL ssFyqwdM5f+od4Wg1OP4gzpo9n6HafYnUkztrjiat9kRW4bm/KmqLhbhvHNEPAzp F7v5yWcx6eBqKM09Y08lT4Gq4OMZ50usfQ9bj6PkYSkdsEW70kfHee1C5C9yBQLp 73lFc3ylbtZZhn0u7JZPxVHjhfnU/jE2zPHgSMUIWUXRK/H137LVfHJbMW9l2YKR dY55K0wEXo+dsILj3o32wd4n0DBdqSTZHRbg+DXX+Q6UqcVd7LT5p10ivqzV9YHx pKjHQQie2+tTDjDFSZ8otltXQhh4gFG3WrJukgH5hPygKczhOax6MhdRmHVL1+TE mKnewOzqK+Qt8kaz2b6o7PmC11ZOry7B6S6lyAmjYzN5HowVpJML7cwbKj4xQbY9 f67CGdAgXcDU/XQe5fqstSfaYAr+rB8ULevyre9cyAqlpPnsENDBuOt19KXEYPUg 3Hz4Gn3Gn8jmLGXuQn/b4ycmmtFoSbwfVM0AoQw2oRZhI6bM5R7GqL9bT40KhFGu 5v0lnqxs4D5WKqwKX/DAp+SX8N9t5/c1nhvDouzp/v3gZNS4ZuB1ekXBYiIIJLKg UJd9O6U3h3O96uK8NFiYk0vYb+twfpzSqYOvTwBMh44Sd3U7yh7LCScVhzmyHZWi PB8ocpjs+CaXuYL/uJKq =MuCv -----END PGP SIGNATURE----- --eRtJSFbw+EEWtPj3--