SSDをRAID5で自作サーバ構築(その3)
ファイルシステムのSSD向けチューニング
先人の知恵*1に従って、ext4とXFSに対してはマウントオプションを変更します。
fstabを編集し、マウントオプションに discard,nobarrier,relatime を付けます。(defaults は削除して discard,nobarrier,relatime に変更、最初からオプションが書かれていれば消さずに追記します)
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc nodev,noexec,nosuid 0 0 /dev/mapper/ssdraid5-root / ext4 discard,nobarrier,relatime,errors=remount-ro 0 1 # /boot was on /dev/md126 during installation UUID=f37b156d-2653-4ec5-a8d5-821fec9dee32 /boot ext3 defaults 0 2 /dev/mapper/ssdraid5-var /var ext4 discard,nobarrier,relatime 0 2 /dev/mapper/ssdraid5-vm /vm xfs discard,nobarrier,relatime 0 2 # swap was on /dev/sda1 during installation UUID=c5335f6a-5222-f695-f98e-daede7ad7405 none swap sw 0 0 # swap was on /dev/sdb1 during installation UUID=00b6cbad-f740-49c6-a396-94cbf3c795b0 none swap sw 0 0 # swap was on /dev/sdc1 during installation UUID=c5335f6a-5222-f695-f98e-daede7ad7405 none swap sw 0 0 # swap was on /dev/sdd2 during installation UUID=4de86848-d743-4b7f-861a-17cd5cddebb7 none swap sw 0 0
XFS は lazy-count=1 オプションを付けてフォーマットしなおしました。*2
$ sudo umount /vm $ sudo mkfs.xfs -f -l lazy-count=1 /dev/ssdraid5/vm
再起動し、mountコマンドで確認。
$ mount /dev/mapper/ssdraid5-root on / type ext4 (rw,relatime,discard,nobarrier,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) /dev/mapper/ssdraid5-vm on /vm type xfs (rw,relatime,discard,nobarrier) /dev/mapper/ssdraid5-var on /var type ext4 (rw,relatime,discard,nobarrier) /dev/md0 on /boot type ext3 (rw) $
バッチリですね。