Showing posts with label Data. Show all posts
Showing posts with label Data. Show all posts

Thursday, January 24, 2013

Unix Interview Questions

How to convert a ext2 file system to ext3 ?

What modprobe will do in Linux ?

what is the use of kudzu ?



@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@

How to print two files columwise in third file ?

paste -d' ' file1 file2 

How to check different error count in a log file ?

Maintain error count record and if the error count is more than previous ignore. if the error count is less than previous reset the counters.  

How to reverse a string or check weather its a palindrome or not ?

string_new = rev string1 #### it gives the reverse of the string.
test string_new = string1; if [$? -eq 0] ;then do echo "its a palindrome";fi

########################################################3

1) Tell me about yourself ?

2) tell me your day to day activities ?

3.) replacing a boot disk ?

4) patching HP-Ux ?

5) Hardware models you worked on ?

6) processor of Hp9000 series ?

7) How do you trouble shoot ?

8) script to cut a particular field ?

9) script to print a file reversely ?

tail -r myfile.txt

or
tac reverse of cat

tac myfile.txt

10) perl scripting exp >. ?

11)  Disk addition ?

12) Disk addition in cluster ?

13) creating a software depot ?

14) checking model /

15) do you have any specific questions ?



***************************************

 Tell me about your work .. ?

Rate yourself in Perl Scripting and Shell scripting ?

How you write modules in puppet ?

About exadata & Data Ontap ?

Perl Scripting:

 -- > Autoloader ?

---> Difference between a module and package ?

Tell me about your environment in puppet ?

How to configure password less ssh ?

Any Other Questions to Ask ?

*************************************
***********************************
Tell me about yourself?

How do you rate on scale of 1-10?

Hp Service Guard?
 How to configure a package?

How do you mirror lv?

How do you restore a failed disk?

what is major number ? minor number ?

Saturday, January 12, 2013

Useful links


Redhat LVM



Linux SAN and devices:


Solaris file system:


Hpux Bad disk:






Hp Ux Troubleshooting:


Sunday, September 9, 2012

Capacity Request for LVM (Hp ux and Redhat)

Types:

Linux Normal::

1. discover new disk by scanning hbas (vendor specific scripts ) or echo "- - -"
2. then use fdisk
3.pvcreate /dev/rdsk/C0t1d23
4.mknod
5.vgcreate
6.lvcreate
   b.) makefs
7.mount

##################for existing lv ##########
vgextend
lvextend
extend2fs  or resize2fs depending on the version which supports

Linux Cluster::

For Cluster follow the same procedure ..

we have to restart cluster service in other node
service cmcld stop/start

Hp-Ux Normal:

1.) take ioscan out put to one file & then do insf -c disk to discover the disk
2.) take ioscan out put and compare to find new disks
3.) pvcreate /dev/rdsk/cxtydz
4.)vgcreate
5.)lvcreate
6.)makefs
7.)mount


##################for existing lv ##########
vgextend
lvextend
fsadm or extendfs depending on the version which supports

Hp-Ux Cluster:

Follow the above steps .  . if extended vg then we have to do vgexport in preview mode and  in other node we to export the vg and we have to import again with new map file.

Node 1: (active)
vgexport -p -v -s -m old.dsk old.map /dev/testvg
scp old.map node2:/

Node 2:
vgexport /dev/testvg
vgimport -m old.map -s /dev/testvg



Hp-Ux BCV / GBCV :

We have to mask the corresponding BCV / GBCV luns

Common Problems::

1.) File system is 100% utilized..
 a) then we have to extend small amount
 b) Free up some space to write
2.) Number of free PE s completed
3.) Need to defragment the file system


Monday, June 13, 2011

UNIX95


################################################################################

UNIX95

UNIX95= ps -eo pid,user,sz,vsz,args|sort -nbk3|tail -20  (it will sort according to third field i.e sz)

UNIX95= ps -ef -o pid,ruser,vsz,args|sort -nrk3
UNIX95= ps -eo pid,user,sz,vsz,pcpu,args|sort -nbk5 | tail -10  (for cpu)
UNIX95= ps -eo pid,user,sz,vsz,args|sort -nbk3|tail -20
UNIX95= ps -eo pid,user,sz,vsz,args|sort -nbk3|grep -i 'LOCAL=NO'|wc -l

 #################################################################

Friday, June 10, 2011

BCV(Business Continuity Volume)


EMC for DBA's

Symmetrix refers to the EMC disk devices, disks within thid symmetix can be divided into various sized logical volumes, these logical volumes can be logicaly joined together and presented to a server.

There are 2 types of logical volume:

Hypervolumes - range of continuos space on a single disk. A single disk can be divided into 128 parts or hypervolumes this is refered to as slicing or splitting. These now form the basis to create metavolumes.

Metavolumes - A group of hypervolumes of the same size grouped together, this is then presented to a server. Once part of a metavolume, only the whole meta can be presented to the server not single disks.

Meta Head and Tail
When hypervolumes are added to a metavolume they are given a sequence, the first hyper being the head and last being the tail. Data is written to Meta from head to tail.


Monday, April 25, 2011

Some useful commands.



lsof is a command meaning "list open files", which is used in many Unix-like
systems to report a list of all open files and the processes that opened them

Dmidecode reports information about your system's hardware as described in your
system BIOS according to the SMBIOS/DMI standard.(Linux)

Memory & Cpu utilization : 
Top (linux)
Glance(unix)
UNIX95=
swapinfo -tm
cat /proc/meminfo
free -tml (t-total,m-megabites,l-diff b/w low high)

File system utilization: 
du -sk * (individually)
du -sk .(collectively)

Timex :  we know time taken by different users to run a command.


Unix Nohup: Run a Command or Shell-Script Even after You Logout

When you execute a Unix job in the background ( using &, bg command), and logout from the session, your process will get killed. You can avoid this using several methods — executing the job with nohup, or making it as batch job using at, batch or cron command.

This quick tip is for beginners. If you’ve been using nohup for a while, leave us a comment and tell us under what situations you use nohup.
In this quick tip, let us review how to make your process running even after you logout, using nohup.
Nohup stands for no hang up, which can be executed as shown below.
nohup syntax:
# nohup command-with-options &
Nohup is very helpful when you have to execute a shell-script or command that take a long time to finish. In that case, you don’t want to be connected to the shell and waiting for the command to complete. Instead, execute it with nohup, exit the shell and continue with your other work.

Explanation about nohup.out file

By default, the standard output will be redirected to nohup.out file in the current directory. And the standard error will be redirected to stdout, thus it will also go to nohup.out. So, your nohup.out will contain both standard output and error messages from the script that you’ve executed using nohup command.
Instead of using nohup.out, you can also redirect the output to a file using the normal shell redirections.

Example: Printing lines to both standard output & standard error

while(true)
do
echo "standard output"
echo "standard error" 1>&2
sleep 1;
done

Execute the script without redirection

$ nohup sh custom-script.sh &
[1] 12034
$ nohup: ignoring input and appending output to `nohup.out'

$ tail -f nohup.out
standard output
standard error
standard output
standard error
..

Execute the script with redirection

$ nohup sh custom-script.sh > custom-out.log &
[1] 11069
$ nohup: ignoring input and redirecting stderr to stdout

$ tail -f custom-out.log
standard output
standard error
standard output
standard error
..
If you log-out of the shell and login again, you’ll still see the custom-script.sh running in the background.
$ ps aux | grep sathiya
sathiya  12034  0.0  0.1   4912  1080 pts/2    S    14:10   0:00 sh custom

nice - run a program with modified scheduling priority  
Run COMMAND with an adjusted scheduling priority. With no COMMAND, print the current scheduling priority. ADJUST is 10 by default. Range goes from -20 (highest priority) to 19 (lowest).
-n, --adjustment=ADJUST
increment priority by ADJUST first 

 
 
vgreduce -t ( This will run vgreduce in test mode)

buffer I/O error main reason is difference in I/O timings with storage lun.

[root@d scsi_device]# cat /sys/block/sdab/device/timeout
30
[root@d scsi_device]# 



Aix commands to check kernel parameters

lsattr -E -l sys0
topas
startsrc -s sshd

Sed command to extract data b/w two words in a file

sed -n '/langham/,/langport/p' linux_workout

Mount error

mount: special device  does not exist

(re activate the vg ) or check vg activation status

Thursday, January 21, 2010

mounting linux drives on windows

Ext2 IFS is used to mount linux drives on windows.

you can download the software from...

http://www.fs-driver.org/

Thursday, December 10, 2009

mounting windows drives on linux

We can mount windows drives on linux by using NTFS-3g(Linux -NTFS).
The goals of the Linux-NTFS project are to develop reliable and full feature access to NTFS by the Linux kernel driver, and by a user space filesystem (ntfsmount), and to provide a wide collection of NTFS utilities (ntfsprogs) and a developer's library (libntfs) for other GPLed programs. We have achieved already a lot, with high quality results.

How to access NTFS from Linux
Choose one of the following three options:

1) Linux has an integrated kernel driver. It allows reading of files, and rewriting existing files. It does not support creation of new files or deletion of existing files. .

2) ntfsprogs includes an improved driver, ntfsmount, which provides the same functionality as the kernel driver. Additionally it also supports basic cases of directory, symlink, device and FIFO file creation, deletion and renaming. Note: That doesn't mean it always succeeds, it is still experimental and might just as well refuse to complete an operation in order to prevent corruption. See the ntfsmount page for more details.

The beta version of the ntfs-3g driver can be downloaded from http://www.ntfs-3g.org

partitioning hardisk

As outlined in the General Information section, the most common way to install Linux is to allocate a part of your hard disk for Linux. Most computers come with one hard disk, and that hard disk is usually setup to have just one partition which uses all of the space on the hard disk. If this is the case with your computer, then you will need to either add a new hard disk for Linux, or shrink your existing partition to make space for Linux.

Each partition not only creates a separate independent space on the hard disk but it also associates a method of reading and writing information to the drive, the format of the drive. Linux has a number of different formats it can use for sections of the hard disk, the most popular being ext2 and ext3 (others include reiserfs, xfs and jfs). Normally you will not have to worry much about the formats of Linux partitions, the installation program will make appropriate suggestions. One other type of partition format for Linux which is worthy of mention is swap. A swap partition is used to effectively extend your memory onto the hard disk, so if your computer wants to use more memory then it has, it will "swap" information in memory which it doesn't need at the time onto the hard disk. It is possible to use a large file on a normal partition for swap however this is much slower. Unless you measure your memory in Gigabytes, you should probably use a swap partition at least the size of your memory, and if you have less then 256Megabytes of ram then you may want a partition 2 or 3 times it.

If you are in the common situation of having to shrink the only Windows partition on your hard disk, the first thing to be aware of is that your access to the information on the Windows partition will depend on its format. There are two main types of partition formats for Windows, FAT and NTFS. Generally computers with the Windows 95/98/ME systems will have FAT partitions and Windows NT/2000/XP will have NTFS partitions, though the NT/2000/XP family can also use FAT.

The critical difference between FAT and NTFS as far as Linux is concerned, is that while reading information from either system is perfectly safe under Linux, writing information to an NTFS partition is currently regarded as potentially unsafe so you wouldn't be able to edit these files from Linux and access the changes directly under Windows. Linux is perfectly reliable sharing FAT partitions with other operating systems (if your feeling lost, perhaps telling you that when you format a floppy you are actually making a FAT filesystem on it will help put things in perspective). Windows has no native method of reading Linux formatted partitions, but the Free explore2fs program allows you to read and copy information from ext2 and ext3 Linux partitions while you are running Windows. There is now also a file-system driver from the same source called ext2ifs which allows your ext2 and ext3 partitions to appear as extra drives in Windows NT4/2000/XP (still read only).

There are numerous methods for shrinking Windows partitions to make space for Linux (and I would recommend simply making the space and using the installer to create the partitions and format them). No matter what method you use to do this, you should backup all your data before you begin, in fact you should always keep backups of all your important information as a hard disk could fail at any time. Another tip is to defragment your drive in windows before you begin which makes it much easier for the software which has to do the shrinking. The tried and true method for shrinking a partition is a commercial program called Partition Magic ($69.95 as of Sept 2004). You can also do this with Free software such as parted (or the graphical front-end QTparted) or often as part of the installer itself. Check the installation documentation for the system you plan on installing to see if it's now supports resizing/shrinking ntfs partitions.

Whatever scenario you start in, when you begin to install Linux you need to know where you have space to put it. It may be a new hard disk or free space on an existing hard disk. For a modern desktop Linux system you would want to allocate an absolute minimum of 2GB of hard disk space, 5GB would be far better and if you have plenty of space (or if you plan to install lots of large pieces of software, perhaps games) 10GB+ is perfectly reasonable. If you have enough free space the installation program may suggest creating more than one Linux partition, if so it is well worthwhile creating a separate partition for your files, the /home partition. Amongst other things you can reinstall your system or install a new system without having to make an additional backup of your files (remember again you do always keep backups of everything important).

hierarchy of file system

< / >

The root directory. The starting point of your directory structure. This is where the Linux system begins. Every other file and directory on your system is under the root directory. Usually the root directory contains only subdirectories, so it's a bad idea to store single files directly under root.

Don't confuse the root directory with the root user account, root password (which obviously is the root user's password) or root user's home directory.

< /boot >

As the name suggests, this is the place where Linux keeps information that it needs when booting up. For example, this is where the Linux kernel is kept. If you list the contents of /boot, you'll see a file called vmlinuz - that's the kernel.

< /etc >

The configuration files for the Linux system. Most of these files are text files and can be edited by hand. Some interesting stuff in this directory:

/etc/inittab

A text file that describes what processes are started at system bootup and during normal operation. For example, here you can determine if you want the X Window System to start automatically at bootup, and configure what happens when a user presses Ctrl+Alt+Del.

/etc/fstab

This file contains descriptive information about the various file systems and their mount points, like floppies, cdroms, and so on.

/etc/passwd

A file that contains various pieces of information for each user account. This is where the users are defined.

< /bin, /usr/bin >

These two directories contain a lot of programs (binaries, hence the directory's name) for the system. The /bin directory contains the most important programs that the system needs to operate, such as the shells, ls, grep, and other essential things. /usr/bin in turn contains applications for the system's users. However, in some cases it really doesn't make much difference if you put the program in /bin or /usr/bin.

< /sbin, /usr/sbin >

Most system administration programs are stored in these directories. In many cases you must run these programs as the root user.

< /usr >

This directory contains user applications and a variety of other things for them, like their source codes, and pictures, docs, or config files they use. /usr is the largest directory on a Linux system, and some people like to have it on a separate partition. Some interesting stuff in /usr:

/usr/doc

Documentation for the user apps, in many file formats.

/usr/share

Config files and graphics for many user apps.

/usr/src

Source code files for the system's software, including the Linux kernel.

/usr/include

Header files for the C compiler. The header files define structures and constants that are needed for building most standard programs. A subdirectory under /usr/include contains headers for the C++ compiler.

/usr/X11R6

The X Window System and things for it. The subdirectories under /usr/X11R6 may contain some X binaries themselves, as well as documentation, header files, config files, icons, sounds, and other things related to the graphical programs.

< /usr/local >

This is where you install apps and other files for use on the local machine. If your machine is a part of a network, the /usr directory may physically be on another machine and can be shared by many networked Linux workstations. On this kind of a network, the /usr/local directory contains only stuff that is not supposed to be used on many machines and is intended for use at the local machine only.

Most likely your machine isn't a part of a network like this, but it doesn't mean that /usr/local is useless. If you find interesting apps that aren't officially a part of your distro, you should install them in /usr/local. For example, if the app would normally go to /usr/bin but it isn't a part of your distro, you should install it in /usr/local/bin instead. When you keep your own programs away from the programs that are included in your distro, you'll avoid confusion and keep things nice and clean.

< /lib >

The shared libraries for programs that are dynamically linked. The shared libraries are similar to DLL's on Winblows.

< /home >

This is where users keep their personal files. Every user has their own directory under /home, and usually it's the only place where normal users are allowed to write files. You can configure a Linux system so that normal users can't even list the contents of other users' home directories. This means that if your family members have their own user accounts on your Linux system, they won't see all the w4r3z you keep in your home directory. ;-)

< /root >

The superuser's (root's) home directory. Don't confuse this with the root directory (/) of a Linux system.

< /var >

This directory contains variable data that changes constantly when the system is running. Some interesting subdirectories:

/var/log

A directory that contains system log files. They're updated when the system runs, and checking them out can give you valuable info about the health of your system. If something in your system suddenly goes wrong, the log files may contain some info about the situation.

/var/mail

Incoming and outgoing mail is stored in this directory.

/var/spool

This directory holds files that are queued for some process, like printing.

< /tmp >

Programs can write their temporary files here.

< /dev >

The devices that are available to a Linux system. Remember that in Linux, devices are treated like files and you can read and write devices like they were files. For example, /dev/fd0 is your first floppy drive, /dev/cdrom is your CD drive, /dev/hda is the first IDE hard drive, and so on. All the devices that a Linux kernel can understand are located under /dev, and that's why it contains hundreds of entries.

< /mnt >

This directory is used for mount points. The different physical storage devices (like the hard disk drives, floppies, CD-ROM's) must be attached to some directory in the file system tree before they can be accessed. This attaching is called mounting, and the directory where the device is attached is called the mount point.

The /mnt directory contains mount points for different devices, like /mnt/floppy for the floppy drive, /mnt/cdrom for the CD-ROM, and so on. However, you're not forced to use the /mnt directory for this purpose, you can use whatever directory you wish. Actually in some distros, like Debian and SuSE, the default is to use /floppy and /cdrom as mount points instead of directories under /mnt.

< /proc >

This is a special directory. Well, actually /proc is just a virtual directory, because it doesn't exist at all! It contains some info about the kernel itself. There's a bunch of numbered entries that correspond to all processes running on the system, and there are also named entries that permit access to the current configuration of the system. Many of these entries can be viewed.

< /lost+found >

Here Linux keeps the files that it restores after a system crash or when a partition hasn't been unmounted before a system shutdown. This way you can recover files that would otherwise have been lost.

dual booting linux and windows on same machine

Windows and Linux can live comfortably on the same the same machine, even the same harddrive. The choice of operating systems can be made at the boot-up sequence when you thro the power switch. This configuration is known as the "dual-boot" configuration. This is how most linux users start off. Unless you're a BOFH of course *grin*.
FAT32 Support Requirements
To have access to your Win partition from Linux (file sharing between Linux and Win), which is useful, think of all those MP3s... you will also need a version 2.0.34 of the Linux kernel or higher. Below is a list of recent Linux distros and the kernel build versions (2.0.34 or higher!) that support FAT32.


If your kernel version doesn't support Fat32 you will have to upgrade the kernel. I'm not too hot on kernel upgrades, so I'm not going to say too much on that. As ever RTFM!


Distributions with FAT32 support (kernel 2.0.34 or higher) Distribution:
        Earliest Version with FAT32 Support
Red Hat
        Version 5.1 (with kernel 2.0.34)

Red Hat
        Version 6.0 (with kernel 2.0.36)

SuSE
        Version 5.3 (with kernel 2.0.35)

SuSE
        Version 6.0 (with kernel 2.0.36)

Debian GNU/Linux
        Version 2.0 (with kernel 2.0.34)