Wednesday, May 22, 2013

Can't Search in Google Drive Folder in Windows 7


Problem:

I am trying to search files in Google Drive Folder in Windows 7 with Windows File Explorer, there is no search result returns.




Solution:

1. In Windows 7, open your Windows File Explorer


2. Select your Google Drive Folder


3. Click on "Organize" drop down menu (It located at the left top corner in Windows File Explorer)


4. Select "Folder and search options"


5. In the new pop windows, click on "Search" tab


6. Then, put a check mark on "Don't use the index when searching in files folders for system files (searches  
might take longer)"


7. Click "OK" button to finish and try again

Friday, May 17, 2013

Setting up a KVM virtual machine in LVM (Logical Volume)



1. Install Ubuntu Server 12.04 64bit (Total Hard Disk Size = 200GB and 4GB RAM)
Hostname: U-HOST
Partitioning method: Manual
Create #1 primary 30.0GB f ext4 /
Create #2 primary 8.0GB f swap swap
Create #3 primary 176.7GB k lvm
Choose software to install: [*] OpenSSH server
Install the GRUB boot loader to the master boot record? <Yes>



2. After the base server installed, do the update
root@U-HOST:/iso#apt-get update
root@U-HOST:/iso#apt-get dist-upgrade



3. Install packages
root@U-HOST:/iso#apt-get install ubuntu-virt-server python-vm-builder kvm-ipxe



4. Add the current user to the group libvirtd
root@U-HOST:/iso#adduser 'root' libvirtd
root@U-HOST:/iso#adduser 'root' kvm

To check if KVM has successfully been installed, run
root@U-HOST:/iso#virsh -c qemu:///system list

it should display something like this:

root@U-HOST:~# virsh -c qemu:///system list
Id Name State
----------------------------------



5. Install bridge-utils... (In Ubuntu 12.04, this is package is already installed)
root@U-HOST:/iso#apt-get install bridge-utils




6. configure a bridge,
root@U-HOST:/iso#nano /etc/network/interfaces
Before the modification, it file is looks as follows:

# This file describes the network interfaces available on your system
 # and how to activate them. For more information, see interfaces(5).

 # The loopback network interface
 auto lo
 iface lo inet loopback

 # The primary network interface
 auto eth0
 iface eth0 inet dhcp



After modification, it will looks as follows,

# This file describes the network interfaces available on your system
 # and how to activate them. For more information, see interfaces(5).

 # The loopback network interface
 auto lo
 iface lo inet loopback

 # The primary network interface
 auto eth0
 iface eth0 inet manual


 auto br0
 iface br0 inet static
        address 192.168.122.21
        network 192.168.122.0
        netmask 255.255.255.0
        broadcast 192.168.122.255
        gateway 192.168.122.1
        dns-nameservers 8.8.8.8 8.8.4.4
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off


After the modification of 'interface' file, restart networking service,
root@U-HOST:/iso#/etc/init.d/networking restart


It should now show the network bridge (br0):
root@U-HOST:/iso#ifconfig

it will show following,

br0       Link encap:Ethernet HWaddr 52:54:00:14:81:b7
          inet addr:192.168.122.21 Bcast:192.168.122.255 Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe14:81b7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:152 errors:0 dropped:0 overruns:0 frame:0
          TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:12428 (12.4 KB) TX bytes:10608 (10.6 KB)

eth0     Link encap:Ethernet HWaddr 52:54:00:14:81:b7
          inet6 addr: fe80::5054:ff:fe14:81b7/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
         RX packets:157 errors:0 dropped:0 overruns:0 frame:0
         TX packets:83 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:14796 (14.7 KB) TX bytes:10962 (10.9 KB)

lo        Link encap:Local Loopback
         inet addr:127.0.0.1 Mask:255.0.0.0
         inet6 addr: ::1/128 Scope:Host
         UP LOOPBACK RUNNING MTU:16436 Metric:1
         RX packets:16 errors:0 dropped:0 overruns:0 frame:0
         TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:1184 (1.1 KB) TX bytes:1184 (1.1 KB)


Reboot the server now.



7. Create the Physical Volume
#apt-get install lvm2


Check the partitions by run,

#cat /proc/partitions

It should looks like this,

root@U-HOST:~# cat /proc/partitions
major minor #blocks name

253 0 209715200 vda
253 1 29295616 vda1
253 2 7812096 vda2
253 3 172605440 vda3
11 0 1048575 sr0

The 'vda3' is the lvm partition, you can check it by this,
root@U-HOST:/iso#fdisk -l

Disk /dev/vda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006e7b2

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 58593279 29295616 83 Linux
/dev/vda2 58593280 74217471 7812096 82 Linux swap / Solaris
/dev/vda3 74217472 419428351 172605440 8e Linux LVM

Create physical volume
root@U-HOST:~# pvcreate /dev/vda3
Physical volume "/dev/vda3" successfully created 
 
Create volume group
root@U-HOST:~# vgcreate vgpool /dev/vda3
Volume group "vgpool" successfully created 
 
”vgpool” can be replace with any name you want


Create logical volume
root@U-HOST:~# lvcreate -L 30G -n win7 vgpool
Logical volume "win7" created 
 
30G is the partition size, win7 is the logical volume name, vgpool is the volume group that created from previous step




8. Now you can install virtual machine from command line

Install virtinst by run,
root@U-HOST:/iso#apt-get install virtinst


I am going to use a Windows 7 ISO file where is located at
/iso/Windows.7.SP1.ENG.x86-x64.MAFIAA.iso


Install the Windows 7 Virtual Machine by running following command,


root@U-HOST:/iso#virt-install --connect qemu:///system --name=win7vm --ram=2048 --disk path=/dev/vgpool/win7 --cdrom=/iso/Windows.7.SP1.ENG.x86-x64.MAFIAA.iso --network bridge=br0,model=virtio --os-type=windows --noautoconsole --graphics vnc,listen=0.0.0.0,port=5901 –hvm

Starting install...
Creating domain... | 0 B 00:01
Domain installation still in progress. Waiting for installation to complete.



9. Install an virtual machine via “Virtual Machine Manager”
You can install “Virtual Machine Manager” from Ubuntu Software Centre on a Ubuntu Desktop Then, connect to

In “Virtual Machine Manager”, go to File -> Add Connection


























Type “yes” in following windows
















 

In Nex Window, type in the user's password


















After enter the password, you will see the “win7vm” in “Virtual Machine Manager”
  


 

Double click the virtual machine “win7vm”, it will show you the virtual machine status,
You can finish the Windows 7 installation by using Virtual Machine Manager
  
















Convert KVM Qcow2 File to LVM Disk


Following steps involve moving some KVM VMs from file storage to block storage. 
This is basically converting the .qcow2 files to LVM LVs. It was surprisingly simple.







1. qemu-img convert disk0.qcow2 -O raw disk0.raw

2. ls -l


-rw-r--r-- 1 user user 44023414784 2011-03-27 09:09 disk.raw

3. lvcreate -L 44023414784b -n lv_disk vgroup

4. dd if=disk.raw of=/dev/vgroup/lv_disk





=============================================================



#Configuration Before:



<disk type='file' device='disk'>

  <driver name='qemu' type='qcow2' cache='none'/>

  <source file='/srv/virtual/vm_web/tmp5GWO4q.qcow2'/>

  <target dev='hda' bus='virtio'/>

</disk>





#Configuration After:



<disk type='block' device='disk'>

  <driver name='qemu' type='raw' cache='none'/>

  <source dev='/dev/vgroup/lv_disk'/>

  <target dev='vda' bus='virtio'/>

</disk>

Monday, May 13, 2013

iPad can join wireless but no internet

Problem:

I can join to my wireless network (says 'connected') on my iPad but cannot load any website. I have confirmed other device join to the same wireless has no problem with browsing internet.




Solution:
Go to "Settings" -> "Wi-Fi" -> Click on the blue '>" arrow where at the end of your Wireless Netowrk Name -> HTTP Proxy (Change Auto to Off)

This will fix the problem for most of the people, enjoy internet!

Saturday, May 11, 2013

How to Change a Degraded Drive with tw_cli commandline?


A failed RAID set looks like this:


dev306:~# /opt/3Ware/bin/tw_cli
//dev306> info c0

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    DEGRADED       -      256K    1117.56   ON     OFF      OFF   

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     372.61 GB   781422768     3PM0Q56Z   
p1     OK               u0     372.61 GB   781422768     3PM0Q3YY   
p2     OK               u0     372.61 GB   781422768     3PM0PFT7   
p3     DEGRADED         u0     372.61 GB   781422768     3PM0Q3B7 

 

 

Now I will remove this bad disk from the RAID set:


//dev306> maint remove c0 p3
Exporting port /c0/p3 ... Done.

 

 

With the bad disk identified and replaced, now I need to go back into the 3Ware CLI and find the new disk, then tell the array to start rebuilding.


dev306:~# /opt/3Ware/bin/tw_cli
//dev306> maint rescan
Rescanning controller /c0 for units and drives ...Done.
Found the following unit(s): [none].
Found the following drive(s): [/c0/p3].


//dev306> maint rebuild c0 u0 p3
Sending rebuild start request to /c0/u0 on 1 disk(s) [3] ... Done.

//dev306> info c0

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    REBUILDING     0      256K    1117.56   ON     OFF      OFF   

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     372.61 GB   781422768     3PM0Q56Z   
p1     OK               u0     372.61 GB   781422768     3PM0Q3YY   
p2     OK               u0     372.61 GB   781422768     3PM0PFT7   
p3     DEGRADED         u0     372.61 GB   781422768     3PM0Q3B7 

 

Wednesday, May 8, 2013

How to get an inactive RAID device working again?

Problem:

After booting, my RAID1 device (/dev/md_d0 *) sometimes goes in some funny state and I cannot mount it

# mount /opt
mount: wrong fs type, bad option, bad superblock on /dev/md_d0,
       missing codepage or helper program, or other error
       (could this be the IDE device where you in fact use
       ide-scsi so that sr0 or sda or so is needed?)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so


The RAID device appears to be inactive somehow:
# cat /proc/mdstat
Personalities : [linear]  [multipath]  [raid0]  [raid1]  [raid6]  [raid5]
                [raid4] [raid10]
md_d0 :  inactive sda4 [0] (S)
               241095104 blocks


# mdadm --detail /dev/md_d0
mdadm: md device /dev/md_d0 does not appear to be active.



Resolution:

run,

#mdadm --examine --scan >> /etc/mdadm/mdadm.conf
reboot the machine and you will found /dev/md0 will be active if you run

#cat /proc/mdstat

Tuesday, May 7, 2013

tw_cli ChatSheet


How do I check the health of my 3ware RAID array under any Linux distribution? How do I access 3ware RAID Array web interface?

You need to download required command line tools from 3ware support web site. You can also find the same on driver cd / floppy disk. For example, I've downloaded a file called tw_cli-linux-x86_64-9.4.1.3.tgz for my 64 bit Linux server from above site. You need to get tool according to your device.


1. First you download "tw_cli" from LSI website -> Support


2. untar the tw_cli-linu.xxxxxxx.tgz


3. find and run "tw_cli" or "tw_cli.x86" or "tw_cli.x86_64", you will enter CLI command line


4. Show raid card information
   // localhostname> show
   
    Ctl   Model        (V)Ports  Drives   Units   NotOpt  RRate   VRate  BBU
    ------------------------------------------------------------------------
    c4    9650SE-8LPML 8         6        1       0       1       1      OK

    //localhostname>


5. From above example, your raid card has been detected as c4, to show detail raid information,
     //localhostname> /c4 show
     
    Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
    ------------------------------------------------------------------------------
    u0    RAID-6    OK             -       -       256K    7450.54   RiW    ON

    VPort Status         Unit Size      Type  Phy Encl-Slot    Model
    ------------------------------------------------------------------------------
    p0    OK             u0   1.82 TB   SATA  0   -            Hitachi HDS722020AL
    p1    OK             u0   1.82 TB   SATA  1   -            Hitachi HDS722020AL
    p2    OK             u0   1.82 TB   SATA  2   -            Hitachi HDS722020AL
    p3    OK             u0   1.82 TB   SATA  3   -            WDC WD2001FASS-00W2
    p4    OK             u0   1.82 TB   SATA  4   -            WDC WD2001FASS-00W2
    p5    OK             u0   1.82 TB   SATA  5   -            WDC WD2001FASS-00W2

    Name  OnlineState  BBUReady  Status    Volt     Temp     Hours  LastCapTest
    ---------------------------------------------------------------------------
    bbu   On           Yes       OK        OK       OK       0      xx-xxx-xxxx

Linux: tar Extract Files


Linux: tar Extract Files

by  on FEBRUARY 16, 2010 · 3 COMMENTS· last updated at FEBRUARY 16, 2011
How can I extract or uncompress a file from tar ball downloaded from the Internet under Linux using bash command prompt?

You need to use the tar command to extract files from an archive or to create an archive (also known as tarball). A tarball or an archive is nothing but a single file that contains various individual files. It also includes information which allows your to restore files to their original form by one or more extraction programs such as tar command.

Extract or Unpack a TarBall File

To unpack or extract a tar file, type:
 
tar -xvf file.tar
 
To save disk space and bandwidth over the network all files are saved using compression program such as gzip or bzip2. To extract / unpack a .tar.gz (gzip) file, enter (note -z option):
 
tar -xzvf file.tar.gz
 
To extract / unpack a .tar.bz2 (bzip2) file, enter (note -j option):
 
tar -xjvf file.tar.bz2
 
Where,
  • -x : Extract a tar ball.
  • -v : Verbose output or show progress while extracting files.
  • -f : Specify an archive or a tarball filename.
  • -j : Decompress and extract the contents of the compressed archive created by bzip2 program (tar.bz2 extension).
  • -z : Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).

How Do I Extract A Single File Called foo.txt?

To extract a single file called foo.txt, enter:
 
tar -xvf file.tar foo.txt
tar -xzvf file.tar.gz foo.txt
tar -xjvf file.tar.bz2 foo.txt
 
You can also specify path such as etc/resolv.conf, enter:
 
tar -xvf file.tar etc/resolv.conf
tar -xzvf file.tar.gz etc/resolv.conf
tar -xjvf file.tar.bz2 etc/resolv.conf
 

How Do I Extract a Single Directory Called etc?

To extract a single directory called etc, enter:
 
tar -xvf file.tar etc
tar -xzvf file.tar.gz etc
tar -xjvf file.tar.bz2 etc
 
Sample outputs:
etc/
etc/pulse/
etc/pulse/default.pa
etc/pulse/client.conf
etc/pulse/daemon.conf
etc/pulse/system.pa
etc/xml/
etc/xml/docbook-xml.xml.old
etc/xml/xml-core.xml
etc/xml/catalog
etc/xml/catalog.old
etc/xml/docbook-xml.xml
etc/xml/rarian-compat.xml
etc/xml/sgml-data.xml
etc/xml/xml-core.xml.old
etc/xml/sgml-data.xml.old
etc/mail.rc
etc/Wireless/
etc/Wireless/RT2870STA/
etc/Wireless/RT2870STA/RT2870STA.dat
etc/logrotate.conf
etc/compizconfig/
etc/compizconfig/config
.....
...
....
etc/python/
etc/python/debian_config
etc/ConsoleKit/
etc/ConsoleKit/seats.d/
etc/ConsoleKit/seats.d/00-primary.seat
etc/ConsoleKit/run-session.d/
etc/ConsoleKit/run-seat.d/
etc/opt/

Original Post from: http://www.cyberciti.biz/faq/tar-extract-linux/

MegaCli Useful Commands

Here are some useful commands:
View information about the RAID adapter

For checking the firmware version, battery back-up unit presence, installed cache memory and the capabilities of the adapter:

# MegaCli64 -AdpAllInfo -aAll


View information about the battery backup-up unit state

# MegaCli64 -AdpBbuCmd -aAll


View information about virtual disks

Useful for checking RAID level, stripe size, cache policy and RAID state:

# MegaCli64 -LDInfo -Lall -aALL


View information about physical drives

# MegaCli64 -PDList -aALL


Patrol read

Patrol read is a feature which tries to discover disk error before it is too late and data is lost. By default it is done automatically (with a delay of 168 hours between different patrol reads) and will take up to 30% of IO resources.

To see information about the patrol read state and the delay between patrol read runs:
# MegaCli64 -AdpPR -Info -aALL

To find out the current patrol read rate, execute
# MegaCli64 -AdpGetProp PatrolReadRate -aALL

To reduce patrol read resource usage to 2% in order to minimize the performance impact:
# MegaCli64 -AdpSetProp PatrolReadRate 2 -aALL

To disable automatic patrol read:
# MegaCli64 -AdpPR -Dsbl -aALL

To start a manual patrol read scan:
# MegaCli64 -AdpPR -Start -aALL

To stop a patrol read scan:
# MegaCli64 -AdpPR -Stop -aALL


You could use the above commands to run patrol read in off-peak times.

Migrate from one RAID level to another

In this example, I migrate the virtual disk 0 from RAID level 6 to RAID 5, so that the disk space of one additional disk becomes available. The second command is used to make Linux detect the new size of the RAID disk.

# /usr/local/sbin/MegaCli64 -LDRecon -Start -r5 -L0 -a0
# echo 1 > /sys/block/sda/device/rescan


Create a new RAID 5 virtual disk from a set of new hard drives

First we need to now the enclosure and slot number of the hard drives we want to use for the new RAID disk. You can find them out by the first command. Then I add a virtual disk using RAID level 5, followed by the list of drives I want to use, specified by enclosure:slot syntax.

# MegaCli64 -PDList -aALL | egrep 'Adapter|Enclosure|Slot|Inquiry'
# MegaCli64 -CfgLdAdd -r5'[252:5,252:6,252:7]' -a0


View reconstruction progress

When reconstructing a RAID array, you can check its progress with this command.

# MegaCli64 -LDRecon ShowProg L0 -a0

(replace L0 by L1 for the second virtual disk, and so on)


Configure write-cache to be disabled when battery is broken

# MegaCli64 -LDSetProp NoCachedBadBBU -LALL -aALL


Change physical disk cache policy

If your system is not connected to a UPS, you should disable the physical disk cache in order to prevent data loss.

# MegaCli -LDGetProp -DskCache -LAll -aALL

To enable it (only do this if you have a UPS and redundant power supplies):

# MegaCli -LDGetProp -DskCache -LAll -aALL




megactl

Despites megasasctl doesn't seem to work with recent cards, you should really give it a try.



Print current controller status:

server:~# megasasctl
a0          PERC 5/i Integrated      encl:1 ldrv:1  batt:good
a0d0        136GiB RAID 1   1x2  optimal
a0e8s0     136GiB  a0d0  online
a0e8s1     136GiB  a0d0  online

[root@server ~]# megasasctl
a0          PERC 5/i Integrated      encl:1 ldrv:2  batt:good
a0d0         67GiB RAID 1   1x2  optimal
a0d1         836GiB RAID 5   1x4  optimal
a0e8s0     68GiB  a0d0  online
a0e8s1     68GiB  a0d0  online
a0e8s2     279GiB  a0d1  online
a0e8s3     279GiB  a0d1  online
a0e8s4     279GiB  a0d1  online
a0e8s5     279GiB  a0d1  online


[root@server ~]# megasasctl
a0           PERC 6/i Integrated      encl:1 ldrv:1  batt:good
a0d0         1861GiB RAID 6   1x6  optimal
a0e32s0    465GiB  a0d0  online
a0e32s1    465GiB  a0d0  online
a0e32s2    465GiB  a0d0  online
a0e32s3    465GiB  a0d0  online
a0e32s4    465GiB  a0d0  online
a0e32s5    465GiB  a0d0  online




server:~# megaraidsas-status

-- Arrays informations --
-- ID | Type | Size | Status
a0d0 | RAID 1 | 136GiB | optimal

-- Disks informations
-- ID | Model | Status | Warnings
a0e8s0 | SEAGATE ST3146854SS 136GiB | online
a0e8s1 | SEAGATE ST3146854SS 136GiB | online
[root@server ~]# megaraidsas-status
-- Arrays informations --
-- ID | Type | Size | Status
a0d0 | RAID 1 | 67GiB | optimal
a0d1 | RAID 5 | 836GiB | optimal

-- Disks informations
-- ID | Model | Status | Warnings
a0e8s0 | FUJITSU MBA3073RC 68GiB | online
a0e8s1 | FUJITSU MBA3073RC 68GiB | online
a0e8s2 | SEAGATE ST3300656SS 279GiB | online
a0e8s3 | SEAGATE ST3300656SS 279GiB | online
a0e8s4 | SEAGATE ST3300656SS 279GiB | online
a0e8s5 | SEAGATE ST3300656SS 279GiB | online
[root@server ~]# megaraidsas-status
-- Arrays informations --
-- ID | Type | Size | Status
a0d0 | RAID 6 | 1861GiB | optimal

-- Disks informations
-- ID | Model | Status | Warnings
a0e32s0 | SEAGATE ST3500620SS 465GiB | online
a0e32s1 | SEAGATE ST3500620SS 465GiB | online
a0e32s2 | SEAGATE ST3500620SS 465GiB | online
a0e32s3 | SEAGATE ST3500620SS 465GiB | online
a0e32s4 | SEAGATE ST3500620SS 465GiB | online
a0e32s5 | SEAGATE ST3500620SS 465GiB | online

How to unzip a file in Ubuntu?

First, move your *.zip file into the destination_folder

#unzip file.zip destination_folder

Example,

#unzip campfire_1.45.zip /usr/campfire_1.45/



If unzip in not installed,

#apt-get install unzip

Friday, May 3, 2013

Ubuntu apt-get update error 404 Not Found

All you need to do to resolve this problem is to modify your /etc/apt/sources.list file.  replace any lines like below,


deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe


to


deb http://old-releases.ubuntu.com/ubuntu/ precise universe
deb-src http://old-releases.ubuntu.com/ubuntu/ precise universe
deb http://old-releases.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://old-releases.ubuntu.com/ubuntu precise-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu precise-security main restricted
deb http://old-releases.ubuntu.com/ubuntu precise-security universe




All that's happened is that the installed ubuntu version has fallen out of support, so you need to point your apt sources at the old-releases repo. The file shown just has the original sources commented out and a new old-releases.ubuntu.com location added in.

All the other forum posts about moving sources.llist around, running sed commands against your sources and all that junk doesn't work, or at least didn't for me.. I don't even see that the sed replacement would have replaced anything in my case..

MegaCli Ubuntu

1. modify     /etc/opt/sources.list

2. Find a line says "deb http://hwraid.le-vert.net/ubuntu precise main" and uncommaned


3. run,   
    #apt-get update


4. run,
    #apt-get install megacli megaclisas-status megactl megaraid-status


5.  megacli -PDList -aALL
     More command in the following url
     https://supportforums.cisco.com/docs/DOC-16309