Vmware: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 100: Line 100:
  vmkfstools --fix check /vmfs/volumes/4e0cdac0-bbcd2986-39a2-b8ac6f88f9f9/shehbab.se2.ipsoft.com/IPcenter-CIS-SL69-20170801.vmdk
  vmkfstools --fix check /vmfs/volumes/4e0cdac0-bbcd2986-39a2-b8ac6f88f9f9/shehbab.se2.ipsoft.com/IPcenter-CIS-SL69-20170801.vmdk
=ssh password less login=
=ssh password less login=
esxi -4
/.ssh/authorized_keys
esxi 5+
esxi 5+
  /etc/ssh/keys-<username>/authorized_keys
  /etc/ssh/keys-<username>/authorized_keys

Revision as of 09:13, 9 November 2018

Reload vmx file

vim-cmd vmsvc/reload Vmid

To power on a virtual machine from the command line:

  1. List the inventory ID of the virtual machine with the command:
vim-cmd vmsvc/getallvms
  1. Check the power state of the virtual machine with the command:
vim-cmd vmsvc/power.getstate <vmid>
  1. Power-on the virtual machine with the command:
vim-cmd vmsvc/power.on <vmid>

deploy vmware machine on cli

Look at image.

/vmfs/volumes/datastore1/ipmon_images/vmware-ovftool/ovftool /vmfs/volumes/datastore1/Test_image.ova
OVF version:   1.0
VirtualApp:    false
Name:          test

Annotation:  Test image. 
            
            Virtual Machine Version: 8
            
            CPU:       4vCPU
            Memory:  8G
            HD:         50G [ Optimal Performance = Thick Provision Eager 
            Zeroed ] 

Download Size:  1.69 GB

Deployment Sizes:
 Flat disks:   50.00 GB
 Sparse disks: 3.86 GB

Networks:
 Name:        vmware
 Description: vmware description

Virtual Machines:
 Name:               Test-SL-6.6-NovAPP
 Operating System:   rhel6_64
 Virtual Hardware:
   Families:         vmx-08 
   Number of CPUs:   4
   Cores per socket: 1
   Memory:           8.00 GB

   Disks:
     Index:          0
     Instance ID:    9
     Capacity:       50.00 GB
     Disk Types:     SCSI-VirtualSCSI 

   NICs:
     Adapter Type:   VmxNet3
     Connection:     dvpg-VM Linux-820

Setup machine from image.

/vmfs/volumes/datastore1/vmware-ovftool/ovftool -dm=thick -ds=datastore1 "--net:vmware=VM Network" '/vmfs/volumes/datastore1/ipmon_images/Test_image.ova' 'vi://root:password@localhost'
Opening OVA source: /vmfs/volumes/datastore1/Test_image.ova
Opening VI target: vi://root@10.151.105.131:443/
Deploying to VI: vi://root@10.151.105.131:443/
Transfer Completed                    
The manifest validates
Warning:
 - No manifest entry found for: 'SL-6.6-NovAPP-05092015-disk1.vmdk'.
Completed successfully

which version of esxi

# vmware -vl
VMware ESXi 4.1.0 build-260247
VMware ESXi 4.1.0 GA

backup

Backing up a running virtual machine. Run the following command to create a snapshot:

vmware-cmd <path to vmx file> createsnapshot <name of snapshot> <snapshotdescription> 1 1

Run the following command to make a clone:

vmkfstools -i  

Run the following command to remove all snapshots:

vmware-cmd <path to vmx file> removesnpshots

Backup the cloned VMDK file using NetBackup.

list virtual machines

esxcli vm process list

show ip address of esxi host

esxcli network ip interface ipv4 get

create vmdk file that point to flat file.

Rename to flat

mv IPcenter-CIS-SL69-20170801.vmdk IPcenter-CIS-SL69-20170801-flat.vmdk

List size of file.

ls -la
-rw-------    1 root     root     80530636800 Jan  4 10:22 IPcenter-CIS-SL69-20170801-flat.vmdk

Create think file matching criteria.

vmkfstools -c 80530636800 -a lsilogic -d thin temp.vmdk

Rename file to matching name.

mv temp.vmdk IPcenter-CIS-SL69-20170801.vmdk

Edit file to contain reference to right file and remove thin option.

vim IPcenter-CIS-SL69-20170801.vmdk
# Change name to *flat.vmdk file.
RW 8388608 VMFS "vmdisk0-flat.vmdk"
# Remove this line.
ddb.thinProvisioned = "1"

Test that file work.

vmkfstools --fix check /vmfs/volumes/4e0cdac0-bbcd2986-39a2-b8ac6f88f9f9/shehbab.se2.ipsoft.com/IPcenter-CIS-SL69-20170801.vmdk

ssh password less login

esxi -4

/.ssh/authorized_keys

esxi 5+

/etc/ssh/keys-<username>/authorized_keys