Posts

Showing posts from April, 2011

RAID 01 Vs RAID10

Difference between RAID 0+1 vs RAID 1+0? We have covered RAID levels before in our posts. You can read about the different RAID levels here and the I/O characteristics here.  While building up a DR (Disaster Recovery) environment for one of our clients, one of the questions asked by the client was: “How is RAID 1+0 different than RAID 0+1?”.  Both RAID 0+1 and RAID 1+0 are multiple RAID levels which means that they are created by taking a number of disks and then dividing them up into sets. And within each of these sets, a single RAID level is applied to it in order to form the arrays.  Then, the second RAID level is applied at the top of it to form the nested array.  RAID 1+0 is also called as a stripe of mirrors and RAID 0+1 is also called as a mirror of stripes based on the nomenclature used for RAID 1 (mirroring) and RAID 0 (striping).  Let’s follow this up with an example: Suppose that we have 20 disks to form the RAID 1+0 or RAID 0+1 ar...

What RAID is Best for You?

What RAID is Best for You? Most of you are familiar with the basic RAID technologies avaible out there today, but it is always good to have too much information about this topic than not enough. Here is a brief yet informative summary of the most popular hardware RAID configurations, including pros and cons for each: RAID-0 (Striped) Does not provide fault tolerance Minimum number of disks required = 2 Usable storage capacity = 100% This is the fastest of the RAID configurations from a read-write standpoint Is the least expensive RAID solution because there is no duplicate data Recommended use for temporary data only RAID-1 (Mirrored) Fault tolerant – you can lose multiple disks as long as a mirrored pair is not lost Minimum number of disks required = 2 Usable storage capacity = 50% Good read performance, relatively slow write performance Recommended for operating system log files RAID-5 (Striped with Parity) Fault tolerant – can afford to lose one disk only Mi...

Useful Linux Tips

Task File / Command Startup script /etc/rc.d/rc Kernel /boot/vmlinuz Kernel Parameters sysctl -a Reconfigure the kernel cd /usr/src/linux  make mrproper   make menuconfig   make dep   make clean   make bzImage  make install  make modules  make modules_install cp arch/i386/boot/bzImage /boot/vmlinuz-2.2.16  mkinitrd /boot/initrd-2.2.16.img 2.2.16  vi /etc/lilo.conf  lilo List modules lsmod Load module insmod Unload module rmmod Initialize system netconf Physical RAM free -m Kernel Bits getconf LONG_BIT Crash utility lcrash Trace System Calls strace Machine model uname -m OS Lev...

Linux Admin Q&A

Interview Questions And Answers Q: - How are devices represented in UNIX? All devices are represented by files called special files that are located in /dev directory. Q: - What is 'inode'? All UNIX files have its description stored in a structure called 'inode'. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode. Q: - What are the process states in Unix? As a process executes it changes state according to its circumstances. Unix processes have the following states: Running : The process is either running or it is ready to run . Waiting : The process is waiting for an event or for a resource. Stopped : The process has been stopped, usually by receiving a signal. Zombie : The process is dead but have not been removed from the process table. Q: - What command should you use to check the number of files and ...

Apache Interview QA

Interview Questions And Answers Q: - What is location of log files for Apache server ? /var/log/httpd Q: - What are the types of virtual hosts ? name-based and IP-based. Name-based virtual host means that multiple names are running on each IP address. IP-based virtual host means that a different IP address exists for each website served. Most configurations are named-based because it only requires one IP address. Q: - How to restart Apache web server ? service httpd restart Q: - How to check the version of Apache server ? rpm -qa |grep httpd Q: - What is meaning of "Listen" in httpd.conf file ? Port number on which to listen for nonsecure (http) transfers. Q: - What is DocumentRoot ? it is a location of files which are accessible by clients. By default, the Apache HTTP server in RedHat Enterprise Linux is configured to serve files from the /var/www/html/ directory. Q: - On which port Apache server works ? http - port 80 https - port 443 Q: - Tell me...

Redirect thread dump to another file?

On Jboss or Tomcat application server, we usually use kill -3 PID to get thread dump to default STDOUT which is catalina.out under $Tomcat_Home/logs folder. It might be nature to use command kill -3 PID > some.file 2>&1 to try to redirect the thread dump info to some.file than default one. However, it will not work. The reason is kill is just a command to send a signal to a process. You are redirecting the output of the kill command itself rather than the process (what the process does upon receipt of a signal is separate), so the redirect (supposed to kill command itself) has no effect on which file the process (PID) will write to. Given that, if we need redirect thread dump for that process to some other file, we need add redirects to that process when it starts. Another popular way is to use jstack -F PID to get the whole thread dump forcefully. "jstack" : A JVM troubleshooting tool that prints stack traces of all running threads of a given JVM proce...

Taking Thread Dump in Linux

Generating a Thread Dump on Linux, including Solaris and other Unixes 1.) Identify the java process that JIRA is running in: This can be achieved by running a command similar to: [root@server2~]#ps -ef | grep java root      8876  8854 12 10:54 pts/5    00:08:37 /usr/jdk1.6.0_16/bin/java -Dprogram.name=run.sh -server -Xms256m -Xmx1024m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/data2/jboss/lib/endorsed -classpath /data2/jboss/bin/run.jar:/usr/jdk1.6.0_16/lib/tools.jar org.jboss.Main -c all -b 192.168.2.102 -Djboss.messaging.ServerPeerID=1 root     10154  9577  0 12:02 pts/3    00:00:00 grep java   2.) Find the process ID of the JVM and use the ps command to get list of all processes:  kill -3 The thread dump will be printed to Confluence's stan...

Java Thread Dump

Understanding a Java thread dump 1. Introduction In my opinion, one of the greatest things about Java is the ability to get meaningful thread dumps on a running production environment without having to enable DEBUG mode. The thread dump is a snapshot of exactly what's executing at a moment in time. While the thread dump format and content may vary between the different Java vendors, at the bare minimum it provides you a list of the stack traces for all Java threads in the Java Virtual Machine. Using this information, you can either analyze the problem yourself, or work with those who wrote the running code to analyze the problem. 2. What is a stack trace? I mentioned earlier that the thread dump is just a list of all threads and the full stack trace of code running on each thread. If you are a J2EE Application Server administrator and you've never done development before, the concept of a stack trace may be foreign to you. A stack trace is a dump of the curre...

How to log output of remote ssh session ?

There are many instances when you are going to ssh to remote server for troubleshooting and data gathering purposes and you want to save those data in your computer. There is a less frequently but useful "tee" command which could be used to log all output in a remote ssh session. What it will actually do is that it will generate one file which will capture all the commands as well as their output. ssh user@remote.server.com | tee /path/of/log/file This command is very useful for troubleshooting purposes. !Enjoy Kuldeep Sharma

Some Interview Stuff

Image
1) Define a deamon? Ans: In Unix or Other Multitasking Operating Systems a Daemon is a computer program that runs in Background, rather than under the control of a user. These are usually Intiated as Background processes.Typically Daemons have names that ends with "d" e.g. mysqld,syslogd,pptpd,sshd etc. 2.) Can we use crontab to run a script per second? if yes how? if no why? Ans: I think we can't. In crontab (the one the user can edit) the smallest timeperiod is 1 minute. The crontab deamon, which checks the crontab file, runs every 30 seconds.          But we can make use of some scripting to run script after some seconds but not every second. 3)I have a file each line contains “/var/www/html”, replace this entry in all lines with “/home/xyz/red”  with single command or an editor. Ans: For this make the use of sed(Stream Editor) command by using some other separator than "/".    AS :   #sed -i 's#/var/www/html#...