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

Wednesday 27 April 2016

WIP - ASUS TP300LA - Windows 10 + Fedora 23 - dual boot

Work in Progress

Purchased an ASUS TP300LA notebook last Christmas. Documenting my journey here. 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.)

Most important - recovery drive

It came with Windows 8.1. I make sure I create a recovery drive so that I can recover the system if I mess things up. Made a USB Recovery Drive (TODO - USB size).

SSD

It had a 500GB HDD built in. I was keen on replacing that with an SSD. Got a 960GB SanDisk Ultra II SSD. Swapped the drives and used the recovery drive to restore the system.

At that point in time it had partitions sda1 (305MB RE), sda2 (100MB EFI), sda3 (128MB MS reserved), sda4 (C drive), and sda5 (ASUS recovery drive).

Windows 10

Then upgraded to Windows 10. This created a 450MB partition (Windows 10 boot, I believe) at the end of the C drive partition.

I wanted to move all boot partitions etc before the partition for the C drive, reduce the C drive partition and blitz the ASUS recovery drive - thereby creating room for a Fedora install.

Using GParted, I moved the 450MB partition before the C drive partition. Reduced the C drive to under 100GB. That left under half the C drive free for installing software if I decided to use Windows 10 (unlikely to be very much). ASUS recovery partition was deleted (since we have a Recovery USB Drive now anyway).

Fedora 23 Workstation install

Installed Fedora 23 x64 Workstation. 

The plan is to have an encrypted swap, /home and /tmp for security. 

During installation, selected Custom Partitioning. Defined the partition manually. ~ 500MB for /boot, LUKS encrypted 6GB (same size as the RAM) for swap, 100GB at the end of the drive for /home (LUKS encrypted) and the remaining in between for /

Below screenshot shots how things looked.



Encrypting /home

Boot up to the Fedora Login prompt. Press CTRL + ALT + F2 to bring up the console. Log in as root. Following commands are used to make a copy of /home

Code
[root] mkdir homebackup [root] cp -a /home/* homebackup/ # Make a new dm-crypt device cryptsetup --verify-passphrase -v luksFormat /dev/sda9 # cryptsetup luksOpen /dev/sda9 fc23home # verify cryptsetup luksDump /dev/sda9 # mkfs.ext4 /dev/mapper/fc23home # remove lost+found rm -rf /home/* # cp -a homebackup/* /home
Code
/etc/crypttab /etc/fstab
Now I have a dual boot Windows 10 + Fedora 23 Workstation on my ASUS TP300LA.

Good things noticed:
  • Hibernation works great 

Tuesday 26 April 2016

Fedora 23 - User interface customisations

Customisations applied on my Fedora 23 machine

Custom Shortcuts

If you are used to Windoze shortcuts and want to use the same, this is what you can do:

Go to Settings (drop down menu from the top right corner > spanner + screwdriver icon





Click on the Keyboard icon. Then the Shortcuts tab.
 
Select Custom Shortcuts, Click on the + button and define the shortcuts





1. Terminal - Super + T





Define the shortcut and click the Add button
 




Click on the text Disabled to define a new accelerator key combination.
 








Name: 




NameCommandShortcut
Terminal
gnome-terminal
Win + T
Firefox
firefoxWin + F
Nautilus
nautilusWin + E