Archive for May, 2009

Automated DVD Backup

May 31st, 2009 1 comment

Today I would like to share with you, a little script that I use every week. I have four rewritable DVD that I use in rotation to backup important directories of my server at home. All I have to do is to leave one of these DVD+RW in the dvd drive and a backup of my important directories will be taken at regular interval. I have schedule a cron job that run tree times a week, to backup to DVD directories that are important to me. This is by no way a replacement of a full system backup like Mondo rescue, Storix or Acronis, but they represent to me the directories that are subject to change more often. I must specify that the command used in this script require using a DVD+RW to work.

Read more…

Categories: Scripting

Add date & time to your bash history

We all know the “history” command that display the list of commands you previously entered.  But have you ever wish to know when these commands were entered ?  This useful tip, will require only  a few seconds to put in place and will now add the date and time in your history file.

Output of history command before the change to .bashrc

Output of history command before the change to /etc/bashrc

Read more…

Categories: Tips & Tricks

Exploring vmstat command

As a system administrator, I have a variety of performance tools that I use to identify problem related to system performance. In this article, I have tried to demonstrate the usage of the “vmstat” command and also explain the meaning of each column that it produce. I inserted some tips regarding the interpretation of theses columns, I wanted to make this article a reference for me and hopefully for you too.  So the next time you use the command ” vmstat”,  you can come back at this article and analyze the output of your problematic system.

First let’s look at different way we can invoke the “vmstat” command.  To monitor the virtual memory activity on your system,  it is preferable to use “vmstat” with a delay. A delay is a number of seconds between updates. If you don’t supply a delay “vmstat” reports the average values since the last reboot and quit.  With the delay, you can also specify a count, which indicate how many updates you want to see before “vmstat” quits. If you don’t specify a count, the count defaults is infinity and you will have to press CTRL-C to stop “vmstat”.  In our example, we asked  “vmstat” to run with four updates with a delay of five seconds between update.

vmstat figure 1

vmstat figure 1

procs section
The procs section indicate the number of running processes (r) and blocked (b) processes at the time of the reporting. The scheduler determines when processes are run. Each process is assigned a priority and a slot in the process table. Processes must be present in memory before they are run. If a process is scheduled to run but a memory page for part of that process is not in real memory, that process is blocked and placed in the run queue. Processes ready to run are placed in the run queue, “vmstat” reports on processes that are in the run queue and those that are blocked.

  • (r) – Represent the number of runnable processes in the run queue. The value should be a sigle-digit on a healthy server, but can occasionally get higher. From my experience when it reach number greater than 20 on some big and busy system you should have a look on the system and see what process is taking most of the cpu (use the top command).
  • (b) – This value represent the number of processes scheduled to be executed but blocked, waiting for the virtual memory to page the part of that process which is on disk into real memory. This number should also be a single digit on a healthy system.

Read more…

Categories: Performance