Thursday, May 28, 2020

Linux and SSD

Don't know if you should call this an advantage or a disadvantage. Customizable is a double edge sword.  If you know what you are doing, it allows you to tailor precisely to your liking.  However, if you are like myself, a casual user, I am afraid it is a shortfall.

SSD is a very common component found in computers now, however it still requires quite a bit of efforts to set it up correctly.  If you leave it at the default, you may risk to shorten its lifespan by writing to it excessively.

It is not hard to find an article similar to this one to show your 3 main customizations you need for using a SSD drive.

First, you will get suggested to set noatime to your drive by editing the /etc/fstab.  By default atime, i.e. Access Time is enable, and it gets updated every time a file or directory is accessed.

Access time shows the last time the data from a file or directory was accessed – read by one of the Unix processes directly or through commands and scripts.


Due to its definition, atime attribute must be updated – meaning written to a disk – every time a Unix file is accessed, even if it was just a read operation. (https://www.unixtutorial.org/atime-ctime-mtime-in-unix-filesystems/)

To apply the noatime to your drive, you open the /etc/fstab file with your favourite editor, e.g.
sudo nano /etc/fstab

You look for the line similar to below for your SSD, and add the noatime option to it, e.g.

UUID=xxxxxxx / ext4 noatime,errors=remount-ro 0 1

Second, you will get told to set up a schedule for performing the TRIM operation.

The tutorial mentioned before suggested to create a schedule by

1) Create a folder within the /etc/systemd/system/ for this schedule.


sudo mkdir -v /etc/systemd/system/fstrim.timer.d
2) Create a setting file in the newly created folder.
sudo touch /etc/systemd/system/fstrim.timer.d/override.conf


3) Specify the run time by adding settings similar to the file created in (2).
[Timer]
OnCalendar=
OnCalendar=daily


Third and the last, you will be asked to reduce the usage of swap by adjusting the swappiness.

Linux's inclination to use the swap, is determined by a setting called swappiness. The lower the setting number, the more system load is required before your Linux starts using the swap.

On a scale of 0-100, the default setting is 60. Which is much too high for normal desktop use, and only fit for servers. For SSD's, it's just crazy. (https://easylinuxtipsproject.blogspot.com/p/ssd.html#ID3)
With the default value, your system will start to use swap when 40% of your memory is being used.  As you can see why this is bad for your SSD.  If your system has decent amount of memory, 10 would be more friendly figure to your SSD.

To change the swappiness, you add this line to the /etc/sysctl.conf file if it wasn't there already.

# Sharply reduce the inclination to swap

vm.swappiness=5


I wrote this post as a reminder to myself for my future setup, hence it may not be as details as the other posts online.  However, hopefully this gives you enough pointers to what to look for.


Saturday, May 23, 2020

PowerShell Script for batch WAV/APE to FLAC

This is a script I use for converting any WAV/APE files in a folder to FLAC.

$files = Get-ChildItem -Recurse -path . -filter *.ape
foreach ($file in $files) {
    $path = Split-Path -Path $file.FullName
    $new_name = [IO.Path]::GetFileNameWithoutExtension($file) + ".wav"
  
    $new_name = Join-Path $path $new_name
  
    mac $file.FullName $new_name -d
}

$files = Get-ChildItem -Recurse -path . -filter *.wav
foreach ($file in $files) {
    flac --best $file.FullName
}

Friday, May 8, 2020

JDownloader2 Displays CJK chracters as Squares on Windows

If you found your JDownloader 2 displays CJK characters as squares on Windows, then you may want to give below a try.


Go to Advanced Settings -> Search for "Font" -> Look for LAFSettings: Font Name, and change value from default to Dialog.


Restart JDownloader2, hopeful CJK characters are displaying correctly now.

Thursday, May 7, 2020

Ubuntu 20.04 and Windows shares

If you got this error when you were accessing your Windows share by click on the connecting machine on your file browser, you may want to try to use the direct path instead, i.e. smb://machine name/shared path

Apparently there is a bug in gvfs which causes this issue.

https://askubuntu.com/questions/1179576/ubuntu-18-04-problem-to-connect-to-windows-10-smb-share






Wednesday, May 6, 2020

Open Graphics Drivers

If you want to improve your graphics card performance, you may want to give the Open Graphics Drivers a try using the instructions from this URL.

https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers