jump to navigation

Loading US Keyboard Map QWERTY on Linux 14 March 2011

Posted by Maulvi Bakar in : Linux,Work , 1 comment so far

Sometimes, when you’re supporting machines located on various parts of the world, you’ll encounter machines with funny keyboard arrangements.

This is normal!

Different parts of Europe and Canada uses different keyboard language layout. You’re using a machine with US Keyboard layout to access these machines and to change the layout to it, issue the following commands –

/bin/loadkeys /usr/share/kbd/keymaps/i386/qwerty/us.map.gz

Inside the same directory lists a bunch of other commonly/un-commonly used keyboard keymaps. Your mileage vary depending were you’re located from and what type of keyboard you’re using.


Solaris Ping Results 17 February 2011

Posted by Maulvi Bakar in : Unix,Work , add a comment

Ever tried to ping a host on a Solaris machine?

$ ping pong

pong is alive

You’ll get a plain ‘is alive’ results. If you need packets received and timing information, you have to add the option -s like thus –

user@tennis:/usr/sbin > ping -s pong

PING pong: 56 data bytes
64 bytes from pong (x.x.x.x): icmp_seq=0. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=1. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=2. time=2. ms
64 bytes from pong (x.x.x.x): icmp_seq=3. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=4. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=5. time=0. ms

----pong PING Statistics----
6 packets transmitted, 6 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/2

Funny Solaris trying not to conform with the rest of the *NIX community.


Customizing the Bash Prompt 19 December 2010

Posted by Maulvi Bakar in : Linux,Unix,Work , add a comment

If you’re on Linux, most of the time the current existing bash prompt is fine. Other types of UNIX, in my case is Solaris, is somewhat spartan in appearance. You’ll either get a boring ‘$’ or ‘#’ or simply a display of version.

The table below are the various options available –

Personally, I just wanted to duplicate the bash prompt on Linux into Solaris. All I did was thus in the “/etc/profile” –

export PS1
PS1='[\u@\h:\w]\$ '

Remember to use single quotes ” ‘ ” rather than the double quotes. Otherwise the “\$” will not work.


Howto: Disable GUI Desktop on Solaris 10

Posted by Maulvi Bakar in : Unix,Work , add a comment

My life seems to be centered around *NIX. After many false start, I am about to embark on a serious Solaris journey.

*NIX politics aside. I’ve formed judgment already, but I reserve publishing it at the moment. For the time being, enough said – it is a pure workplace choice.

# date;uname -a;uptime
Sun Dec 19 14:27:32 MYT 2010
SunOS solaris 5.10 Generic_142910-17 i86pc i386 i86pc
2:27pm up 25 min(s), 1 user, load average: 0.01, 0.11, 1.05

By default, Oracle Solaris 10 will start with Gnome/CDE GUI interface upon start-up. To disable GUI, especially if you intend to run a headless server, do this –

# /usr/dt/bin/dtconfig -d

To enable it again, simply –

# /usr/dt/bin/dtconfig -e


Apache Reverse Proxy to VirtualHost- Centos 25 October 2010

Posted by Maulvi Bakar in : Linux , add a comment

This is a classic ones. I first encountered this, apply it and forgotten about it.

Always – always – always remember to specify into “/etc/httpd/conf/httpd.conf” the option below –

NameVirtualHost *:80

Then, create the individual “VirtualHost” entries either within the httpd.conf or as separate entries in “/etc/httpd/conf.d/”

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ProxyPass / http://x.x.x.x:8080
ProxyPassReverse / http://x.x.x.x:8080
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common


Malaysian Fuel Economy 12 December 2009

Posted by Maulvi Bakar in : Society , add a comment

Today I make a discovery with mixed feelings.

My main mode of transportation is a japanese-made K-Car, locally assembled and branded.  I love that car. It is small, zippy and cute too.  Just nice for my own personal use.

The Malaysian government introduces a new type of petrol/gasoline a few months ago – RON95 and phases out the RON92.  At the same time, the price for RON97 was raised to RM2.05 per litre and RON95 was priced at RM1.80 per litre, the old price for RON97.

Just like sheep, I too committed and tried this new type of fuel. After all, the one which we’re used to are now more expensive, litre-wise. Soon after, I noticed some significant differences when using the RON95 fuel. On one hand, I seem to be missing somewhere about 50KM total of mileage out of a full gas-tank. On the other, my trusty, zippy car now seems to lost it’s pickup and responsiveness.

In response to this new development in my car driving experience, I decided to do a little test –

On a full gas-tank of RON95, I decided to the risk of really pushing the distance. With a sharp-eye on the fuel indicator, waiting until the needle went past ‘Empty’, only then I pull into a gas station for a refill. Usually, it was 430KM, this time, I managed to squeeze 450KM!

The refill was at 35 litres! Thus if I am to refill with RON95 at RM1.80 per litre for 35 litres, with a mileage of about 12.85KM per litre, it will set me back by RM63.

This time, I tried refilling with RON97 fuel at RM2.05 per litre for 35 litres. A full tank of RON97 costs me RM71.75

Now with RON97, I really drove my car almost like a maniac!  Mind you, almost!! I am not a total maniac.  But the responsiveness returned!! I really love it!  The car was so speedy that on the way back home from work on one fine day causes a hatchback german-made luxury car said to be imported from the state of Bavaria felt it’s ego challenged.  No dispute that he’s the emperor of the roads and a K-Car is not your class of competition but some people really do wants to show-off like kids!

Enough digressing, I am sure everyone’s more interested in the mileage distance. Bear in mind, while on Ron95, I drove normally.  On RON97, let’s just say – I enjoyed driving.  This time the distance is 515KM.  I am sure I can go further.  But when I refill the gas-tank again, with RON97, it’s 35 litres!

Let’s calculate – RON97 at 35 litres at RM2.05 per litres, I achieved 515KM.  That gives me 14.71KM per litre! It sets me back by RM71.75 for the 35litres.

If I am to achieve 515KM on RON95 at 12.85KM per litre, I have to put in 40 litres of fuel  which will cost me RM72. Now the difference is so slight here!  But I believe I can achieve better results if I did not substitute a brick for my foot on the accelerator and if I drive more like sane people like everyone else. (No! I believe I am sane, everyone else are maniacs!)

Furthermore, the response that I get from my car is simply fantastic!.  The difference where it counts might be insignificant, but just count how many cars are out there in the streets! Imagine the amount of profit that they rake!  I am driving a car with a fairly efficient engine.  How about those who drove cars with really bad fuel consumption technology? Those on Carburetors instead of Fuel Injections – Uh! disclaimer, I don’t even know what those words means!

Anyhow, enjoy!!

Centos Public Mirror – http://centos.maulvi.net 15 October 2009

Posted by Maulvi Bakar in : Linux,Society,System , 1 comment so far

To the world..

I present the Centos Public Mirror hosted on http://centos.maulvi.net

Basically, I’ve been installing and re-installing centos over and over and over..  Also, at any one time, I have a bunch of centos boxes running both physically and virtually.  This prompts me to run my own centos mirror.  It’s twofold – it saves time and make it easier for me to simply grab any packages.

Then I had a revelation – after leeching from the community, it’s time to give back something… This mirror is one small way I could do to give back and with a big THANK YOU to the wonderful centos linux community.


Creating a new Linux RAID1 device and extending an existing LVM Volume onto it. RHEL/Centos 5 13 June 2009

Posted by Maulvi Bakar in : Linux,System , add a comment

I’m seriously into server consolidation and virtualization.  I’m going to eliminate my other VMWare server and just concentrate on one.

First order of the day is to upgrade the RAM and Available HDD space. Upgrading the RAM is simple enough, just add/replace the modules.

Expanding the available space is another matter.  This is actually an extension of my previous posting – New HDD, enlarging Red Hat/Centos ext3/lvm partition, but there’s another factor in the equation, RAID1 (Mirroring) devices.

The existing root partition resides in an LVM partition which in turn resides in a RAID1 (Mirroring) Multi-Disk (MD) partition which is based on a twin 400GB HDD configuration.

I’ve acquired a pair of 500GB HDDs. Now to extend the existing LVM ontothe newly acquired disks in a RAID1 configuration.

Step 1 is to create Software RAID partitions on the said disks –
# fdisk /dev/sdc
# fdisk /dev/sdd

Create a new ‘sdc1’ and ‘sdd1’ partitions using type FD, which is Linux RAID Autodetect.

Next, we need to create the Multi-Disk Volume –
# mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1
Since I already have ‘md0’ for my ‘/boot’ and ‘md1’ is the existing volume with the existing LVM that was the intended target for expansion, thus naturally I’m using ‘md2’.

Basically, I am creating ‘md2’ device in RAID1 configuration using 2 devices namely ‘/dev/sdc1’ and ‘/dev/sdd1’.

You can monitor the status of your RAID devices using ‘/proc/mdstat’ –
# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdd1[1] sdc1[0]
487331648 blocks [2/2] [UU]
[>....................] resync = 1.9% (9622656/487331648) finish=90.0min speed=88417K/sec

The steps here onwards are basically the same as previously mentioned here, the only difference is the ‘/dev/md2’ device is the target.

To start, we need to create a Physical Volume within the newly created ‘/dev/md2’ RAID device.
# pvcreate /dev/md2

After that we will extend the existing volume ‘VolGroup00? onto the newly created physical volume.
# vgextend VolGroup00 /dev/md2

Once done, the next step is to extend the Logical Volume within the volume group to use the free space newly made available when you extend the volume group previously.
# lvextend /dev/VolGroup00/LogVol00 /dev/md2
Here is the difference where I did not specify the space size to extend as the default will be to use all available spaces.

And finally, we’ll enlarge the ext3 partition to make use of the newly available free space in the logical volume.
# resize2fs /dev/VolGroup00/LogVol00


HPUX Breaking Mirror and Extending LVM 2 June 2009

Posted by Maulvi Bakar in : Unix,Work , add a comment

I’m learning new things nowadays..  Particularly HPUX.  Not really my cup of tea since it not open-source but interesting enough though.

We had one machine with mirrored harddisks with one being faulty that needs removal.

Break mirror procedure..

1. Remove the mirror on the Logical Volume affected within the Volume Group
lvreduce -m 0 /dev/vg01/lvol1 /dev/dsk/c2t0d0
lvreduce -m 0 /dev/vg01/lvol2 /dev/dsk/c2t0d0

2. Now remove the Volume Group from the Physical Volume that is targeted for removal
vgreduce /dev/vg01 /dev/dsk/c2t0d0

3. Finally remove the Physical Volume from the Physical Disk
pvremove /dev/rdsk/c2t0d0
Please note the ‘r’.. ‘r’ stands for physical disk, while the one without is the physical volume..

Restore mirror procedure…

1. First, let’s verify things
ioscan -funC disk
pvdisplay /dev/dsk/c1t0d0        # get lvm info of existing disk.
pvdisplay /dev/dsk/c2t0d0        # get err, no lvm def on it, raw disk.

2. Now we create the Physical Volume within the Physical Disk and extend the Volume Group onto it.
pvcreate /dev/rdsk/c2t0d0        # add physical disk to be used by LVM
vgextend /dev/vg01 /dev/dsk/c2t0d0    # incorporate new disk to existing vg00

2a. If you’re recreating a bootable disk, the commands below must be used instead –

pvcreate -B /dev/rdsk/c2t0d0        # add physical disk to be used by LVM and make it bootable
vgextend /dev/vg01 /dev/dsk/c2t0d0    # incorporate new disk to existing vg00
mkboot -a "hpux -lq /stand/vmunix" /dev/dsk/c2t0d0     # install the bootloader

3. Check and verify!
strings /etc/lvmtab            # see new disk used by lvm

4. The next steps will actually perform the mirror, and it will fail if -m mirroring option is not activated with valid license
lvextend -m 1 /dev/vg01/lvol1 /dev/dsk/c2t0d0    # add mirror for lvol1
lvextend -m 1 /dev/vg01/lvol2 /dev/dsk/c2t0d0    # add mirror for lvol2


Changing user’s file ownership across the board 25 December 2008

Posted by Maulvi Bakar in : Linux,Unix,Work , add a comment

The guys from the promised database lands had their systems acting funny.  After investigation, they found out that, their files was having the wrong group ownership.

There’s a total of 70,000 files involved.  Promised lands or not, manually changing 70,000 files (and folders) is not a good prospect.  Well, I could go through the individual sub-folders but I would need to work from the last in-depth sub-folders and work my way out.  Even that does not guarantee accuracy, since there might be sub-folders with multiple owners which I’m not suppose to touch.  When that happen, then I have to go through it manually looking at each files and folders individually – not good.

There has to be a short-cut.

I know I can locate all the files that needs to be changed it’s ownership by using the following commands –
find ./ -user someuser -group wronggroup -print

It’ll list all the relevant files and sub-folders. At first, maybe I’ll output it into a file, all the results. Manipulate the file into an executable. Append each lines with a “chgrp correctgroup” and have something like – “chgrp correctgroup ./to/the/path/of/the/file”.

I am smart, hey! 😉

Let’s prove that I can be smarter  😛

Vanity and pride are different things, though the words are often used synonymously. A person may be proud without being vain. Pride relates more to our opinion of ourselves; vanity, to what we would have others think of us.

Jane Austen

No, I’m just trying to figure out the best way of doing things.

“xargs -t <commands>”

xargs is a command of Unix and most Unix-like operating systems. It is useful when one wants to pass a large number of arguments to a command. Arbitrarily long lists of parameters can't be passed to a command, so xargs will break the list of arguments into sublists small enough to be acceptable.

xargs - build and execute command lines from standard input

The “-t” is for the verbose option. It’ll spew out the output of the commands being executed.

Basically, every time the output of the earlier “find”, it’ll append the extra commands specified and have it executed. Voila, no need to make a separate executable. My solution is thus –

find ./ -user someuser -group wronggroup -print | xargs -t chgrp correctgroup

Happy 4th Anniversary to myself  😉

Merry Christmas everyone!