paapereira.xyz

Adventures in Arch (Part II): Fine Tuning

In this part I will show the fine tuning I made in the system. I will keep updating this post in the next weeks, in case I have other tips.

Arch Linux

fstab

Since I have the system installed in a SSD drive, I changed the mount flags in fstab to trim the drive:

1sudo nano /etc/fstab
1UUID=aee33023-2254-42fc-94ac-612314eeb332   /   ext4   noatime,discard,data=ordered,errors=remount-ro   0 1
2UUID=114aaab1-1cb8-4853-bacc-819237d2d063   /boot   ext4   noatime,discard,data=ordered,errors=remount-ro   0 2

I also mounted /tmp in memory:

1tmpfs   /tmp   tmpfs   nodev,nosuid,noatime,mode=1777   0 0

I/O Scheduler

Check your scheduler:

1sudo cat /sys/block/sda/queue/scheduler
1noop deadline [cfq] 

Get the SSD disk ID:

1sudo ls /dev/disk/by-id/
1ata-Corsair_Force_3_SSD_12066504000008910711

Change the scheduler to noop at boot time:

1sudo nano /etc/rc.local
 1    #!/bin/sh
 2    declare -ar SSDS=(
 3       'ata-Corsair_Force_3_SSD_12066504000008910711'
 4    )
 5    for SSD in "${SSDS[@]}" ; do
 6       BY_ID=/dev/disk/by-id/$SSD
 7       if [[ -e $BY_ID ]] ; then
 8          DEV_NAME=`ls -l $BY_ID | awk '{ print $NF }' | sed -e 's/[/\.]//g'`
 9          SCHED=/sys/block/$DEV_NAME/queue/scheduler
10          if [[ -w $SCHED ]] ; then
11             echo noop > $SCHED
12          fi
13       fi
14    done

Create a rc-local.service to start with system.d (see this tip):

1sudo nano /etc/systemd/system/rc-local.service
 1    #  This file is part of systemd.
 2    #
 3    #  systemd is free software; you can redistribute it and/or modify it
 4    #  under the terms of the GNU General Public License as published by
 5    #  the Free Software Foundation; either version 2 of the License, or
 6    #  (at your option) any later version.
 7    
 8    [Unit]
 9    Description=/etc/rc.local Compatibility
10    ConditionPathExists=/etc/rc.local 
11    
12    [Service]
13    Type=forking
14    ExecStart=/etc/rc.local start
15    TimeoutSec=0
16    StandardOutput=tty
17    RemainAfterExit=yes
18    SysVStartPriority=99 
19    
20    [Install]
21    WantedBy=multi-user.target

Enable the service in systemd:

1sudo systemctl enable rc-local.service
2sudo systemctl start rc-local.service

Swap

I didn’t create a swap partition.

1sudo nano /etc/sysctl.conf
1vm.swappiness = 0

Preloading

More on this topic here.

1sudo pacman -S preload
2sudo systemctl enable preload

Zram

More on this topic here.

Download from AUR.

1cd builds
2tar -xzf zramswap.tar.gz
3cd zramswap
4makepkg -s
5sudo pacman -U zramswap-1.1-1-any.pkg.tar.xz
6sudo systemctl enable zramswap.service

Chrome cache

Having installed Chrome, I adapted this script to move the cache into memory.

1mkdir -p bin/google-chrome_cache
2nano bin/google-chrome_cache/tmp_cache.sh
1    #!/bin/bash
2    if test -d /tmp/google-chrome; then
3      exit 0
4    else
5      rm -r ~/.cache/google-chrome
6      mkdir /tmp/google-chrome
7      ln -s /tmp/google-chrome ~/.cache/google-chrome
8    fi
1chmod +x bin/google-chrome_cache/tmp_cache.sh
2nano .config/autostart/google-chrome_cache.desktop
 1    [Desktop Entry]
 2    Type=Application
 3    Exec=/home/youruser/bin/google-chrome_cache/tmp_cache.sh
 4    Hidden=false
 5    NoDisplay=false
 6    X-GNOME-Autostart-enabled=true
 7    Name[en_US]=google-chrome_cache.desktop
 8    Name=Chrome Cache
 9    Comment[en_US]=Move Chrome cache to /tmp
10    Comment=Move Chrome cache to /tmp

Font Rendering

1sudo nano /etc/pacman.conf
1    [infinality-bundle]
2    SigLevel = Never
3    Server = http://bohoomil.cu.cc/infinality-bundle/$arch
4    
5    [infinality-bundle-multilib]
6    SigLevel = Never
7    Server = http://bohoomil.cu.cc/infinality-bundle-multilib/$arch
1sudo pacman-key -r 962DDE58
2sudo pacman-key --lsign-key 962DDE58
3sudo pacman -Syu
4yaourt -S freetype2-infinality fontconfig-infinality \
5	lib32-freetype2-infinality libreoffice-uglyfix-freetype2-infinality
6sudo nano /etc/fonts/local.conf
 1    <?xml version='1.0'?>
 2    <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
 3    <fontconfig>
 4     <match target="font">
 5    
 6      <edit mode="assign" name="rgba">
 7       <const>rgb</const>
 8      </edit>
 9      <edit mode="assign" name="hinting">
10       <bool>true</bool>
11      </edit>
12      <edit mode="assign" name="hintstyle">
13       <const>hintslight</const>
14      </edit>
15      <edit mode="assign" name="antialias">
16       <bool>true</bool>
17      </edit>
18      <edit mode="assign" name="lcdfilter">
19        <const>lcddefault</const>
20      </edit>
21    
22     </match>
23    </fontconfig>

Check this for more information.

#Linux #Arch Linux