You are on page 1of 17

###Linux System Administrators Guide:### Q. How to create manually new device in linux? A.

Thorugh MAKEDEV script # /dev/MAKEDEV -v ttyS0 create ttyS0 c 4 64 root:dialout 0660 This will create the device file /dev/ttyS0 with major node 4 and minor node 64 as a character device with access permissions 0660 with owner root and group di alout. mknod also perrofm that works but for that you need major and minor numbers of deviess from devices.txt Q. How many kind of devices linux recoznize? A. UNIX, and therefore Linux, recognizes two different kinds of device: randomaccess block devices (such as disks), and character devices (such as tapes and s erial lines) The first character in the first column, i.e., `c' in crw-rw-rw- above, tells a n informed user the type of the file, in this case a character device. For ordin ary files, the first character is `-', for directories it is `d', and for block devices `b '; IDE=/dev/hda SCSI=/dev/sda

Q. How many partition are created in HDD? A. fdisk -l /dev/hda Q. What is superblock? A. The superblock contains information about the filesystem as a whole, such as its size (the exact information here depends on the filesystem) Contains information about file system such as: File system type Size Status Information about other metadata structures Q. How to view super block in FS? A. Linux maintains multiple redundant copies of the superblock in every file sys tem. This is very important in many emergency situation, for example you can use back up copies to restore damaged primary super block. # dumpe2fs /dev/hdaX | grep -i superblock Primary superblock at 0, Group descriptors at 1-1 Backup superblock at 32768, Group descriptors at 32769-32769 Backup superblock at 98304, Group descriptors at 98305-98305 Backup superblock at 163840, Group descriptors at 163841-163841 Backup superblock at 229376, Group descriptors at 229377-229377 Backup superblock at 294912, Group descriptors at 294913-294913 Q. How to resotre FS from backup Superblock? A.#dumpe2fs /dev/sdaX chose your backup superblock number to restore. e2fsck -f -b <superblock no.> /dev/sdaX Q. Hard link vs soft link? A. Hard link indicates same inode nos sofr link diffrent inode.

Q. What is inode? A. The inode (index node).An inode contains all information about a file, excep t its name. The name is stored in the directory, together with the number of the inode. A directory entry consists of a filename and the number of the inode which repr esents the file. Q. Wahat is data block? A. The inode contains the numbers of several data blocks, which are used to sto re the data in the file. There is space only for a few data block numbers in the inode. Q. How do you get file inode with IO block? A. #stat file name Q. Ext2 Max file size? A. 16GB to 2TB4 And Max FS size Q. FS all info? A. dumpe2fs /dev/sda1 Q. What tar stands for? A. Tape Archive Q. Tell me the name of linux partition which has no FS? A. swap and raw disks Q.What is virtual memory? A.Linux supports virtual memory, that is, o that the effective size of usable memory The part of the hard disk that is used as ce. A swap file is an ordinary file; it is The only thing that matters to the kernel is prepared for use with mkswap Q. How to create file swap A. dd if=/dev/zero of=/extra-swap bs=1024 mkswap /extra-swap 1024 swapon /extra-swap Q. What is disk buffer and disk cache A. By reading the information from disk only once and then keeping it in memory until no longer needed, one can speed up all but the first read. This is called disk buffering, and the memory used for the purpose is called the buffer cache. Q. How to clear disk buffer? A. through sync command Q. How to get available and used inode info on every partition? A. dh -i (it means nos of files as well) Q. Which is the location of initial user profile new casec of new users A. When the home directory for a new user is created, it is initialized with fil es from the /etc/skel directory. T he system administrator can create files in /etc/skel that will provide a nice d efault environment for users. For example, he might create a /etc/skel/.profile that sets the EDITOR environme nt variable to some editor that is friendly towards new users using a disk as an extension of RAM s grows correspondingly. virtual memory is called the swap spa in no way special to the kernel. is that it has no holes, and that it 2TB to 32TB

Q. How to change User FullName and shell from singal command? A. chfn - Change the full name field. chsh - Change the login shell. Q. What is /dev/dsp? A. Digital Signal Processor. Basically this forms the interface between software which produces sound and your soundcard. Q. What is /dev/zero? A. This is a simple way of getting many 0s. Every time you read from this device it will return 0. This can be useful sometimes, for example when you want a file of fixed length but don't really care what it c ontains. Q. What would be the exact size of swap? A. I think the '2x swap space' rule came from Old Solaris and Windows admins. Al so, earlier memory mangers were very badly designed. There were not very smart. Toda y, we have very smart and intelligent memory manager for both Linux and UNIX. 1. Systems with 4GB of ram or less require a minimum of 2GB of swap space 2. Systems with 4GB to 16GB of ram require a minimum of 4GB of swap space 3. Systems with 16GB to 64GB of ram require a minimum of 8GB of swap space 4. Systems with 64GB to 256GB of ram require a minimum of 16GB of swap space http://www.cyberciti.biz/tips/linux-swap-space.html Q. How do I find out Linux Disk utilization? A. From iostat Q. How to view extendrd disk I/O informarion? A. iostat -x Linux 2.6.18-164.el5 (mail) avg-cpu: %user 1.76 03/18/2013 %idle 92.89 wsec/s avgrq-sz avgqu-sz 31.06 13.46 32.83 30.01 2.00 75.41 25.95 0.96 0.00 0.02 0.91 0.00 0.02 0.00

%nice %system %iowait %steal 0.12 3.77 1.46 0.00 wrqm/s r/s w/s

Device: rrqm/s await svctm %util sda 0.59 21.05 0.90 4.06 sda1 0.04 4.88 3.54 0.00 sda2 0.06 19.24 5.85 0.71 sda3 0.08 21.07 0.83 3.61 sda4 0.00 79.00 79.00 0.00 sda5 0.36 22.44 3.41 0.33 sda6 0.04 7.78 5.90 0.00

rsec/s

126.05 1.67 43.74 0.00 0.00 0.00 3.36 0.25 0.97 117.41 1.10 42.10 0.00 0.00 0.00 5.29 0.31 0.66 0.00 0.00 0.00

52.11 1358.31 0.05 5.43 0.00 34.65

20.49 1276.08 0.00 26.09 0.04 0.00 47.59 0.00

rrqm/s : The number of read requests merged per second that were queued to the h ard disk wrqm/s : The number of write requests merged per second that were queued to the hard disk r/s : The number of read requests per second

w/s : The number of write requests per second rsec/s : The number of sectors read from the hard disk per second wsec/s : The number of sectors written to the hard disk per second avgrq-sz : The average size (in sectors) of the requests that were issued to the device. avgqu-sz : The average queue length of the requests that were issued to the devi ce await : The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the tim e spent servicing them. svctm : The average service time (in milliseconds) for I/O requests that were is sued to the device %util : Percentage of CPU time during which I/O requests were issued to the devi ce (bandwidth utilization for the device). Device saturation occurs when this va lue is close to 100%. Q. How do I interpret the output result for optimization? First you need to note down following values from the iostat output: 1. The average service time (svctm) 2. Percentage of CPU time during which I/O requests were issued (%util) 3. See if a hard disk reports consistently high reads/writes (r/s and w/s) If any one of these are high, you need to take one of the following action: a) Get high speed disk and controller for file system (for example move from SATA I to SAS 15k disk) b) Tune software or application or kernel or file system for better disk util ization c) Use RAID array to spread the file system For example, from about iostat report it appears that /dev/sdb under load. Hope this information will help you diagnose and optimize disk related issues. http://www.cyberciti.biz/tips/linux-disk-performance-monitoring-howto.html Q. How to backup hard disk partition table (MBR)? A. For Backup - # dd if=/dev/sdX of=/tmp/sda-mbr.bin bs=512 count=1 For Restore - # dd if= sda-mbr.bin of=/dev/sdX bs=1 count=64 skip=446 se ek=446 Q. How to discover iSCSI targets? A. iscsiadm -m discovery -t sendtargets -p 192.168.1.5 /dev/sdd1 /mnt/iscsi ext3 _netdev 0 0 Q. How to delete file/dir from exiting tar? A. tar -tvf foo.tar -rw-r--r-- root/root 30 2011-09-20 17:51 etc/resolv.conf.tmp -rw-r--r-- root/root 185 2011-07-27 20:35 etc/resolv.conf -rw-r--r-- root/root 185 2011-07-27 20:35 etc/resolv.conf.pppd-backup.ppp 0 -rw-r--r-- root/root 51 2011-07-12 03:14 etc/resolv.conf~ To delete a file called 'etc/resolv.conf' from a tar ball called foo.tar, enter: # tar --delete -f foo.tar etc/resolv.conf To delete all etc/resolv.conf files, use the --wildcards opitons. It will enable pattern matching: # tar --wildcards --delete -f foo.tar 'etc/resolv.conf*' The syntax to remove a directory from a tar ball is as follows:

tar --delete -f file.tar 'path1/dir1' Q. How to adding file/dir in existing tar? A. tar -rvf test.tar tobeadd.txt tar -rvf test.tar /root/folder/ Q. How to create tar on anaother location? A. Using -C (same for extract as well) #tar -cvf test.tar file1 file2 file3 -C /tmp Q. What is zombie/defunct process? A. defunct processes is also known as a zombie processes. A Zombie process is referred as dead process which is receding on your system th ough its completed executing. In one shot we can say its a dead processes which is still in RAM. This process will be in your process table and consuming your memory. Having more defunct process will consume your memory which intern slows your sys tem. We have to kill the defunct process in order to free RAM and make system st able. Q. Why defunct process are created? A. When ever a process ends all the memory used by that process are cleared and assigned to new process but due to programming errors/bugs some processes are st ill left in process table. These are created when there is no proper communication between parent process a nd child process. Q. How to find a A. ps -ef grep | ps -aus |grep ps -el | grep defunct/zombie process? defunct -i 'z' Z

Q. How to kill defunct/zombie? A. Thorugh killing PPID of defunct/zombie. Q.What is orphan process? A. An orphan process is said to be a process which runs though parent process is terminated, these process do not know what to do and when to terminate. Q. What is difference between orphan and defunct processes? A. A defunct process is a dead process where there is no execution happening whe re as orphan process is a live process which is still in execution state but don t have parent process Q. find out what file systems supported by kernel? A. cat /proc/filesystems Q.Which priority has the process? how do u view? A. nice command is used to find the priority A2) Each process has a niceness value associated with it, which is what the kernel uses to determine which processes require more processor time than others. The higher the nice value, the lower the priority of the process. In other words, the nicer the program, the less CPU it will try to take from other processes; programs that are less nice tend to demand more CPU time than other programs that are nicer. The priority is noted by a range of -20 (the highest) to 20 (the lowest). Using ps, you can see the current nice value of all programs: # ps axl

You can see that init has a nice value of 0, while other kernel tasks associated with PID 2 and 3 have a nice value of 19 and -5 respectively. Typically, a program inherits its nice value from its parent; this prevents low priority processes from spawning high priority children Q. Any one example of uninteruptable sleeping process? A. init (PID 1) Q. what is user mode & kernel mode? A. KERNEL-MODE The kernel-mode programs run in the background, making sure everything runs smoothly things like printer drivers, display drivers, drivers that interface with the monitor, keyboard, mouse, etc. These programs all run in such a way that you don t notice them. When the computer boots up, Windows calls the KERNEL, the main kernel-mode program that allows all the other programs to run, even the user-mode programs. USER-MODE These are the programs that you run when you want specific programs e.g., MS Paint, MS Word, and Calculator. These are heavily restricted, as to not crash the system. Windows uses memory-protection services offered by the processor to prevent malicious programs from interfering with the rest of the system and corrupting it. Q. What is default block/chunk size for PV? A. 4MB Q. What is the use of sysctl command? A. The /sbin/sysctl command is used to view, set, and automate kernel settings i n the /proc/sys/ directory. Q. How to create tape archive? A. tar cvf archive_name.tar dirname/ c v f create a new archive verbosely list files which are processed. following is the archive file name

Q. How to create gzipped tape archive? A. tar cvzf archive_name.tar.gz dirname/ z filter the archive through gzip Q. How to create bzipped tape archive? A. tar cvfj archive_name.tar.bz2 dirname/ j filter the archive through bzip2 Q. What diffrent between gzip and bzip2? A. bzip2 takes more time to compress and decompress than gzip. bzip2 archival si ze is less than gzip. Q. How to extract tape acrhive? A. tar xvf archive_name.tar x extract files from archive Q. How to extrat gzipped tape archive?

A. tar xvfz archive_name.tar.gz Q. How to extract bzipped tape archive? A. tar xvfj archive_name.tar.bz2 Q. How to Listing/View files in archive using tar command? A. tar tvf archive_name.tar For gzipped - tar tvfz archive_name.tar.gz For - tar tvfj archive_name.tar.bz2 Q. How to extract a single file from tar, tar.gz, tar.bz2 file? A. first view file which you want to extract from archive using t switch then tar xvf archive_file.tar /path/to/file tar xvfz archive_file.tar.gz /path/to/file tar xvfj archive_file.tar.bz2 /path/to/file Same procdure for DIR Q. How to add file or dir in existing tape archive? A. tar rvf archive_name.tar newfile tar rvf archive_name.tar newdir/ Q. How to verify tape archive? A. using W switch Q. How to list all listen port on your server? A. netstat -a - wili stdout all listen port netstat -at - for all tcp port netstat -au - for all udp port Q. How to list all listen socket on your server? A. netstat -l - will dumpout all listen port netstat -lt - for tcp netstat -lu - for udp netstat -lx - fow unix port Q. How to get statistics on your server? A. netstat -s - for all netstat -st - for tcp netstat -su - for udp Q. How to get PID program names in netstat output? A. netstat -p Q. How to Find out on which port a program is running? A. netstat -ap | grep ssh Q. How to view network configuration from netstat? A. netstat -i netstat -ie - similler to ifconfig Q. How to list available kernel modules? A. modprobe -l | less Q. How to List Currently Loaded Modules? A. lsmode |less Q. How to install ans view new kernel module? A. modeprobe <module name> lsmode | grep <module name>

Q. How To Get Hardware Information On Linux? A. dmidecode Q. How to get I/O or disk statitcs from sar? A. sar -b 1 5 Following fields are displays in the example below. tps Transactions per second (this includes both read and write) rtps Read transactions per second wtps Write transactions per second bread/s Bytes read per second bwrtn/s Bytes written per second Q. How to view memory map of given process? A. pmap 5732/ #pmap -x 5732 (x switch for extended info) 23835: qmail-send Address Kbytes RSS Anon Locked Mode 004ed000 104 - r-x-00507000 4 - r-x-00508000 4 - rwx-00510000 1276 - r-x-0064f000 8 - r-x-00651000 4 - rwx-00652000 12 - rwx-006e7000 4 - r-x-08048000 40 - r-x-08052000 4 - rw--08053000 20 - rw--09a88000 132 - rw--b7ee8000 8 - rw--bfa2b000 84 - rw---------- ------- ------- ------- ------total kB 1704 Q. How to view all using or open file in system? A. lsof -list of open files Q. How to view socket statistics? A. ss -l and ss -s Q. How to view system calls of existing process? A. ps -ef |grep -i thunderbird root 3578 1 1 07:32 ? 00:02:14 /usr/lib/thunderbird/thunderb ird-bin root 22620 16329 0 10:35 pts/2 00:00:00 grep -i thunderbird strace -p 3578 -o thunderbird.txt tail -f thunderbird.txt Q. How to view all all system calls of specfice command on specfic FS? A. strace -c /usr/bin/thunderbird /home/dp Q. How to A. sar -u sar -P sar -P view all and specfic core utlization in liunx? 1 10 - for all CPU ALL 1 10 - for all core as -u switch 1 1 1 - this will dumpout 1st core utilization

Mapping ld-2.5.so ld-2.5.so ld-2.5.so libc-2.5.so libc-2.5.so libc-2.5.so [ anon ] [ anon ] qmail-send qmail-send [ anon ] [ anon ] [ anon ] [ stack ]

Q. How to view memory utilization (Free/Used) from sar?

A. sar -r 1 10 Q. How to view swap utilization from system activity reporter? A. sar -S 1 10 Q. How to identify number of memory pages freed, used, and cached per second by the system? A. sar -R 1 10 Q. How to generate paging statistics. i.e Number of KB paged in (and out) from d isk per second? A. sar -B 1 10 Q. How to generate page swap statistics. i.e Page swap in (and out) per second? A. sar -W 1 10 Q. How to view individual Block Device I/O Activities? A. sar -d 1 10 - it will dumpout devices by mejor and minor number wise sar -p -d 1 10 - by actual name. Q. What is major and minor number? A. http://www.linux-tutorial.info/modules.php?name=MContent&pageid=94 Major and minor numbers are associated with the device special files in the /dev directory and are used by the operating system to determine the actual driv er and device to be accessed by the user-level request for the special device fi le. Q. How to view cpu context switch info? A. sar -w 1 3 vmstat 1 10 (cs column) Q. How to view queue size of load avg of system? A. sar -q 1 10 sar -q 1 3 Linux 2.6.18-194.el5PAE (dev-db) 03/26/2011

_i686_ (8 CPU)

06:28:53 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 06:28:54 AM 0 230 2.00 3.00 5.00 0 06:28:55 AM 2 210 2.01 3.15 5.15 0 06:28:56 AM 2 230 2.12 3.12 5.12 0 Average: 3 230 3.12 3.12 5.12 0 Note: The blocked column displays the number of tasks that are currently blocked a nd waiting for I/O operation to complete. tload - view system load avg via charecter graph Q. How to view network statistics? A. sar -n KEYWORD - like DEV will show all eth statistics. DEV Displays network devices vital statistics for eth0, eth1, etc., EDEV Display network device failure statistics NFS Displays NFS client activities NFSD Displays NFS server activities SOCK Displays sockets in use for IPv4 IP Displays IPv4 network traffic EIP Displays IPv4 network errors ICMP Displays ICMPv4 network traffic EICMP Displays ICMPv4 network errors TCP Displays TCPv4 network traffic ETCP Displays TCPv4 network errors

UDP Displays UDPv4 network traffic SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6 ALL This displays all of the above information. The output will be very long . Q. How to find file name code.c in linux? A. find -name MyCProgram.c Q. How to find file from inode number? A. find -inum 16187430 Q. How to find file from permisions? A. find . -perm -g=r -type f - for those file having read permions Q. How to find empthy or 0 bytes file? A. find ~ -empty Q. How to find file by type? A. find . -type s - for socket file find . -type d - for directory find . -type f - for normal file find . -type f -name ".*" - for hidden file find -type d -name ".*" for hidden directory Q. How to A. find ~ find ~ find ~ find file by size? -size +100M - files bigger than the given size -size -100M - files smaller than the given size -size 100M - files that matches the exact given size

Q. How to Capture packets from a particular ethernet interface using tcpdump? A. tcpdump -i ethX Q. How to Capture only N number of packets using tcpdump? A. tcpdum -c 2 -i ethX Q. How to Display Captured Packets in ASCII using tcpdump? A. tcpdum -A -i ethX Q. How to Display Captured Packets in HEX and ASCII using tcpdump? A. tcpdump -XX -i ethX Q. How to Capture the packets and write into a file using tcpdump? A. tcpdump -w 08232010.pcap -i ethX Q. How to Reading the packets from a saved file using tcpdump? A. tcpdump -tttt -r data.pcap Q. How Capture packets with IP address using tcpdump ? A. tcpdump -n -i ethX Q. How to Receive only the packets of a specific protocol type? A. tcpdump -i ethX arp/icmp/igmp Q. How to Receive packets flows on a particular port using tcpdump port? A. tcpdump -i ethX port 22 Q. How to view cpu statistics from iostat? A. iostat -c Q. How to Display only disk I/O statistics?

A. iostat -d or watch -n 1 iostat -d Q. How to display only network statistics? A. iostat option -n, displays only the device and NFS statistics as shown below. $ iostat -n Linux 2.6.32-100.28.5.el6.x86_64 (dev-db) 07/09/2011 avg-cpu: %user 4.33 Device: sda sda1 sda2 sdb sdb1 %nice 0.01 tps 2.83 3.32 0.20 6.59 11.80 %sys %iowait 1.16 0.31 Blk_read/s 0.35 50.18 0.76 15.53 15.53 rBlk_nor/s 90.67 8.74 0.02 %idle 94.19

Blk_wrtn/s Blk_read Blk_wrtn 5.39 29817402 457360056 4.57 4259963994 387641400 0.82 64685128 69718576 42.98 1318931178 3649084113 42.98 1318713382 3649012985 wBlk_nor/s 0.00 0.00 0.00 rBlk_dir/s 0.00 0.00 0.00 wBlk_dir/s 0.00 0.00 0.00 rBl

Device: k_svr/s wBlk_svr/s 192.168.1.4:/home/data 5.33 0.00 192.168.1.4:/backup 8.74 0.00 192.168.1.8:/media 0.01 0.00

Q. How to Display LVM statistic? A. iostat -N Q. Define vmstat output? $ vmstat procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 305416 260688 29160 2356920 2 2 4 1 0 0 6 1 92 2 0 vmstat output contains the following fields: Procs r: Total number of processes waiting to run Procs b: Total number of busy processes Memory swpd: Used virtual memory Memory free: Free virtual memory Memory buff: Memory used as buffers Memory cache: Memory used as cache. Swap si: Memory swapped from disk (for every second) Swap so: Memory swapped to disk (for every second) IO bi: Blocks in. i.e blocks received from device (for every second) IO bo: Blocks out. i.e blocks sent to the device (for every second) System in: Interrupts per second System cs: Context switches CPU us, sy, id, wa, st: CPU user time, system time, idle time, wait time Q. How to Display active and inactive memory? A. vmstat -a Q. How to Display number of forks since last boot? A. vmstat -f or watch -n 1 vmstat -f Q. How to Display statistics in a table format?

A. watch -n 1 vmstat -s Q. How to Display disk statistics from vmstat? A. watch -n 1 vmstat -d Q. How to Display statistics for a partition from vmstat? A. watch -n 1 vmstat -p sdb1 Q. What is dev/null? A. dev/null - is a black hole of linux any data put in it never come back. Q. What is context switch? A. When CPU switches from one process (or thread) to another, it is called as context switch. When a process switch happens, kernel stores the current state of the CP U (of a process or thread) in the memory. Kernel also retrieves the previously stored state (of a process or threa d) from the memory and puts it in the CPU. Context switching is very essential for multitasking of the CPU. However, a higher level of context switching can cause performance issue s. Q. What is Run Queue? A. Run queue indicates the total number of active processes in the current queu e for CPU. When CPU is ready to execute a process, it picks it up from the run queue ba sed on the priority of the process. Please note that processes that are in sleep state, or i/o wait state are no t in the run queue. So, a higher number of processes in the run queue can cause performance issu es. Q. What is Load Average? A. This indicates the average CPU load over a specific time period. On Linux, load average is displayed for the last 1 minute, 5 minutes, and 15 minutes. This is helpful to see whether the overall load on the system is going up or down. For example, a load average of 0.75 1.70 2.10? indicates that the load on the system is coming down. 0.75 is the load average in the last 1 minute. 1.70 is t he load average in the last 5 minutes. 2.10 is the load average in the last 15 m inutes. Please note that this load average is calculated by combining both the total number of process in the queue, and the total number of processes in the uninte rruptable task status. Q. What is SMT? Symmetric Multi-Threading is a technology whereby multiple threads can run on a processor core at the same time (by using different parts of the cores execution pipeline).It i s not to be confused with a system that has multiple cores in an SMT system there is only on e core. Intel implemented a version of SMT called Hyper-threading in some of their P4 pr ocessors. This has been abandoned in newer processors. The performance gains from SMT are unclear, on the P4 in particular, some types of jobs were seen to be slower when run with

Hyperthreading enabled. We have also seen some stability problems with Linux and Hyperthreading . Q. What is SMP? Symmetric Multi-Processing refers to the technology where a system provides mult iple processor cores in a single system either as physically separate processors or multiple co res on a single processor. Newer processor designs include multiple processor cores on the same chip processors from Intel labelled as Core Duo and processors from AMD labelled as X 2 are dualcore processors. SMP capable systems allow multiple threads and processes to be run simultaneously providing clear performance improvements for loads that are multi -threaded or involve multiple processes. As with SMT, you must be running an SMP-enabled kern el to utilise multiple processors in a system. You may also want to consider tuning th e kernel scheduler to better load multiple processors Q. 64 bit system how much memory can allow to addresed? A. 1TB Q. Diffrence between 32bit and 64 bit system on physical memory prospastive? A. 32 bit can handle up 4GB phy memroy and there's no limit for 64bit Q. What is the use of block size during formating FS? Filesystems such as ext2 allow you to specify the block size to be used, one of 1024, 2048 or 4096 bytes per block. For a system that mostly creates files under 1k, it is more eff icient to use 1024 byte blocks, while for a system that only ever stores large files, it is more ef ficient to use a larger block size. You can also tune the number of inodes that are created for a particular file system a smaller number of inodes will result in a faster file system with the c aveat that you cannot subsequently change the number of inodes for a file system and if you sub sequently create a lot of small files on that file system, you run the risk of running out of inodes. Q. Explain Address space for 32bit and 64bit system? A. The total address space depends on the processor architecture 32-bit systems can address up to 2^32 bytes (4 GB) while 64-bit systems can address up to 2^64 bytes (17,179,869, 184 GB). In practice, operating systems kernels do not use addresse spaces this large. Addre ss space is usually split into an area managed by the kernel (kernel address space) and an a rea used by the application (user address space). Q. What is I/O Schedulers? A. The Linux kernel uses a mechanism called an I/O scheduler to manage reads and writes to and from I/O devices. The 2.6 Linux kernel series allows different I/O schedulers to be plugged in

at start-up time to change the I/O subsystem behaviour (boot parameter is elevat or=X where X is one of noop, deadline, as or cfq). Different schedulers have differen t performance characteristics which make them more suitable for different types of workload, Q. Explain bash hot keys? A. a. 'CTRL-a' - takes you to the beginning of the line b. 'CTRL-e' - takes you to the end of the line c. 'CTRL-b' - back one character d. 'CTRL-f' - forward one character e. 'CTRL-l' - clear screen. Q. How to view file file from end 30 lines? A. tail -n 30 filename same as if from starting head -n 30 filename. Q. How to create partition swap on linux? A. fdisk /dev/sdb' - create partition and set to type '82' with 't' option mkswap /dev/sdb3 - i.e. similar to: 'mke2fs' swapon -s - displays current swap devices swapon -v /dev/sdb3 - enables swapping on specific device Q. How to create LVM? A. fdisk /dev/sdb' - create partition and set to type '8e' with 't' option pvcreate /dev/sdb4 /dev/sdc3 - create physical LVM volumes from partitio ns pvdisplay vgcreate volgroupvar /dev/sdb4 /dev/sdc3 - allocates both volumes to the vol ume group lvcreate -L 5GB -n logvolvar volgroupvar mke2fs -t ext4 -j /dev/volgroupvar/logvolvar - overlays EXT4 FS on LVM volum e mkdir /lvmvar1 && mount /dev/volgroupvar/logvolvar /lvmvar1 Q. How to resize LVM? A. 'lvresize -L 6GB /dev/volgroupvar/logvolvar' 'resize2fs /dev/volgroupvar/logvolvar 6G' Note: Reductions will likely return errors resulting in re-provisioning of the F S Q. How to rename LV/VG? A. 'lvrename volgroupvar logvolvar logvolopt' - renames volume, NOT volume group 'vgrename volgroupvar volgroupopt' - renames the volume group Q. How to extend VG? A. fdisk /dev/sdb' - create partition and set to type '8e' with 't' option 'pvcreate /dev/sdc4' - assigns LVM partition to LVM management 'vgextend volgroupopt /dev/sdc4' - extends volume group: 'volgroupopt' 'lvresize -L 15GB /dev/volgroupopt/logvolopt' - online resize 'resize2fs /dev/volgroupopt/logvolopt 15G' - online resize Q. Explain how to create RAID0? A.

a. b. c. d. e. f.

Create multiple partitions: /dev/sd[bc][5-8] - of type '83' || 'linux' 'init 6' - reboot 'mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb5 /dev/sdc5' 'mke2fs -t ext4 -j /dev/md0' 'mkdir /raid0 && mount /dev/md0 /raid0' 'nano /etc/fstab'

Q. How to create RAID1? A. RAID1 - mirroring - halves the storage a. 'mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb6 /dev/sdc6' b. 'mke2fs -t ext4 -j /dev/md1' c. 'mkdir /raid1 && mount /dev/md1 /raid1' Q. How to create RAID5? A. RAID5 - striping with parity - sacrifices the equivalent of 1-drive(partition ) a. 'mdadm --create /dev/md2 --level=5 --raid-devices=4 /dev/sdb7 /dev/sdb8 /de v/sdc7 /dev/sdc8' b. 'mke2fs -t ext4 -j /dev/md2' c. 'mkdir /raid5 && mount /dev/md2 /raid5 && seq 1000000 > /raid5/1million.txt && ls -l /raid5' d. nano /etc/fstab e. test auto-mount during system initialization Q. What changes need in fstab for quota implimantaion? A. defaults,usrquota,grpquota thease option need to be add then mount -o remount /home then in simply mount command you see those option (mount |grep -i usrquo ta) Q. How to create user quota database? A. Create quota database files and generate disk usage table - defines baseline 'quotacheck -cug /home' - applies user and group quotas Note: 'quotacheck' should be run in: Single-user mode OR when the system reboots to facilitate: read-only remount of target file system Q. How to check defined quota or quota status in FS? A. 'quotacheck -amvug' - checks quotas - forces check Q. How to assigne quota for users? A. 'edquota username' - uses default editor ($EDITOR) Q. How to get added quota report? A. repquota /home Q. What is quota default grace period and how do i increase it? A. Default grace period is 7-days edquota -t username Q. How to check version relase other information of rpm pkg? A. rpm -qi pkgname Q. How to get all configurarion file related to any pkg? A. rpm -qc pkgname Q. How to get file of command belongs to which file? A. rpm -qf /sbin/ifconfig Q. How to installed gfile location of pkg? A. rpm -ql pkg name

Q. What is the location of rpm database? A. /var/lib/rpm Q. What's ping stands for? A. Explore Packet Internet Groper (PING) Q.Which kernel module is required for Software RAID? A. md module Q.What is the role of chunk size for software RAID? A.Chunk size is very important parameter on which RAID performance based. We know stripes go across disk drives. But how big are the pieces of the stripe on each disk? The pieces a stripe is broken into are called chunks.To get good performance you must have a reasonable chunk size. For big I/Os we required small chunks and for small I/Os we required big chunks. http://www.unix.com/unix-dummies-questions-answers/76432-how-find-out-how-much-r am-process-using.html http://ashterix.blogspot.in/2006/02/unix-tip-sort-processes-by-cpumemory.html

You might also like