Status of a Software RAID under Linux

February 14th, 2010 Category: Linux, Linux Server

You might want to check the rebuild status of your Linux software RAID e.g. after a disc failure or a hard server crash. As you know this might take several hours, depending on the disc size.

In my case mdadm is used to configure the software RAID and mdadm –detail /dev/md1 can be used to show the rebuild status:

[root@hxxxxxxx ~]# mdadm --detail /dev/md1
/dev/md1:
Version : 00.90
Creation Time : Thu Nov  9 18:57:15 2006
Raid Level : raid1
Array Size : 159726144 (152.33 GiB 163.56 GB)
Used Dev Size : 159726144 (152.33 GiB 163.56 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Persistence : Superblock is persistent

Update Time : Sun Feb 14 19:45:21 2010
State : active, resyncing
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Rebuild Status : 31% complete

UUID : be29700c:083d0c62:67a9c130:e044323b
Events : 0.3626065

Number   Major   Minor   RaidDevice State
0       8        3        0      active sync   /dev/sda3
1       8       19        1      active sync   /dev/sdb3

In my case 31% of the rebuilt process are finished. We still have to wait a little bit..

Links

Bash Prompt too long?

May 5th, 2009 Category: Linux

People often using Putty, xterm or any other Linux test based console will probably now this annoying issue:

  • Changing into a deeper directory structure will create an incredible long bash prompt

For me it was quite annoying to have the prompt sometimes wider than the terminal window. In Debian standard configuration this is the case. So I decided to shorten the prompt.

I kept my prompt very simple, the only thing you have to do is to add the following lines to your ~/.bashrc

export PS1="[\u@\h \W]\\$ "
export PS2="> "

Make sure to add it at the end of your .bashrc file in your home directory. Otherwise it may be overwritten by other prompt definitions in your .bashrc.

Before

harry@h1096660:/usr/local/include/ffmpeg$

After

[harry@h1096660 ffmpeg]$

Better :)

Further links and examples

Linuxcaffe in Toronto

March 28th, 2009 Category: Fun, General, Linux

Received from a friend while he was on a holiday trip in Toronto. A Linuxcaffe pretty cool I think. Nowadays Linux seems to be everywhere! Thank you Bogi for this nice shot.

img_6842.jpg

Linux under Windows with andLinux

March 25th, 2009 Category: Linux, VMWare

Nowadays there are several virtualization products like VMWare and Virtual PC available. Searching the Internet I came across coLinux and andLinux. This free and open source tools allow you to run Linux natively on your Windows PC.

coLinux is the base – a port of the Linux kernel which allows you to run Linux cooperatively on your Windows PC. andLinux is a complete Ubuntu Linux system which uses coLinux, Xming as X server and PulseAudio as sound server.

I’ve tried andLinux on my Windows XP notebook, installation was easy. Quite nice if you also want to have Linux running on your PC without purchasing other products. You can start Linux applications and they appear like a regular Windows application on your desktop.

andLinux offers some more features:

  • Access from Linux applications to Windows filesystem
  • Quick start of Linux applications from Quicklaunch bar
  • Easy start of applications from KDE Start menu

See also:

Definitely a try worth!

andlinux.jpg

How To Change Time Zone in Linux

March 7th, 2009 Category: Linux

On modern Linux systems the time zone can be changed using the command:

dpkg-reconfigure tzdata

Now you will be prompted to choose your desired time zone.

How the time zone can be change manually can be found here:

Get Information of Media Files with MediaInfo

February 17th, 2009 Category: General

If you deal with media files like audio and video you will sometimes need more technical information about such files, like codec, bitrate, fps, aspect ratio and more. To gather such information there is a nice tool called “MediaInfo” available for download. Once installed MediaInfo just right click on your media file and open it with MediaInfo. That’s all.

mediainfo-ctempksc_111708_126_launch_1080wmv-17022009-200155.jpg

Which information does it display?

  • General: title, author, director, album, track number, date, duration…
  • Video: codec, aspect, fps, bitrate…
  • Audio: codec, sample rate, channels, language, bitrate…
  • Text: language of subtitle
  • Chapters: number of chapters, list of chapters

Which kind of formats (containers) does it support?

  • Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB)…
    (Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC…)
  • Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF…
  • Subtitles: SRT, SSA, ASS, SAMI…

For more details visit the MediaInfo homepage. Download is available for Windows, Mac and Linux operating systems.

mediainfo-ctempksc_111708_126_launch_1080wmv-17022009-185640.jpg

Video Player for Windows/Linux/MAC

February 15th, 2009 Category: General

You are looking for a video player which simply plays your movies? Sounds easy, but usually the Microsoft Media Player complains some missing codecs, other players are slow, often crashing… Watching different kind of video formats seems difficult on the PC. Too many formats are available, .WMV, .MOV, .MPG, .AVI and many more.

The crazy thing: .WMV is not equal .WMV. The codec behind is really a different thing. In my opinion best solution would be that only MPEG2 and MPEG4/H.264 would be used. But as usual licensing and other policital issues make it more difficult. So we are faced to a very high number of video formats and codecs.

Quite annoying for the user who only wants to watch a movie which will often not work. My suggestion is to use the VLC media player. It’s free to use,  supports almost any video format and works on all well known operating systems.

Furthermore it supports many options for video streaming. Below is a screen shot of a NASA HD video which shows the Endeavor launch on mission STS-126. There you will find other HD videos.

See also:

ksc_111708_126_launch_1080.jpg

Make VIM Nice Looking

February 10th, 2009 Category: Linux

Linux users usually know the text editor called “vi”. For beginners it’s tough to use and the look and feel is not very nice. “vim” which means vi-improved brings many improvements. To make vim more nice looking I’ve put my settings for your .vimrc together. I personally like the following settings:

  • Syntax highlighting
  • Different color scheme
  • Disable indenting when copy and pasting a text from clip board
  • Replace tabs with blanks
  • Use 2 spaces as tabs instead of 4 spaces
  • Improve the search
  • Display cursor position

Open the .vimrc in your home directory and add the following settings:

" enable syntax highlightning
syntax enable

" set a different color scheme
colorscheme desert

" avoid identing when pasting a text
set paste

" enable auto indent
set autoindent

" expand tabs to spaces
set expandtab

" set the tab stop to 2 spaces and soft tab stop to 2 spaces
set tabstop=2 sts=2
set shiftwidth=2

" immediately search and display the typed search pattern
set incsearch

" highlighting of search matches
set hlsearch

" show cursor position
set ruler

Much better now! Try the search (e.g. ESC /high) and you will recognize that the search pattern will be immediately highlighted when you enter it.

Note: If you want to replace all tabs within an existing file you can now use the vi command “:retab” and all tabs will be removed according the settings done in your .vimrc.

And finally the result:

planlosorg-putty-10022009-192707.jpg

Network Bandwidth Performance Measurement with Iperf

January 10th, 2009 Category: Linux

Another easy to use tool for measuring the network bandwidth is Iperf. On Debian it can be installed using:

apt-get install iperf

Optionally the source or the Windows binary is available from sourceforge.net/projects/iperf

Building and installing from source is done using a few commands:

tar xvfz iperf-2.0.4.tar.gz
cd iperf-2.0.4
./configure
make
make install

Once installed iperf the server is started on machine 1:

machine1:~# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

Next the client is started on machine 2:

machine2:~# iperf -c machine1.mydomain.de
------------------------------------------------------------
Client connecting to machine1.mydomain.de, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local xx.xx.xx.xx port 45325 connected with yy.yy.yy.yyport 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  96.6 MBytes  80.9 Mbits/sec

Tested on two servers connected with 100 MBit/s located at two different providers in Germany we get a result of 80.9 MBits/sec.

This result is slightly higher compared to the result from our measurement done with NETIO in the article Network Throughput Measurement. So we start the test again with addtional parameters:

machine2:~# iperf -c machine1.mydomain.de -w 512k -l 512k
------------------------------------------------------------
Client connecting to machine1.mydomain.de, TCP port 5001
TCP window size:   256 KByte (WARNING: requested   512 KByte)
------------------------------------------------------------
[  3] local xx.xx.xx.xx port 40987 connected with yy.yy.yy.yyport 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  72.0 MBytes  60.3 Mbits/sec

Now using modified read/write buffer size and TCP windows size we get almost the same result as in our test with netio.

Definitely a tool which can be recommended to check your network throughput!

Network Throughput Measurement

January 10th, 2009 Category: Linux Server

A real nice and easy to use tool for measuring the network throughput on Linux/Unix as well as Windows is NETIO. You only need to download the binaries from the NETIO homepage, store on your server or clients and execute them.

The example below shows a sample measurement between to servers connected with a 100 MBit ethernet card and located at two different providers.

On one machine NETIO is started as server:

machine1:~/netio/bin# ./linux-i386 -s

NETIO - Network Throughput Benchmark, Version 1.26
(C) 1997-2005 Kai Uwe Rommel

TCP server listening.
UDP server listening.
TCP connection established ...
Receiving from client, packet size  1k ...
Sending to client, packet size  1k ...
Receiving from client, packet size  2k ...
Sending to client, packet size  2k ...
Receiving from client, packet size  4k ...
Sending to client, packet size  4k ...
Receiving from client, packet size  8k ...
Sending to client, packet size  8k ...
Receiving from client, packet size 16k ...
Sending to client, packet size 16k ...
Receiving from client, packet size 32k ...
Sending to client, packet size 32k ...
Done.
TCP server listening.

On the other machine NETIO is called e.g. with -t option for TCP and the name or IP of the other machine:

machine2:~/netio/bin# ./linux-i386 -t machine1.mydomain.de

NETIO - Network Throughput Benchmark, Version 1.26
(C) 1997-2005 Kai Uwe Rommel

TCP connection established.
Packet size  1k bytes:  7309 KByte/s Tx,  7645 KByte/s Rx.
Packet size  2k bytes:  7276 KByte/s Tx,  7724 KByte/s Rx.
Packet size  4k bytes:  7291 KByte/s Tx,  7737 KByte/s Rx.
Packet size  8k bytes:  7276 KByte/s Tx,  7723 KByte/s Rx.
Packet size 16k bytes:  7286 KByte/s Tx,  7719 KByte/s Rx.
Packet size 32k bytes:  7291 KByte/s Tx,  7725 KByte/s Rx.
Done.

We take a rough average of the result can multiply it by 8: 7,5 * 8 = 60 MBit/s. This is a acceptable value for a connection between two servers located at different providers within Germany.

For sure a useful tool! Also check Network Bandwidth Performance Measurement with Iperf