2 Recommendations for Solid State Drives

Similar to other storage devices, solid state drives (SSDs) require their partitions to be on 1 MB boundaries.

For btrfs and ext4 file systems on SSDs, specifying the discard option with mount sends discard (TRIM) commands to an underlying SSD whenever blocks are freed. This option can extend the working life of the device. However, the option also has a negative impact on performance, even for SSDs that support queued discards.

Instead, use the fstrim command to discard empty and unused blocks, especially before reinstalling the operating system or before creating a new file system on an SSD. Schedule fstrim to run when impact on system performance is minimal. You can also apply fstrim to a specific range of blocks rather than the whole file system.

Note:

Using a minimal journal size of 1024 file-system blocks for ext4 on an SSD improves performance. However, journaling also improves the robustness of the file system, and therefore should not be disabled completely.

Btrfs automatically enables SSD optimization for a device if the value of /sys/block/device/queue/rotational is 0, such as in the case of Xen Virtual Devices (XVD). If btrfs doesn't detect a device as being an SSD, enable SSD optimization by specifying the ssd option to mount. Note, however, that setting the ssd option doesn't imply that discard is also set.

To disable SSD optimization, specify the nossd option to mount.

If you configure swap files or partitions on an SSD, reduce the tendency of the kernel to perform anticipatory writes to swap, which is controlled by the value of the vm.swappiness kernel parameter and displayed as /proc/sys/vm/swappiness. The value of vm.swappiness can be in the range 0 to 100, where a higher value implies a greater propensity to write to swap. The default value is 60. The suggested value when swap has been configured on SSD is 1. Use the following commands to change the value:
echo "vm.swappiness = 1" >> /etc/sysctl.conf
sudo sysctl -p
...
vm.swappiness = 1

For additional swap-related information in connection with the btrfs file system, see Creating Swap Files on a Btrfs File System in Oracle Linux 8: Managing Local File Systems.