Skip to contentSkip to conversation

Questions about issue_discards

linux-lvm CJ Kucera 3 participants 3 messages Dec 6, 2012 – Dec 7, 2012

lore
Share & tools
lore

CJ Kucera

author
#0 lore raw

Hello, list!

I've started to play around with SSD drives and was curious about a couple aspects of the issue_discards configuration option.

1) The lvm.conf comments note that when enabled, it'll still only (obviously) issue discards to storage which happens to support it. Is there a way of querying block devices to find out if they support the feature?

2) Would a change to the issue_discards parameter be picked up automatically by the running kernel? The lvm.conf manpage mentions that it remembers the timestamp of the file "between commands" and will apply changes then, but it almost sounds like that'd be mostly for things like the device scanning list, etc.

Thanks!

-CJ

#1 lore raw
Quoted 3 lines · CJ Kucera

(obviously) issue discards to storage which happens to support it. Is there a way of querying block devices to find out if they support the feature?

hdparm -I /dev/DEVICE

is what you're looking for. SSDs support different methods of supporting discards, mostly TRIM.

Quoted 2 lines

2) Would a change to the issue_discards parameter be picked up automatically by the running kernel? The lvm.conf manpage mentions that

It should be. You can do an lvm dumpconfig to check.

Cheers,
-j

#2 lore raw
In reply to CJ Kucera
Quoted 9 lines · CJ Kucera

Hello, list!

I've started to play around with SSD drives and was curious about a couple aspects of the issue_discards configuration option.

1) The lvm.conf comments note that when enabled, it'll still only (obviously) issue discards to storage which happens to support it. Is there a way of querying block devices to find out if they support the feature?

lvm will only issue discards if the underlying device has non-zero discard_granularity and discard_max_bytes, to check:

cat /sys/block/<dev>/queue/discard_granularity
cat /sys/block/<dev>/queue/discard_max_bytes

(replace <dev> accordingly, e.g. sda)

Quoted 5 lines

2) Would a change to the issue_discards parameter be picked up automatically by the running kernel? The lvm.conf manpage mentions that it remembers the timestamp of the file "between commands" and will apply changes then, but it almost sounds like that'd be mostly for things like the device scanning list, etc.

lvm.conf's issue_discards doesn't have any affect on the kernel (or underlying device's) discard capabilities. It only controls whether discards are issued by lvm for certain lvm operations (like when an LV is removed).