Tuesday, November 20, 2012

Hot Remove a VMDK from LIVE LINUX Virtual Machine


If you want to remove an extra VMDK from a Linux VM,you need to follow these steps.

First you need to unmount the /dev/sdb1:

umount /dev/sdb1

Remove the /disk2 folder:

rmdir /disk2/

Remove the entry from the /etc/fstab:

nano or vi /etc/fstab

remove the following line:
/dev/sdb1               /disk2                  ext2    defaults        1 2

Delete the device:

echo 1 > /sys/block/sdb1/device/delete

Remove the VMDK:

ATTACHING new SCSI HDD (VMDK) to a running Virtual Machine (VM) - Live VM

THIS WILL LIST THE NAME OF THE SCSI HOST PRESENT ON THE SYSTEM, BASED ON WHICH HOST YOU ASSIGNED THE NEW DISK DRIVE TO RUN THE FOLLOWING COMMAND
  983  ls /sys/class/scsi_host

INITIALIZE SCSI
 980  echo "- - -" > /sys/class/scsi_host/host0/scan

RUN FDISK TO VERIFY IN LINUX
  981  fdisk -l

CHECK VAR LOG MESSAGES TO VERIFY THE SCSI DEVICE WAS ATTACHED SUCCESSFULLY
  982  tail -f /var/log/messages

CREATE A NEW VOLUME
  984  fdisk /dev/sde

FORMAT THE NEW VOLUME
  985  mkfs.ext3 /dev/sde1

CREATE A MOUNT POINT
  986  vi /etc/fstab

MOUNT IT
  987  mount /tmp

Monday, November 19, 2012

Thursday, November 15, 2012

A guide to figuring out the voltage range supported by any electronic equipment -by looking at the power cable

UN65ES6550F Can I Run The TVs Power Cable Through The Wall

Samsungs TV's power cables are UL (Underwriters Labs) certified but are not CL (In-wall) rated. A CL rating on a cable (CL2 up to 150 volts, CL3 up to 300 volts) means these cables have a slow burning outer jacket that should meet the fire codes and are safe for in wall installations. Since the power cord for the TV is not CL rated it should never be installed inside a wall.


Wednesday, November 14, 2012

Rescan the SCSI Bus to Add a SCSI Device Without rebooting the VM


Rescan the SCSI Bus to Add a SCSI Device
A rescan can be issued by typing the following command:
echo "- - -" > /sys/class/scsi_host/host#/scan
fdisk -l
tail -f /var/log/message


Format a New Disk

Create partition using fdisk and format it using mkfs.ext3 command:
# fdisk /dev/sdc
# mkfs.ext3 /dev/sdc3

Create a Mount Point And Update /etc/fstab

# mkdir /disk3
Open /etc/fstab file, enter:
# vi /etc/fstab
Append as follows:

/dev/sdc3               /disk3           ext3    defaults        1 2

Save and close the file.


Thursday, November 1, 2012

PowerCLI powershell VMWare Datastore autoload ps1 files profile powershell

Schedule a PowerCLI script as a cronjob or a scheduled task
http://www.virtu-al.net/2009/07/10/running-a-powercli-scheduled-task/


PS1 for Datastore management
  1. http://blogs.vmware.com/vsphere/2012/01/automating-datastore-storage-device-detachment-in-vsphere-5.html
  2. http://vmwaregirl.blogspot.com/2012/03/powercli-get-datastoremountinfo.html
    • List all the SCSI LUN's by the LUNID
    • get-vmhost -state connected | Get-ScsiLun | select-object CapacityMB,RuntimeName,CanonicalName|ft -autosize|findstr "L123

  3. http://snipplr.com/view/48048
  • Create a new VMFS datastore from LUN number (
     New-DatastoreByLun )

Auto Load Powershell script on run.
  1. http://noahcoad.com/post/66/powershell-startup-auto-load-scripts
             set-executionpolicy bypass
       Profile.ps1 under

%UserProfile%\Documents\WindowsPowerShell       Microsoft.PowerShell_profile.ps1 (for basic shell)            
       Microsoft.PowerShellISE_profile.ps1
(for the GUI) 

RDM REPORT - Datastore, RDM, LUN Visibility on Hosts (Node Visibility) output xls
  1. http://www.lucd.info/2010/04/09/lun-report-datastores-rdms-and-node-visibility/

Wednesday, October 24, 2012

Steps for detaching a snapshot VOLUME LUN and creat new volume copy from snapshot on HP P2000 MSA SAN VMWARE POWERCLI CLI



Step1. powerCLI (Only on the host where the VM is running)
    Shutdown & Power off the VM

 
Step2esxCLI (Perform on all hosts)
    a. If the LUN is an RDM, skip to step c. Otherwise, to get a list of all datastores mounted to an ESXi host, run the command:
 # esxcli storage filesystem list
    b. Unmount the datastore by running the command:
 # esxcli storage filesystem unmount [-u <UUID> | -l <label> | -p <path> ]
    c. Detach the device/LUN, run this command:
 # esxcli storage core device set --state=off -d NAA_ID
    d. To list the permanently detached devices: <Lists all detached LUN>
 # esxcli storage core device detached list
    e. Verify that the device is offline, run this command:
 # esxcli storage core device list -d NAA_ID
    f. Running the partedUtil getptbl command on the device shows that the device is not found.
 # partedUtil getptbl /vmfs/devices/disks/naa.?????????


Step3hpCLI
 # show volume-maps
 # unmap volume 10_23_LIS_Daily_C001



Step4esxCLI (Perform on all hosts)
  Rescan all devices on the ESXi host, run the command on all hosts:
    For rescanning vmhba2 only
 # esxcli storage core adapter rescan -A vmhba2
    For rescanning all adapters
 # esxcli storage core adapter rescan -a 


Step5hpCLI
 # show volumes
 # delete volumes 10_23_LIS_Daily_C001  (10 Seconds for 2.6TB partition)



Step6hpCLI
 # show volumes
 # show snapshots
 # show vdisks



Step7.  hpCLI
    To initiate volumecopy from the snapshot
 # volumecopy modified-snapshot no source-volume LIS_Daily dest-vdisk vd01 10_24_LIS_CLONE prompt yes  Success: Command completed successfully. (LIS_Daily) - The volume copy started. (2012-10-24 16:18:53)

    Check volumecopy status
 # show volumecopy-status


Step8.  hpCLI
    Map volume 10_24_LIS_CLONE with
    read-write access for
    HOSTS ESXHS01_vmhba2 and ESXHS02_vmhba2
    Using ports A1,A2 and B1,B2 and
    LUN 101:
 # map volume access rw ports a1,a2,b1,b2 lun 101 host ESXHS01_vmhba2,ESXHS02_vmhba2 10_24_LIS_CLONE
  
    To apply mapping to all hosts (Omit the host parameter, by default it applies to all hosts)
 # map volume access rw ports a1,a2,b1,b2 lun 101 10_24_LIS_CLONE