Thursday 28 April 2016

SSD optimisations on ASUS TP300LA running Fedora 23

Please leave a comment if you spot anything that is wrong (share if you know more than what I have discovered; or better still, warn me if I am doing something stupid etc. etc.)

References

Enable TRIM Support

First and foremost, ensure your SSD supports TRIM. Some SSDs have issues with their TRIM implementations. Researching that is also crucial. For example issues with continuous TRIM are discussed at Continuous TRIM by mount flag.
Does your SSD support trim? [Sandisk SDSSDHII-960G-G25 960GB Ultra II]
[mochapenguin@tp300la ~]$ su -c 'hdparm -I /dev/sda' | grep TRIM
Password:
* Data Set Management TRIM supported (limit 16 blocks)
* Deterministic read ZEROs after TRIM

Enabled TRIM support following the Phoronix article on Tweaking Your Fedora Installation For Maximum Productivity & Features
Enable fstrim.timer service
sudo systemctl enable fstrim.timer sudo systemctl start fstrim.timer

Edit /etc/crypttab and add discard
/etc/crypttab
luks-x-b3b728ea5e7c UUID=x-b3b728ea5e7c  none    luks,discard fc23home            UUID=x-deaft04500f2  none    luks,discard

Update initramfs
sudo dracut -f

Reboot. And verify.
Test if TRIM is working
[mochapenguin@tp300la ~]$ sudo fstrim -v /
[sudo] password for mochapenguin:
/: 686.4 GiB (736991698944 bytes) trimmed

Profile-Sync-Daemon

PSD is designed to manage browser profile(s) in tmpfs and to periodically sync back to the physical disc, thereby reducing writes to SSDs. This is useful where there is ample spare RAM on the system.

Browsers store their profile and cache in various locations as described below:

Firefox

cache
/home/mochapenguin/.cache/mozilla/firefox/<profile-id>.default
profile
/home/mochapenguin/.mozilla/firefox/<profile-id>.default

I took the approach of moving the cache folder into the profile folder (so PSD can sync it to tempfs) and create a symlink (so the browser works on as before).

Created a folder named cache within the profile folder, moved the cache folder contents there and created a symlink to it.

create symlink from Code
ln -s /home/mochapenguin/.mozilla/firefox/<profile-id>.default/cache /home/mochapenguin/.cache/mozilla/firefox/<profile-id>.default

Google Chrome

cache
/home/mochapenguin/.cache/google-chrome
profile
/home/mochapenguin/.config/google-chrome

Created a folder named CacheFedoraUser within the profile folder, moved the cache folder contents there and created a symlink to it.
create symlink from Code
ln -s /home/mochapenguin/.config/google-chrome/CacheFedoraUser /home/mochapenguin/.cache/google-chrome

Midori

cache
/home/mochapenguin/.cache/midori
profile
/home/mochapenguin/.config/midori

Created a folder named cache within the profile folder, moved the contents of the cache folder there and created a symlink to it.

create symlink
ln -s /home/mochapenguin/.config/midori/cache /home/mochapenguin/.cache/midori
profile-sync-daemon parse
[mochapenguin@tp300la ~]$ psd p
Profile-sync-daemon v5.68 on Fedora 23 (Workstation Edition)
 Systemd service is currently active.  Systemd resync service is currently active.  Overlayfs v23 is currently active.
Psd will manage the following per /run/psd.conf settings:

 browser/psname:  firefox/firefox
 owner/group id:  mochapenguin/1000
 sync target:     /home/mochapenguin/.mozilla/firefox/am4vgccx.default
 tmpfs dir:       /tmp/mochapenguin-firefox-am4vgccx.default
 profile size:    104M
 overlayfs size:  0
 recovery dirs:   none

 browser/psname:  google-chrome/chrome
 owner/group id:  mochapenguin/1000
 sync target:     /home/mochapenguin/.config/google-chrome
 tmpfs dir:       /tmp/mochapenguin-google-chrome
 profile size:    83M
 overlayfs size:  62M
 recovery dirs:   none

 browser/psname:  midori/midori
 owner/group id:  mochapenguin/1000
 sync target:     /home/mochapenguin/.config/midori
 tmpfs dir:       /tmp/mochapenguin-midori
 profile size:    1.4M
 overlayfs size:  0
 recovery dirs:   none

Enable overlayfs

Decided to use the overlayfs for the profile sync. This may be optional but I understand it helps making the sync efficient.

load up the overlay module manually (first time)
sudo modprobe overlay

Load up the overlay module as above, enable overlay in psd.conf and restart the service. The output of the profile-sync-daemon parse command should now show "Overlayfs v23 is active".
Added the below file to get the overlayfs module to be loaded on boot from this finding on FedoraForum.

/etc/modules-load.d/overlayfs.conf
overlay

No comments:

Post a Comment