VMware vSphere

 View Only
  • 1.  3 simple esxi commandline questions

    Posted Oct 11, 2012 09:45 AM

    Hello
    I have 3 simple questions about ESXi-shell commands

    1. how do I run a dd command and gzip the results without storing the of-file somewhere ?

    /tmp # dd if=/vmfs/devices/disks/mpx.vmhba1\:C0\:T0\:L0:1 of=/tmp/dd.dump bs=1M count=20

    /tmp # gzip -c dd.dump > dump.gz

    instead of those 2 lines do it all in one without storing dd.dump

    2. how do I create a list of all vmx-files in a datastore without also listing  *.vmxf or files that have vmx in the name like vmx-blabla.vmdk
    the output must use full paths so I need something like this but without the false results

    find /vmfs/volumes/datastore1/* | grep ".vmx" | grep -v ".vmxf" > vmx-files.list

    3. how do I grep all vmware*.log files in a datastore for a complex string like "scsi0:0.filename = " and pipe the results in a file that lists the results like

    /vmfs/volumes/datastore1/test/test.vmware.log: 2012-10-01T07:19:00.120Z| vmx| DICT          scsi0:0.fileName = WIN02.vmdk

    /vmfs/volumes/datastore1/test2/test2.vmware.log: 2012-10-02T07:19:03.120Z| vmx| DICT          scsi0:0.fileName = test2.vmdk

    Thanks in advance



  • 2.  RE: 3 simple esxi commandline questions

    Posted Oct 11, 2012 12:05 PM

    2. does this do it ?

    find /vmfs/volumes -name *.vmx > vmx-list.txt

    1.

    dd if=/vmfs/devices/disks/mpx.vmhba1\:C0\:T0\:L0:1  conv=sync,noerror bs=1M count=20 | gzip -c  >  /tmp/dump.gz



  • 3.  RE: 3 simple esxi commandline questions
    Best Answer

    Posted Oct 11, 2012 12:38 PM

    3.you could xargs -- find /path/to/vmfs/ -name 'vmware*.log' | xargs grep -i string

    I assume this is 4.1 - I am not yet sure if ESXi has xargs

    HTH

    ~Sai Garimella



  • 4.  RE: 3 simple esxi commandline questions

    Posted Oct 11, 2012 12:49 PM

    thank you both

    all 3 commands work like a charm

    @Sai Garimella - your command works in esxi 5.1

    Dax



  • 5.  RE: 3 simple esxi commandline questions

    Posted Oct 11, 2012 02:31 PM

    one more question if you dont mind ...

    using find against large datastores seems to be very slow

    so if I want to create a listing of vmx-files and another one for vmdk-files and one for vmsd-files should I run

    find /vmfs/volumes/  -name "*.vmdk" > /tmp/vmdk.list

    find /vmfs/volumes/  -name "*.vmx" > /tmp/vmx.list

    find /vmfs/volumes/  -name "*.vmsd" > /tmp/vmsd.list

    or something like

    find /vmfs/volumes/  > /tmp/all.list
    grep ".vmx" /tmp/all.list | grep -v ".vmxf" > /tmp/vmx.list
    grep ".vmdk" /tmp/all.list > /tmp/vmdk.list
    grep ".vmsd" /tmp/all.list  > /tmp/vmsd.list

    the first option has better results but takes much longer