Tuesday, November 29, 2011

LSOF usage

List all open files in system: lsof
List all network connections: lsof -i
List all TCP connections: lsof -iTCP
List connections on specific port number: lsof -i : 139
List all files opened by user fred: lsof -u fred
List connections on specific host:lsof -i@192.168.0.3
List connection on specifics host and port:

Friday, November 25, 2011

PARITY & RAID

What do you mean by Parity ?

a different way of protecting data is provided as an alternate to mirroring. It involves the use of parity information, which is redundancy information calculated from the actual data values.

The principle behind parity is simple: take "N" pieces of data, and from them, compute an extra piece of data. Take the "N+1" pieces of data and store them on "N+1" drives. If you lose any one of the "N+1" pieces of data, you can recreate it from the "N" that remain, regardless of which piece is lost. Parity protection is used with striping, and the "N" pieces of data are typically the blocks or bytes distributed across the drives in the array. The parity information can either be stored on a separate, dedicated drive, or be mixed with the data across all the drives in the array.


The parity calculation is typically performed using a logical operation called "exclusive OR" or "XOR".


Let's take an example to show how this works; you can do this yourself easily on a sheet of paper. Suppose we have the following four bytes of data: D1=10100101, D2=11110000, D3=00111100, and D4=10111001. We can "XOR" them together as follows, one step at a time:

D1 XOR D2 XOR D3 XOR D4
= ( (D1 XOR D2) XOR D3) XOR D4
= ( (10100101 XOR 11110000) XOR 00111100) XOR 10111001
= (01010101.XOR 00111100) XOR 10111001
= 01101001 XOR 10111001
= 11010000

So "11010000" becomes the parity byte, DP. Now let's say we store these five values on five hard disks, and hard disk #3, containing value "00111100", goes el-muncho. We can retrieve the missing byte simply by XOR'ing together the other three original data pieces, and the parity byte we calculated earlier, as so:

D1 XOR D2 XOR D4 XOR DP
= ( (D1 XOR D2) XOR D4) XOR DP
= ( (10100101 XOR 11110000) XOR 10111001) XOR 11010000
= (01010101 XOR 10111001) XOR 11010000
= 11101100 XOR 11010000
= 00111100

Which is D3, the missing value. Pretty neat, huh? :^) This operation can be done on any number of bits, incidentally; I just used eight bits for simplicity. It's also a very simple binary calculation--which is a good thing, because it has to be done for every bit stored in a parity-enabled RAID array.

Advantages

The most obvious advantage is that parity protects data against any single drive in the array failing without requiring the 50% "waste" of mirroring; only one of the "N+1" drives contains redundancy information. (The overhead of parity is equal to (100/N)% where N is the total number of drives in the array.) Striping with parity also allows you to take advantage of the performance advantages of striping.


Disadvantages:-


The chief disadvantages of striping with parity relate to complexity: all those parity bytes have to be computed--millions of them per second!--and that takes computing power. This means a hardware controller that performs these calculations is required for high performance--if you do software RAID with striping and parity the system CPU will be dragged down doing all these computations. Also, while you can recover from a lost drive under parity, the missing data all has to be rebuilt, which has its own complications; recovering from a lost mirrored drive is comparatively simple.



see:- http://aarklonlinuxinfo.blogspot.com/2011/08/raid-example.html

Thursday, November 17, 2011

Recovering grub 2

Hard way: Manual fix from live CD

You will need a live CD that ships with GRUB 2, like Ubuntu or Kubuntu. Boot into the live session, mount the hard disk and install GRUB 2 to the MBR.

This is the sequence of commands you require (assuming disk = /dev/sda). You will need to mount the partition of your installed distribution (e.g. Ubuntu) containing the /boot directory. It may also be a separate partition on your system, depending on your setup.

After it is mounted, you will have to rerun the install-grub command.

mount /dev/sdax /mnt/

create an un breakable link from /dev folder on the live image you booted from to the /dev folder on the partition you mounted to /mnt

sudo mount --bind /dev /mnt/dev



chroot from the live images root to mounted partitions root

sudo chroot /mnt


Re install the grub2 boot loader to the drive on which exists the partition you mounted previously

sudo grub-install /dev/sda


Exit out of chroot shell (type exit)

cleanly unmount all the partitions you previously mounted

sudo umount
sudo umount /mnt/dev
sudo umount /mnt

Friday, November 11, 2011

Nautilus share vs samba share

Nautilus share Vs samba share:-
-------------------------------

nautilus share:-

* usually known as user shares
* doesn't write anything in smb.conf
* config files in /var/lib/samba
* can be created by normal users without requiring root powers

Samba share:-

* Shares created in smb.conf are traditional shares and are created by the root/sudo user.

* traditional shares as they offer more control and are less prone to permission errors.You can use the samba control panel (system-config-samba) to administer them from one place.

Thursday, November 3, 2011

/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with status 256

There is problem with the configuration server.
(/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with status 256)

soln:-
sudo chown-Rc your_username_here /home/your_username_here


source:-
http://forumubuntusoftware.info/viewtopic.php?f=46&t=2550