[kwlug-disc] SSDs and TRIM

John Van Ostrand john at netdirect.ca
Thu Apr 29 14:33:22 EDT 2010

----- "Chris Irwin" <chris at chrisirwin.ca> wrote:

> On Thu, Apr 29, 2010 at 12:49, John Van Ostrand <john at netdirect.ca>
> wrote:
> > Correct me if I'm ignorant, but won't putting an LVM on a dm device
> do what you want? You can use dm for TRIM and have the benefits of
> LVM.
> I can neither confirm nor deny what you've said. I can only relay
> what
> I've read so far:
> LVM uses DM itself internally, no special steps required. DM has no
> support for TRIM.
> Somewhat annoying. The benefits of LVM are great. But the potential
> pitfall of having degraded performance over time is not quite so
> great.
> Apparently some folks said the third-party utilities (at least one
> called "wiper") should work with "single-device linear LVM". I read
> that as meaning contiguous volumes. One must then calculate an offset
> within the PV's partition where the filesystem actually starts. If
> that offset is incorrect, non-volume sectors, and possibly in-use
> sectors will be garbage collected. If your volume is not contiguous,
> non-volume related sectors may be garbage collected. Both are
> troublesome, but the latter means you couldn't trim any volume you've
> ever grown. I grow, move, and shrink filesystems as needed. If I
> can't
> do that, there is little point to using LVM at all.

It seems that hdparm does a better job than wiper.exe. (http://lwn.net/Articles/345020/) I imagine you could write a script that did an fdisk followed by a vgdisplay to collect all the info needed to determine if the LV was contiguous and to determine what the block offset is for the file system then run the hdparm command with suitable parameters.

If you set the --alloc contiguous then you can be assured of having contiguous allocation of extents. I agree that without being able to allocate disk as need it makes LVM less usable, but you can still move extents to other disk areas.

John Van Ostrand 
CTO, co-CEO 
Net Direct Inc. 
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
Ph: 866-883-1172 x5102 
Fx: 519-883-8533 

Linux Solutions / IBM Hardware 

More information about the kwlug-disc mailing list