Home > 備忘録(Fedora) > TRIM を有効にする( 113 )
HDDをSDDに換装しようとして、trimについてしらべてみた。 (Solid State Drives (日本語) - ArchWiki) を参考にしました。
LVMというディスク管理機能を利用している場合のみ issue_discards オプションを有効にする
# vi /etc/lvm/lvm.conf
# Issue discards to a logical volumes's underlying physical volume(s) when
# the logical volume is no longer using the physical volumes' space (e.g.
# lvremove, lvreduce, etc). Discards inform the storage that a region is
# no longer in use. Storage that supports discards advertise the protocol
# specific way discards should be issued by the kernel (TRIM, UNMAP, or
# WRITE SAME with UNMAP bit set). Not all storage will support or benefit
# from discards but SSDs and thinly provisioned LUNs generally do. If set
# to 1, discards will only be issued if both the storage and kernel provide
# support.
# 1 enables; 0 disables.
issue_discards = 1 ←issue_discards = 0 から変更する
}# vi /etc/fstab
/dev/mapper/fedora-root / ext4 discard 1 1
UUID=56e80021-d5c3-3b12-aab2-6d5831877511 /boot ext4 discard 1 2
/dev/mapper/fedora-home /home ext4 defaults 1 2
/dev/mapper/fedora-swap swap swap defaults 0 0# vi /etc/sysctl.conf
vm.swappiness=1
vm.vfs_cache_pressure=50# vi /etc/cron.daily/trim.sh
#!/bin/sh
LOG=/var/log/trim.log
echo "*** $(date) ***" >> $LOG
fstrim -v / >> $LOG# chmod +x /etc/cron.daily/trim.sh