6

ext4 is one of the filesystems recommended for using on SSDs (with a number of built-in techniques and advices how to tune it for better performance and wear-levelling of SSDs).

I want to install a Linux system onto an SSD, and I'm going to use ext4, because it is the better tested FS (I don't want to use the more experimetal btrfs).

But what if I add LVM between ext4 and SSD? Will the performance and wear-levelling tweaks for ext4 loose their effect? (Because LVM would hide the actual disk layout from the FS.) Can LVM be configured so that it will use the SSD features effectively?

(I want to use LVM to able to have snapshots of older states of the system, as well as for more flexibility with the sizes of the partitions.)

2
  • 4
    Before you go wasting a lot of effort to ensure that TRIM (that is what the feature youre talking about is called) works, make sure that you even need it. Many SSDs these days dont even use TRIM and instead wear level the entire device whether blocks are in use or not.
    – phemmer
    Commented Apr 29, 2012 at 17:48
  • 1
    Such as?! I know OCZ use it (see the drive with the "performance mode" that works when only half the disk is used). I know my Crucial M4s support it, and it takes a non-zero amount of time to return (observable for large discards). It's known to be useful on Sandforce (SF-2000); the concern there is that TRIM isn't as effective as on other drives, not that it doesn't work at all.
    – sourcejedi
    Commented Dec 30, 2012 at 16:07

1 Answer 1

1

The main issue here is the alignment. You want the filesystem blocks to be aligned with the SSD erase blocks so that sectors aren't unnecessarily erased. When adding LVM into the mix you just need to ensure that the alignment stays intact. By default LVM will align data on PVs on 64KiB boundaries -- if your SSD's erase block size is bigger than that you want to use the --dataalignment option to pvcreate to specify that. (Note that if you're using an MBR/GPT partition under the PVs you also need to address alignment there.)

According to this ServerFault question, TRIM works correctly through ext4+LVM+mdraid as of Linux 2.6.38.

2
  • How do I check what my SSD's erase block size is? Couldn't pvcreate from LVM check it automatically and adjut, without the user's intervention? Commented Oct 24, 2012 at 22:45
  • 2
    @imz Either find the datasheet for your SSD, or try using flashbench.
    – mgorven
    Commented Oct 24, 2012 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .