Should issue_discards be enabled when e2scrub is used on an SSD?
I've got the following setup: LUKSv2+LVM on an SSD drive, and I have trim/discad enabled for encrypted container. I also use e2scrub for Online ext4 Metadata Check which uses a 4 GiB LVM snapshot. I currently have 10 logical volumes, which are periodically (once a week) scanned for errors. I've got a question concerning the *issue_discards* option that can be specified in the /etc/lvm/lvm.conf file. What actually happens when this option is enabled and the LVM snapshot is removed after fsck finishes its job? Will the whole 4 GiB be erased on the flash? Is it safe to enable this option in such case, or is it better to leave it disabled?
Dne 29. 12. 23 v 1:48 Mikhail Morfikov napsal(a):
Quoted 8 lines
I've got the following setup: LUKSv2+LVM on an SSD drive, and I have trim/discad enabled for encrypted container. I also use e2scrub for Online ext4 Metadata Check which uses a 4 GiB LVM snapshot. I currently have 10 logical volumes, which are periodically (once a week) scanned for errors. I've got a question concerning the *issue_discards* option that can be specified in the
/etc/lvm/lvm.conffile. What actually happens when this option is enabled and the LVM snapshot is removed after fsck finishes its job? Will the whole 4 GiB be erased on the flash? Is it safe to enable this option in such case, or is it better to leave it disabled?
Hello
issue_discards is relevant only when you *REMOVE* LVs - the free space in VG
is after such removal 'discarded' - which is only useful in case you i.e.
pay for 'provisioned' space for your VG (or you have some very very very old ssd) - so this will make you VG space consumption smaller - but it will also make restoring of accidentally removed LVs impossible as the recovered LV will be simply just an empty disk space.
So for 100% you don't need to enabled it for e2scrub as discards are normally passed through to your LV device as you may easily check in your sysfs dir:
/sys/block/XXXX/queue/discard_max_bytes
Regards
Zdenek
Quoted 26 lines · Zdenek Kabelac
Dne 29. 12. 23 v 1:48 Mikhail Morfikov napsal(a):
Quoted 10 lines
I've got the following setup: LUKSv2+LVM on an SSD drive, and I have trim/discad enabled for encrypted container. I also use e2scrub for Online ext4 Metadata Check which uses a 4 GiB LVM snapshot. I currently have 10 logical volumes, which are periodically (once a week) scanned for errors. I've got a question concerning the *issue_discards* option that can be specified in the
/etc/lvm/lvm.conffile. What actually happens when this option is enabled and the LVM snapshot is removed after fsck finishes its job? Will the whole 4 GiB be erased on the flash? Is it safe to enable this option in such case, or is it better to leave it disabled?Hello
issue_discardsis relevant only when you *REMOVE* LVs - the free space in VG is after such removal 'discarded' - which is only useful in case you i.e. pay for 'provisioned' space for your VG (or you have some very very very old ssd) - so this will make you VG space consumption smaller - but it will also make restoring of accidentally removed LVs impossible as the recovered LV will be simply just an empty disk space.So for 100% you don't need to enabled it for e2scrub as discards are normally passed through to your LV device as you may easily check in your sysfs dir:
Quoted 6 lines
/sys/block/XXXX/queue/discard_max_bytesRegards
Zdenek
I understand, but the question concerns rather the amount of data written to the SSD disk. So I have a 4 GiB LVM snapshot, which will be removed after fsck. Will the whole 4 GiB be written to the disk when issue_discards is set in the /etc/lvm/lvm.conf file?
Dne 02. 01. 24 v 12:13 Mikhail Morfikov napsal(a):
Quoted 31 lines · Zdenek Kabelac
Quoted 30 lines
Dne 29. 12. 23 v 1:48 Mikhail Morfikov napsal(a):
Quoted 10 lines
I've got the following setup: LUKSv2+LVM on an SSD drive, and I have trim/discad enabled for encrypted container. I also use e2scrub for Online ext4 Metadata Check which uses a 4 GiB LVM snapshot. I currently have 10 logical volumes, which are periodically (once a week) scanned for errors. I've got a question concerning the *issue_discards* option that can be specified in the
/etc/lvm/lvm.conffile. What actually happens when this option is enabled and the LVM snapshot is removed after fsck finishes its job? Will the whole 4 GiB be erased on the flash? Is it safe to enable this option in such case, or is it better to leave it disabled?Hello
issue_discards is relevant only when you *REMOVE* LVs - the free space in VG is after such removal 'discarded' - which is only useful in case you i.e. pay for 'provisioned' space for your VG (or you have some very very very old ssd) - so this will make you VG space consumption smaller - but it will also make restoring of accidentally removed LVs impossible as the recovered LV will be simply just an empty disk space.
So for 100% you don't need to enabled it for e2scrub as discards are normally passed through to your LV device as you may easily check in your sysfs dir:
/sys/block/XXXX/queue/discard_max_bytesRegards
Quoted 7 lines
Quoted 2 lines
Zdenek
I understand, but the question concerns rather the amount of data written to the SSD disk. So I have a 4 GiB LVM snapshot, which will be removed after fsck. Will the whole 4 GiB be written to the disk when
issue_discardsis set in the/etc/lvm/lvm.conffile?
The whole size of removed LV will be discard.
It's mostly equivalent of using 'blkdiscard /dev/vg/lv' just before calling lvremove vg/lv.
lvm2 doesn't interpret in any way what has been used physically used within the LV.
Regards
Zdenek
Quoted 42 lines · Zdenek Kabelac
Dne 02. 01. 24 v 12:13 Mikhail Morfikov napsal(a):
Quoted 31 lines · Zdenek Kabelac
Quoted 30 lines
Dne 29. 12. 23 v 1:48 Mikhail Morfikov napsal(a):
Quoted 10 lines
I've got the following setup: LUKSv2+LVM on an SSD drive, and I have trim/discad enabled for encrypted container. I also use e2scrub for Online ext4 Metadata Check which uses a 4 GiB LVM snapshot. I currently have 10 logical volumes, which are periodically (once a week) scanned for errors. I've got a question concerning the *issue_discards* option that can be specified in the
/etc/lvm/lvm.conffile. What actually happens when this option is enabled and the LVM snapshot is removed after fsck finishes its job? Will the whole 4 GiB be erased on the flash? Is it safe to enable this option in such case, or is it better to leave it disabled?Hello
issue_discards is relevant only when you *REMOVE* LVs - the free space in VG is after such removal 'discarded' - which is only useful in case you i.e. pay for 'provisioned' space for your VG (or you have some very very very old ssd) - so this will make you VG space consumption smaller - but it will also make restoring of accidentally removed LVs impossible as the recovered LV will be simply just an empty disk space.
So for 100% you don't need to enabled it for e2scrub as discards are normally passed through to your LV device as you may easily check in your sysfs dir:
/sys/block/XXXX/queue/discard_max_bytesRegards
Quoted 7 lines
Quoted 2 lines
Zdenek
I understand, but the question concerns rather the amount of data written to the SSD disk. So I have a 4 GiB LVM snapshot, which will be removed after fsck. Will the whole 4 GiB be written to the disk when
issue_discardsis set in the/etc/lvm/lvm.conffile?The whole size of removed LV will be discard.
Quoted 9 lines
It's mostly equivalent of using 'blkdiscard
/dev/vg/lv' just before calling lvremove vg/lv.lvm2 doesn't interpret in any way what has been used physically used within the LV.
Regards
Zdenek
I see, thanks for the info.