Tag Archives: linux

Linux Desktop for 2017 and on

Screenshot from 2017-10-08 08-38-43As Canonical has announced the end of Unity desktop I thought it’s time to look again around at Linux desktops. In past years I have been using mainly Gnome 2 (or Mate recently), XFCE, Cinnamon and Unity (yes I did and experience was after all rather positive). I’ve tried Gnome 3 few years ago, but really never gave it longer try and never really find attraction for KDE. So in this article I’ll look a bit at those desktops again and especially at the recent Gnome Shell and it’s customization to my needs (which is indeed based on very individual preferences). Continue reading Linux Desktop for 2017 and on

Beware of sync option in mount

By default mount is using async option, which means that  write operations do not wait for final confirmation from the device – they are stored in disc cache and writes are done latter, optimized by disc firmware.  However you can set sync option manually ( -o sync), then write operations are synchronous, meaning each block write has to wait for confirmation that it’s physically written to the  disc and there is no optimization available.  This can significantly slow down write speed, of which I convinced myself just recently – I backuped  some data to external 2.5″ USB 3.0 HD – slowdown in this case was almost 1000x  –  (70kb/s vs 60MB/s   measured by rsync --progress).  How it happened that disc was mounted with sync option? I actually use usbmount to auto-mount disks and it has sync as default mount option (fortunately can be changed in it’s configuration). So conclusion is – don’t use sync  option unless you know exactly what you are doing and if write speed is suspiciously slow check mount options.

Run Multiple Terminal Tabs with Python Virtualenv

Virtualenv is a must have for python development.  If your project is a complex beast consisting  of multiple services/components you want them see running  in different terminals  (ideally tabs of one terminal window).  Staring all terminal manually could be cumbersome. This simple script starts terminal tabs (in gnome-terminal) with activated virtual environments and eventually appropriate services/applications started:

None -ci argument –  interactive shell must be enforced to run command with virtual environment loaded.w

Also gnome terminal recently drop support for –title parameter, which enabled to set title to the tab (really do not understand why, because it was very useful).   So now our tabs will have same prompt.

This can be somehow fixed with modification of virtualenv activate script to include terminal escape sequence  shown below (thus we will see current terminal directory as tab title):

 

Unity – adding unknown applications to Launcher/Dash

It’s described in numerous posts how to add new application to Unity so it’s searchable in Dash.   Unity works with .desktop files, which define how applications should be launched from Unity – these files are located in /usr/share/applications (system wide definitions) or ~/.local/share/applications (user specifics application). So if you add well formated .desktop file to any of these locations Unity will be aware of it (may need to restart unity).

Recently I found one more interesting behavior of Unity – if you start unknown application from terminal it will appear in Launcher (in ‘Running applications’ section), Unity even makes some effort to find correct icon for it.  Now you can lock it to Launcher (right click and chose ‘Lock to Launcher’ from menu).   On background Unity creates new .desktop entry for this program in ~/.local/share/applications, so it can stay locked to Launcher in future.   This new .desktop file contains title of the application from window title (in which application is running) executable path and parameters are taken from process properties, even icon path is stored if Unity was able to find one.  And when you unlock application from launcher, .desktop file will still remain in users applications – so you can search it in Dash.   So this approach can make adding new unknown application easier – just run, then lock and unlock from Launcher and you’ll have new entry in ~/.local/share/application. You can then edit it a bit manually to make it perfect and this is it.

 

Converting files in directory structure

Often I needed to convert a set of files (audio files to different format,  text files to different encoding, …)  in some directory structure and save results to a  new destination while retaining directory structure.   In order to walk through directory structure we can use find command,   but if we are to create output in new place, subdirectories have to be created, which is where find command line gets bit complicated (especially if we have to consider spaces in files/directories names).   So here is an example for converting text files encoding:

Software RAID 1 And LVM

While adding more capacity to my Ubuntu 12.04 based server I decided to use two disks in RAID 1 – although the whole topic is well discussed and described, it still took me some time to put all pieces together, so here I’d like to share my experiences. Plus there are couple of decision point on the way, so I’d like to explained my decisions, based on informations  I read. Continue reading Software RAID 1 And LVM

Diskless PC (booting from USB stick) with Ubuntu

Recently I decided to revamp my linux HTPC and this time to do it properly – there is no disk and all media are on separate server (or NAS – I prefer server, because I’d like to run some other things there, which might be problematic to run on pure NAS box). New PC should boot from from common USB stick – 8GB – value around 5 EUR (I thought it would be more convenient to build  system and I did not have any server yet to boot from network only – actually old HTPC would become server, but first new HTPC has to be created). To overcome two major issues of common USB stick – limit on number of write operations (too much writes decrease lifetime of the stick) and slow write operations speed I decided to use overlays file system (or sometimes called union file system), where (once all system is set up) all writes go to memory – this is similar to linux live CDs or USB sticks. In order to be able to do some user customizations after installation and that user can save various data his home directory, the home directory is hosted on server/NAS and shared via NFS. The  recipe described below is for xubuntu 12.10. Continue reading Diskless PC (booting from USB stick) with Ubuntu

Quick And Dirty Oracle Backup

I have an Oracle 11g installation running in virtual machine (under Xen). Oracle is used for APEX development and some host few local applications for our team. From time to time I need to do cold backups – to keep data around or to move them to another VM on different server, which is running identical version of oracle  and can be used as cold backup eventually.   The backup device is an USB disk with FAT32 filesystem (FAT32 was chosen a while ago for compatibility reason – to be able to attach it to almost any OS) and the disk is attached to other server. FAT32 means that there is a limit on file size, so the database backup need to be split to chunks (backup is 10-15 GB). Of course RMAN can do proper job, but since I’m no real DBA I want to have something quick ( data are not mission critical and also it is no problem to bring DB down) – so warning do not apply this procedure for important databases – no guarantee that it will work in all circumstances and you may loose your data . Continue reading Quick And Dirty Oracle Backup