From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 998F7138350 for ; Sun, 26 Apr 2020 16:15:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C594CE0A94; Sun, 26 Apr 2020 16:15:54 +0000 (UTC) Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3941EE09DE for ; Sun, 26 Apr 2020 16:15:54 +0000 (UTC) Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 96B34160063 for ; Sun, 26 Apr 2020 18:15:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1587917752; bh=Yix9dme4cwzNE57owxTpfyYJkJfKbc4p88RlAQ3qNcQ=; h=Date:From:To:Subject:From; b=rkaf6TA/uuDESEA+MQGE03Uwk1DEO5QYSnh9zGs0vq9JVf1oiXNsHhszDVFdOr63s +jW35t5C6VUw6Y4E8z6m8/oMGRebRRQMeCfj0AnoAIjOSfgGZQ8r2oTMKlEvjVJjvw DS8Uh1rTqZHpuuNeruz+eAp6A2Sk+hvvvgttlzZTyVgXggdXWzQp3JSLi+drxD/mDh MQqWfBipQwINnyKzhl6qAjsbnCTOwCOWU+0+Alc5Yopn+ffqf7vdh/dKiHMHqbttHN iTCiKFF3MTTjt11hx771Hje0WFeGL1naIEHjYPcEREpROaMb/D0JDXaFE+S8D+M7lV xWI8WuiUwiXTQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 499Cgr0ZCtz9rxy for ; Sun, 26 Apr 2020 18:15:51 +0200 (CEST) Date: Sun, 26 Apr 2020 18:15:51 +0200 From: tuxic@posteo.de To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] "Amount" of fstrim? (curiosity driven, no paranoia :) Message-ID: <20200426161551.fmzwvoepd2tzbrrr@solfire> Mail-Followup-To: gentoo-user@lists.gentoo.org References: <20200426145247.xfiznqxbmq2m5bem@solfire> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Archives-Salt: 62ef99b4-804f-4cb8-bf88-5fe1bfd59fb6 X-Archives-Hash: 096d80bb258d973dd29fa92f526059bb On 04/26 11:20, Rich Freeman wrote: > On Sun, Apr 26, 2020 at 10:52 AM wrote: > > > > Fstrim reports about 200 GiB of trimmed data. > > > > From the gut this looks quite a lot -- the whole > > partition is 256 GB in size. > > > > Smartclt report for the drive: > > Data Units Written: 700,841 [358 GB] > > > > Each week 200 GiB fstrimmed data for a partition of > > 256 GB in size and since the beginning I have written > > only 358 GB to it. > > > > How does this all fit together? > > It doesn't fit together, because the amount of space trimmed has > nothing to do with the amount of data written. > > How much free space is there? I would think that fstrim would just > trim all unused blocks on the filesystem. Unless it maintained state > it would have no idea what has changed since the last time it was run, > so if you ran it 10 times in a row it would trim 200GiB each time. > > Unless your NVMe is brain-dead the only real downside to running it > more often is the IO. If you trim 200GiB of data 100x in a row the > 99x after the first one should all be no-ops if the drive is > well-designed. An fstrim should just be a metadata operation. > > Now, not all flash storage is equally well-implemented, and I suspect > the guidelines to avoid running it often or using discard settings are > from those who either have really cheap drives, or ones from a long > time ago. A lot of linux advice tends to be based on what people did > 10+years ago, and a lot of linux design decisions get made to > accommodate the guy who wants everything to work fine on his 386+ISA > and SGI Indigo in his basement. > > My suggestion would be to run fstrim twice in a row and see how fast > it operates and what the results are. If the second one completes > very quickly that suggests that the drive is sane. I'd probably just > run it daily in that case, but weekly is probably fine especially if > the drive isn't very full. > > -- > Rich > Hi Rich, thanks for explanation. My observations does not fit with your explanation, though. Early in the morning I did a fstrim, which results in the 200GiB of freed data. Base on you posting I did a fstrim now with no wait in between: host:/root>fstrim -v / /: 3.3 GiB (3578650624 bytes) trimmed host:/root>fstrim -v / /: 0 B (0 bytes) trimmed This time the first fstrim reports a small mount of trimmed data and second one no fstrimmed data at all. The SSD is a ADATA Technology Co., Ltd. XPG SX8200 Pro PCIe Gen3x4 M.2 2280 Solid State Drive (rev 03) (cut'n'paste from `lspci`) host:/root>df -h / Filesystem Size Used Avail Use% Mounted on /dev/root 246G 45G 189G 20% / Cheers! Meino