Best practices for SSD

Chris Murphy lists at colorremedies.com
Thu Feb 6 23:35:55 UTC 2014


On Feb 6, 2014, at 7:43 AM, Wade Hampton <wadehamptoniv at gmail.com> wrote:

> - partition on a 1M boundary

Has been this way by default for some time.

> - use native partitions, not LVM (for TRIM)

Well this wouldn't be a reason to not use LVM, I'd come up with something else, like it's a PITA to do what it suggests is easy like resizing. For a single drive, I see no point.

> - mount using relatime (or noatime for CentOS 5)

This is the default for ext4, XFS, and Btrfs anyway.

> - mount using discard (or use the fstrim program periodically)

The discard/TRIM debate can be found in the archives and also on devel@ archives, and on XFS archives. Not all SSDs perform that well with discard mount option because TRIM is a non-queued command, therefore for TRIM commands to be issued the drive cache must be cleared of all other commands and this can actually make things slower. So really it depends on your workload type, and the SSD you're using. I wouldn't assume you must have this enabled. Pretty much every source on this has been wrong, notable the crap resulting from coverage of Ubuntu moving to discard by default.

> - use EXT4

Why? You can use ext4, XFS or Btrfs. If anything the reverse order of that is how much fs dev emphasis on ssd optimization there's been.


> Other recommendations I have seen recommended:
> - move some temporary files to tempfs

> - move /tmp to RAM:  /etc/fstab

This is the default since Fedora 18.

> - change I/O scheduler by adding "elevator=noop" to boot parms

It's an open debate on whether deadline or noop is better for SSDs. It depends on the workload. Either is probably better than CFQ which is still the default for 3.14 kernels in koji. It's not like CFQ is hideous or anything. You're unlikely to notice a difference unless you're doing a lot of reads and write, or parallel tasks to multiple drives. I'm currently using deadline with Btrfs and SSD.

Add it to /etc/default/grub in GRUB_CMDLINE_LINUX= and then
grub2-mkconfig -o /boot/grub2/grub.cfg      # on BIOS
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg  # on UEFI



> - reduce swappiness:  /etc/sysctl.conf 
>       vm.swappiness=1
>       vm.vfs_cache_pressure=50

I wouldn't do this. If swap is needed, then swap is needed. If you don't like that, get more RAM. If you're nervous about the SSD being worn due to swap, then again, get more RAM. Conversely, you're unlikely to put that much wear on it with normal swap usage.

A cute trick I read on the XFS list some weeks back was using an SSD with a large pile of swap so that a system with limited RAM was able to do an xfs_repair on a massive file system in much less time than without swap. xfs_repair needs gobs of RAM, but it will use less and you'll just have to wait a whole lot (incredibly) longer. So if it's being used for that instead of getting more RAM, I think you're fine with defaults.


Chris Murphy



More information about the users mailing list