Linux command line: I Love You!

•maggio 20, 2013 • Lascia un commento

Today we start a list of posts with some tricks for command line linux ninjas.

Question: How Do I Find The Largest Top 10 Files and Directories On a Linux box?

The trick is:

# du -a /var | sort -n -r | head -n 10

or in a more readable manner for human ninjas

# (in a specific path) du -ah * | sort -rh | head -10

In this way we use the following tools:

  • head: Output the first part of files i.e. to display first 10 largest file.
  • sort : Sort lines of text files or given input data.
  • du : Estimate file space usage.

Deutsche Telekom Botnets monitoring

•marzo 19, 2013 • Lascia un commento

I found this website very interesting for Security Analysts.Immagine

Deutsche Telekom  have made a front-end of their monitoring infrastructure of botnets and attacks made to their honeypots dislocated all over europe networks.

Very good job!

How to extend an LVM volume

•marzo 19, 2013 • Lascia un commento

There are more resources to gain some informations about LVM extension.

I’ve got in trouble with a Turnkey installation of mysql on a vmware disk of 50GB.

Turnkey installation come with 20 gb of volume and this space contains OS and database files.

For extending any volume LVM i suggest these two guides:

http://www.turnkeylinux.org/blog/extending-lvm

http://www.thegeekstuff.com/2010/08/how-to-create-lvm/

How to Create a new region in Drupal 7

•gennaio 2, 2013 • Lascia un commento

Here is the list of operations to do:

1. Add ‘regions[your_new_region_name] = your_new_regon_friendlyname’ to the info file.

2. Add
.region-your_new_region_name {/*css snippets*/}

to your css theme main file.

3. Add

<?php
print render($page['copyright']);
?>

to your page.tpl.php file.

4. Clear all your cache by section Structure–>”Performance”

5. Insert a block in the region that will appear in the section: Blocks

 

How To Fix Host Not Responding Error with VMware ESX, vSphere in vCenter

•dicembre 21, 2012 • Lascia un commento

VirtualCenter looses connectivity to an ESX or vSphere host, and all of the virtual machines that are running on the host show as ‘disconnected’. You will also see that the host has ‘not responding’ in brackets next to it’s name.

This one is very simple to fix, as it is usually caused by the host agent service (mgmt-vmware) failing due to a dead process.

First, try and restart the mgmt-vmware service:

# service mgmt-vmware restart

If you find this is hanging when trying to restart the host agent, then you’ll need to kill off the process causing the issue. Open another console session and do the following:

# ps -ef | grep hostd

This will output a list of processes using hostd similar to the following:

root 23955 1 0 10:42 pts/1 00:00:00 /bin/sh /usr/bin/vmware-watchdog -s hostd -u 60 -q 5 -c /usr/sbin/vmware-hostd-support /usr/sbin/vmware-hostd -u
root 23961 23955 4 10:42 ? 00:00:15 /usr/lib/vmware/hostd/vmware-hostd /etc/vmware/hostd/config.xml -u
root 24211 23422 0 10:48 pts/1 00:00:00 grep hostd

If you look at the output carefully you’ll see that the first process is using the vmware-watchdog, this is fine, but the second line is using hostd (config.xml -u). This is the culprit, so lets kill the process. By the way, your virtual machines will continue to run so don’t worry about that.

# kill -9 23961

You’ll now find that the hostd service will start and after a few seconds your host and virtual machines will become available again in vCenter

iScsi Performance Test

•dicembre 21, 2012 • Lascia un commento

Here some useful tips:

What/kind how fast are the drives?

Software RAID?

Hardware RAID?

What kind of numbers are you getting from the Host Server with hdparm?

You should see a significant increase of performance after enabling write caching on the target (details depends on the implementation) and your disks.

The price however is that this will endanger data integrity (especially if you run databases) in the case of a power outage or a system hang of the SAN, as data which is thought to have been permanently written to disk, only resided in volatile DRAM.

To mitigate this risk, you should use a controller with BBWC (battery-backed write cache) where data would survive a power outage for a while (typically 1-2 days).

 

Tools:

hdparm

hdparm -W 1 /dev/sda
hdparm -W 1 /dev/sdb

iotop

vmstat(watch to wait and I/O ops)

iometer

scenarios with iometer:
1) sequential read/write -- this should give nice, fat numbers. 2) random access to the drive -- here you should be in for a land of hurt.
Setup a file for tests large enough to force it to be pushed out of cache of the virtual machine.

 

Troubleshooting virtual machine TCP/IP connection issues

•dicembre 21, 2012 • Lascia un commento

Hi all.

In these weeks i’ve got some errors from some vm(linux red hat 5) that seems to have some networking problems.

We’ve a VMWare cluster with VSphere 4.1 updated to the last patch level.

All the settings were unchanged in the last year but sometimes we’ve these errors:

– Cannot ping the vm eth interfaces from external machines

– Can ping the vm from VMs in the same host

or another one symptom

– the data transfer from fileserver samba in this vm and windows get slowly and packets are sometimes lost.

With the first one symptoms the solution was to apply vMotion and change the execution host, but the strange was that the vms with Os Windows on the same host were clear from these problems.

The results of our insvestigation is that the problems were generated by a defective ethernet card Netxen QuadPort. Also after an update of the firmware the card generate random problems on his NICs.

VmWare published an useful howto troubleshooting guide for TCP/IP issues that i link bottom:

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007842

Have a good Christmas!