Saturday, February 2, 2019

Use autofs Instead of Adding NFS Shares to fstab in Linux


Autofs service provides an alternate way to mount nfs shares. Automount daemon is used to automatically mount file systems on demand i.e. when they are being accessed. not only will it mount automatically but it can automatically unmount when not in use for a particular predefined timeout value.

Yes, you can argue that it is much easier to edit /etc/fstab than go through all that hassle to configure autofs, but it has its perks:

Imagine a scenario where a nfs share is supposed to be mounted at boot but it is not accessible; this will lead to delayed start up time or in worse case, the OS won't boot up at all.

Another advantage is that booting time is significantly reduced because no mounting is done at boot time. Therefore, autofs is the way to go if your server is frequently powered on/off and nfs share is accessed occasionally.

Also, failed mount requests can be reduced by assigning an alternate mount point as the source of a filesystem, so if there is a failure at one end, the mount point still works.

Configuring autofs...

The main configuration file for autofs is /etc/auto.master (aka the master map). Master map lists mount points handled by autofs on the system, and their corresponding configuration files.

Each entry in auto.master has three fields: the mount point, location of the map file, and the third field is optional and may contain information such as a timeout value as shown below:

Value Description
mount-point The mount point, /misc or /nfs, for example.
map-name The name of a map source which contains a list of mount points.
/etc/auto.nfs
options Specify options such as timeout etc.

In the following example I create auto.master file in /etc and add auto.nfs file as source to mount on /nfs. I’ve also set the timeout to 20s, which means any file system mounted on /nfs under with nfs.auto configuration will be unmounted after 20s inactivity.

    
    # mkdir /nfs
    # vi /etc/auto.master
        
    /nfs    /etc/auto.nfs  --timeout=20
    

auto.nfs contains our actual configuration and would look like this:

    
    # vi /etc/auto.nfs

    sharefiles1          -fstype=nfs             server1.domain.net:/work
    sharefiles2          -fstype=nfs             server2.domain.net:/mydocs
        
    #systemctl reload autofs
    # cd /nfs/sharefiles1       
    
    

The directories from nfs sources should be mounted in two directories called sharefiles1 and sharefiles2 under /nfs.

Sunday, December 2, 2018

Few More Things to do After Installing Ubuntu 18.04



In last week’s post, I talked about the first tweaks I did to Ubuntu after upgrading the system to Bionic Beaver. This week, I’ve got a few more tweaks that I found useful. Just adding this here in the hopes that someone will find it useful (or I’ll forget how I did it – so it’s good to keep a how-to lying around). 



6. Change Default Sinhala Font on Firefox

Ubuntu has supported sinhala fonts for a few years now. Gone are the days of patched up font glyphs – we now have true sinhala unicode! During installation, Ubuntu will ask you for your location and install native languages accordingly (if you didn’t, you can always install your language of choice via Language Support in Settings).

I didn’t change the System settings since I don’t really need sinhala on the GUI but noticed that sinhala rendering on Firefox seemed horrible. The letters were too thin and difficult on the eyes.
The browser was displaying the unicode content alright but the font wasn’t the best out there.

https://si.wikipedia.org/ as seen on Firefox with DejaVu typeface



Compare the above picture with the one below. It is a screen grab of the same content when viewed on Firefox in Windows 10.

Windows 10 uses Nirmala UI to render Sinhala on the web


Notice how Windows rendering is much better and has constant thickness on letters (sans-serif!), this is because it uses a font called Nirmala UI.

Nirmala UI is an Indic scripts typeface. Inidic scripts are writing systems derived from Brahmic scripts and are the basis for almost all writing systems native to South Asia. Nirmala was first released for Windows in 2012 and is based on Segoe UI, which is now the default font for Microsoft.

You can download Nirmala UI here: https://www.wfonts.com/font/nirmala-ui. Extract it and click install (top right corner) as shown below, Ubuntu will take care of the rest.




Then, on Firefox, go to preferences and under Language and Appearance click on Advanced.




A new dialog box opens – similar to the one shown below. In the fonts for section, there is a list of supported fonts, choose Sinhala, select Nirmala and click OK.




There we have it. You can read sinhala web pages without going nuts over fonts. One more thing, this changes the font on web browser only – to apply it system wide, you can install GNOME Tweaks; it allows you to change system with just a few clicks.


 

7. Increase scroll speed on Firefox


While browsing, noticed that scroll speed on the mouse was too slow. Luckily, Firefox takes pride in the level of customizability it offers to its users.

In a new tab, type about:config in the address bar and press Enter.

In the search box above the list, type or paste mousewheel.min_line_scroll_amount and pause while the list is filtered. You can change the number of lines Firefox scrolls a page, try changing it from 5 to 30, or whatever suits you.

Popular posts