Kroko Just another WordPress weblog

June 19, 2014

VMWare vSphere ESXi v5.5 Datastore problems

Filed under: Linux — admin @ 2:41 pm

I found an error with vmware esxi. Message from windows client is: Call “HostStorageSystem.ComputeDiskPartitionInfo” for object “storageSystem” on ESXi “x.x.x.x” failed.

I have the issue because the disk that I was using had existing partitions (a Linux swap partition and a Linux MD5 RAID partition).  I had to manually delete the partitions logged in as root to my ESXi box, even though ESXi said it would do that for me.

Useful commands:

# esxcfg-scsidevs -l

this lists the disk devices, the device file will be /dev/disks/<NAME>

output looks like:

   Device Type: Direct-Access
   Size: 305245 MB
   Display Name: Local ATA Disk (t10.ATA_ST3320620AS_6QF1PZXB)
   Multipath Plugin: NMP
   Console Device: /vmfs/devices/disks/t10.ATA_____ST3320620AS_________________________________________6QF1PZXB
   Devfs Path: /vmfs/devices/disks/t10.ATA_____ST3320620AS_________________________________________6QF1PZXB
   Vendor: ATA       Model: ST3320620AS       Revis: 3.AA
   SCSI Level: 5  Is Pseudo: false Status: on
   Is RDM Capable: false Is Removable: false
   Is Local: true  Is SSD: false
   Other Names:
   VAAI Status: unknown


Easy solution:

Now can recreate partition table for that disk with a blank one:

for MSDOS run:

 ~ # partedUtil setptbl /dev/disks/naa.600508b1001c95a3d3a1f9455babd2d0 msdos


0 0 0 0

for HDD larger than 2TB use GPT:

~ # partedUtil setptbl /dev/disks/naa.600508b1001cfb4c4b4ed4e1eee52e25 gpt


0 0 0 0

Now you have a fresh drive. Try to add again in datastore.


Alternative solution:

# partedUtil get /dev/disks/t10.ATA_...

this shows the partitions on the device

output looks like:

38913 255 63 625142448

1 63 514079 130 128

2 514080 625137344 253 0

this disk has 2 partitions, numbers 1 and 2

# partedUtil delete /dev/disks/t10.ATA_... 2

deletes partition 2

# partedUtil delete /dev/disks/t10.ATA_... 1

deletes partition 1

April 21, 2014

Cpanel Disable mod_security2 for a single domain

Filed under: Cpanel — admin @ 10:10 pm

Mod_security is an open source Apache module.

This can be considered as firewall for web applications. It secures the system from the attackers.

The following steps can be used to disable mod_security2 rule for one domain in cPanel servers.

1. Make the directory “/usr/local/apache/conf/userdata/std/2/username/

2. Create a file “vhost.conf” in the above location

3. Add the following lines :


<IfModule mod_security2.c>

SecRuleEngine Off



To disable mod_security2 for a particular location :


<LocationMatch specify_the_path_here>

<IfModule mod_security2.c>

SecRuleEngine Off




To disable a particular mod_security2 rule :


<IfModule mod_security2.c>

SecRuleRemoveById give_ruleID_here



Run the following script after making the changes.


/scripts/ensure_vhost_includes --user=username


This script will uncomment the following line in apache configuration and restart apache.


Include “/usr/local/apache/conf/userdata/std/2/username/*.conf”

March 7, 2014

Linux usbreset

Filed under: Linux — admin @ 10:35 am
Force Linux's USB stack to perform a port reset and re-enumerate a device using
Note however, that reset followed by re-enumeration is _not_ the same thing as
 power-cycle followed by reconnect and re-enumeration.

Run the following commands in terminal:

  1. Compile the program:
    $ cc usbreset.c -o usbreset
  2. Get the Bus and Device ID of the USB device you want to reset:
    $ lsusb
    Bus 004 Device 002: ID 19d2:0016 ZTE WCDMA Technologies MSM
    Make our compiled program executable:
  3. $ chmod +x usbreset
  4. Execute the program with sudo privilege; make necessary substitution for <Bus>
  5.  and <Device> ids as found by running the lsusb command:
    $ sudo ./usbreset /dev/bus/usb/004/002  


/* usbreset -- send a USB port reset to a USB device */

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>

#include <linux/usbdevice_fs.h>

int main(int argc, char **argv)
    const char *filename;
    int fd;
    int rc;

    if (argc != 2) {
        fprintf(stderr, "Usage: usbreset device-filename\n");
        return 1;
    filename = argv[1];

    fd = open(filename, O_WRONLY);
    if (fd < 0) {
        perror("Error opening output file");
        return 1;

    printf("Resetting USB device %s\n", filename);
    rc = ioctl(fd, USBDEVFS_RESET, 0);
    if (rc < 0) {
        perror("Error in ioctl");
        return 1;
    printf("Reset successful\n");

    return 0;
« Newer PostsOlder Posts »

Powered by WordPress