Hi,
I am confused about whether I should use TRIM or DISCARD on my laptop.
I use LVM on top of LUKS and I do make frequent use of snapshots. Merging them to my root volume.
I have a regular HDD and not a SSD.
Will enabling TRIM and DISCARD help me?
If so, how do I do that ? I have already tried enabling:
issue_discards=1
in /etc/lvm/lvm.conf and then dracut -f
But fstrim -v / still fails with :
fstrim: /: the discard operation is not supported
So how do I enable it in Fedora32 ?
On 11/23/20 12:07 AM, Sreyan Chakravarty wrote:
I am confused about whether I should use TRIM or DISCARD on my laptop.
I use LVM on top of LUKS and I do make frequent use of snapshots. Merging them to my root volume.
I have a regular HDD and not a SSD.
Will enabling TRIM and DISCARD help me?
No, it won't.
If so, how do I do that ? I have already tried enabling:
issue_discards=1
in /etc/lvm/lvm.conf and then dracut -f
But fstrim -v / still fails with :
fstrim: /: the discard operation is not supported
So how do I enable it in Fedora32 ?
There's nothing to enable. As it says, your LV and hard drive don't support discard.
However, I believe that it is useful for thin LVs, so after you've done the conversion, it's something you could try.
On 23/11/2020 16:47, Samuel Sieb wrote:
On 11/23/20 12:07 AM, Sreyan Chakravarty wrote:
I am confused about whether I should use TRIM or DISCARD on my laptop.
I use LVM on top of LUKS and I do make frequent use of snapshots. Merging them to my root volume.
I have a regular HDD and not a SSD.
Will enabling TRIM and DISCARD help me?
No, it won't.
If so, how do I do that ? I have already tried enabling:
issue_discards=1
in /etc/lvm/lvm.conf and then dracut -f
But fstrim -v / still fails with :
fstrim: /: the discard operation is not supported
So how do I enable it in Fedora32 ?
There's nothing to enable. As it says, your LV and hard drive don't support discard.
However, I believe that it is useful for thin LVs, so after you've done the conversion, it's something you could try.
Do you think that last statement may be a bit confusing if he only has a HDD?
--- The key to getting good answers is to ask good questions.
On Mon, 23 Nov 2020, 3:07 pm Ed Greshko, ed.greshko@greshko.com wrote:
Ahhh, never mind. It may be useful/supported with thin LV.
Can someone tell me why these commands are useful ?
Does thin LVMs have problems deleting data?
On 23/11/2020 19:23, Sreyan Chakravarty wrote:
On Mon, 23 Nov 2020, 3:07 pm Ed Greshko, <ed.greshko@greshko.com mailto:ed.greshko@greshko.com> wrote:
Ahhh, never mind. It may be useful/supported with thin LV.
Can someone tell me why these commands are useful ?
Does thin LVMs have problems deleting data?
No. I think you need to check out https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/htm... to see the use cases for thin-provisioned lvm storage.
What I see as a key phrase in that document is:
To make sure that all available space can be used, LVM supports data discard. This allows for re-use of the space that was formerly used by a discarded file or other block range.
And that would be when "fstrim" would be useful.
--- The key to getting good answers is to ask good questions.
On Mon, Nov 23, 2020 at 3:07 PM Ed Greshko ed.greshko@greshko.com wrote:
Ahhh, never mind. It may be useful/supported with thin LV.
I am completely confused.
Are you sure TRIM and DISCARD are needed for normal HDDs ?
because whatever I find on the internet says that I should use that when I have a SSD.
On 25/11/2020 16:44, Sreyan Chakravarty wrote:
On Mon, Nov 23, 2020 at 3:07 PM Ed Greshko <ed.greshko@greshko.com mailto:ed.greshko@greshko.com> wrote:
Ahhh, never mind. It may be useful/supported with thin LV.
I am completely confused.
Are you sure TRIM and DISCARD are needed for normal HDDs ?
because whatever I find on the internet says that I should use that when I have a SSD.
The difference here is the "thin-provisioned" lvm. In this case the Trim/Discard isn't being used to extend or improve the performance of the underlying hardware. It is being used to free/return unused blocks to the "pool".
--- The key to getting good answers is to ask good questions.
On Wed, Nov 25, 2020 at 2:48 PM Ed Greshko ed.greshko@greshko.com wrote:
The difference here is the "thin-provisioned" lvm. In this case the Trim/Discard isn't being used to extend or improve the performance of the underlying hardware. It is being used to free/return unused blocks to the "pool".
The question is how do I enable it ?
I don't think TRIM is supported since 'hdparm' gives me the following output:
$ hdparm -I /dev/sda
Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Standby timer values: spec'd by Standard, no device specific minimum R/W multiple sector transfer: Max = 16 Current = 16 Advanced power management level: 128 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 Cycle time: min=120ns recommended=120ns PIO: pio0 pio1 pio2 pio3 pio4 Cycle time: no flow control=120ns IORDY flow control=120ns Commands/features: Enabled Supported: * SMART feature set Security Mode feature set * Power Management feature set * Write cache * Look-ahead * WRITE_BUFFER command * READ_BUFFER command * NOP cmd * DOWNLOAD_MICROCODE * Advanced Power Management feature set Power-Up In Standby feature set * SET_FEATURES required to spinup after power up * 48-bit Address feature set * Device Configuration Overlay feature set * Mandatory FLUSH_CACHE * FLUSH_CACHE_EXT * SMART error logging * SMART self-test * General Purpose Logging feature set * 64-bit World wide name * IDLE_IMMEDIATE with UNLOAD * WRITE_UNCORRECTABLE_EXT command * {READ,WRITE}_DMA_EXT_GPL commands * Segmented DOWNLOAD_MICROCODE * Gen1 signaling speed (1.5Gb/s) * Gen2 signaling speed (3.0Gb/s) * Gen3 signaling speed (6.0Gb/s) * Native Command Queueing (NCQ) * Phy event counters * Idle-Unload when NCQ is active * READ_LOG_DMA_EXT equivalent to READ_LOG_EXT * DMA Setup Auto-Activate optimization * Device-initiated interface power management * Software settings preservation * SMART Command Transport (SCT) feature set * SCT Write Same (AC2) * SCT Error Recovery Control (AC3) * SCT Features Control (AC4) * SCT Data Tables (AC5) * reserved 69[3]
As you can see there is no TRIM support.
Also :
$ lsblk --discard NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO sda 0 0B 0B 0 ├─sda1 0 0B 0B 0 ├─sda2 0 0B 0B 0 └─sda3 0 0B 0B 0 └─luks-2ec7f1ae-6f9b-4896-a7b2-be7809e9d2f4 0 0B 0B 0 ├─vgfedora-pool00_tmeta 0 0B 0B 0 │ └─vgfedora-pool00-tpool 0 0B 0B 0 │ ├─vgfedora-fedora 0 512K 16G 0 │ └─vgfedora-pool00 0 0B 0B 0 └─vgfedora-pool00_tdata 0 0B 0B 0 └─vgfedora-pool00-tpool 0 0B 0B 0 ├─vgfedora-fedora 0 512K 16G 0 └─vgfedora-pool00 0 0B 0B 0 sdb 0 0B 0B 0 ├─sdb1 0 0B 0B 0 └─sdb2 0 0B 0B 0 sr0 0 0B 0B 0
As you can see there is no non-zero value for DISC-GRAN and DISC-MAX.
Also during boot I get the following info:
device-mapper: thin: Data device (dm-2) discard unsupported: Disabling discard passdown.
So what do I do now ?
I hope my system is suited for thin volumes.
You don't have to enable anything. The fstrim.timer his enabled by default and runs fstrim.service once per week.
That command will issue fstrim on all mounted file systems listed in fstab. It has no effect on HDD, or conventional "thick" lvm. But it does have an effect on thin volumes, it will return no longer used blocks back to the thin pool.
Once per week is enough for most workloads.
-- Chris Murphy
On Wed, Nov 25, 2020 at 11:27 PM Chris Murphy lists@colorremedies.com wrote:
You don't have to enable anything. The fstrim.timer his enabled by default and runs fstrim.service once per week.
That command will issue fstrim on all mounted file systems listed in fstab. It has no effect on HDD, or conventional "thick" lvm. But it does have an effect on thin volumes, it will return no longer used blocks back to the thin pool.
Once per week is enough for most workloads.
DISCARD is not supported. And I have a traditional HDD not SSD.
Do I still need DISCARD ?
On 26/11/2020 00:35, Sreyan Chakravarty wrote:
On Wed, Nov 25, 2020 at 2:48 PM Ed Greshko <ed.greshko@greshko.com mailto:ed.greshko@greshko.com> wrote:
The difference here is the "thin-provisioned" lvm. In this case the Trim/Discard isn't being used to extend or improve the performance of the underlying hardware. It is being used to free/return unused blocks to the "pool".
The question is how do I enable it ?
I don't think TRIM is supported since 'hdparm' gives me the following output:
Well, reading the link I sent suggests that the file system supports it.
Do you get the same error when you use the fstrim command from the command line? The format being...
fstrim [-Aa] [-o offset] [-l length] [-m minimum-size] [-v] mountpoint
--- The key to getting good answers is to ask good questions.
On Wed, Nov 25, 2020 at 11:31 PM Ed Greshko ed.greshko@greshko.com wrote:
Well, reading the link I sent suggests that the file system supports it.
Do you get the same error when you use the fstrim command from the command line? The format being...
fstrim [-Aa] [-o offset] [-l length] [-m minimum-size] [-v] mountpoint
Well if you read my original post you will see that I included:
fstrim -v / still fails with :
fstrim: /: the discard operation is not supported
On 11/25/20 10:34 AM, Sreyan Chakravarty wrote:
Well if you read my original post you will see that I included:
fstrim -v / still fails with :
fstrim: /: the discard operation is not supported
Your original post was using the thick LV which doesn't support it. You need to try it again now that you have a thin LV that does.
On Thu, Nov 26, 2020 at 1:04 AM Samuel Sieb samuel@sieb.net wrote:
Your original post was using the thick LV which doesn't support it. You need to try it again now that you have a thin LV that does
Using fstrim now gives the output:
$ fstrim -v / /: 584.8 GiB (627935141888 bytes) trimmed
Do I have to configure anything else ?
On 11/25/20 11:37 PM, Sreyan Chakravarty wrote:
On Thu, Nov 26, 2020 at 1:04 AM Samuel Sieb <samuel@sieb.net mailto:samuel@sieb.net> wrote:
Your original post was using the thick LV which doesn't support it. You need to try it again now that you have a thin LV that does
Using fstrim now gives the output:
$ fstrim -v / /: 584.8 GiB (627935141888 bytes) trimmed Do I have to configure anything else ?
No, it's working. "fstrim" is run automatically as well. See "systemctl status fstrim.timer"
On Thu, Nov 26, 2020 at 1:22 PM Samuel Sieb samuel@sieb.net wrote:
No, it's working. "fstrim" is run automatically as well. See "systemctl status fstrim.timer"
Does issue_discards need to be set in lvm.conf ?
On 11/26/20 12:00 AM, Sreyan Chakravarty wrote:
On Thu, Nov 26, 2020 at 1:22 PM Samuel Sieb <samuel@sieb.net mailto:samuel@sieb.net> wrote:
No, it's working. "fstrim" is run automatically as well. See "systemctl status fstrim.timer"
Does issue_discards need to be set in lvm.conf ?
Probably not, since the physical device doesn't support it.