Vmware: Difference between revisions
(Created page with " <pre> #!/usr/bin/perl -w use strict; use Data::Dumper; $/ = "\n\n"; print "Name,State,Status,Host,provisioned,used,cpu,mem,percent,vmwaretools,dnsname,evc,uuid,notes,alar...") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== block2csv == | |||
Copy paste all selected servers in the cluster view | |||
use this to csv it. | |||
block2csv.pl | |||
<pre> | <pre> | ||
#!/usr/bin/perl -w | #!/usr/bin/perl -w | ||
Line 16: | Line 21: | ||
print $r->{'name'} .",". $r->{'state'}.",". $r->{'status'}.",". $r->{'host'}.",". $r->{'provisioned'}.",". $r->{'used'}.",". $r->{'cpu'} .",". $r->{'mem'}.",". $r->{'percent'}.",". $r->{'vmwaretools'}.",". $r->{'dnsname'}.",". $r->{'evc'} .",". $r->{'uuid'} .",". $r->{'notes'} .",". $r->{'alarms'} . "\n";} | print $r->{'name'} .",". $r->{'state'}.",". $r->{'status'}.",". $r->{'host'}.",". $r->{'provisioned'}.",". $r->{'used'}.",". $r->{'cpu'} .",". $r->{'mem'}.",". $r->{'percent'}.",". $r->{'vmwaretools'}.",". $r->{'dnsname'}.",". $r->{'evc'} .",". $r->{'uuid'} .",". $r->{'notes'} .",". $r->{'alarms'} . "\n";} | ||
</pre> | </pre> | ||
== extending a disk with no vcentre == | |||
windows: | |||
# In the OS powered down with a shutdown /i ( pointed back to itself) | |||
# ssh into the esxi host: cd to the vmfs dir and : vmkfstools --extendvirtualdisk 100G mydisk.vmdk | |||
# vim-cmd vmsvc/getallvms to figure out what the ID of the vm is | |||
# vim-cmd vmsvc/power.on 81 | |||
== cool tools == | |||
* http://www.vmware.com/support/developer/vcli/vcli41/doc/reference/vmkfstools.html | |||
== files REQUIRED for a vm == | |||
hostname.vmx | |||
hostname.vmdk | |||
hostname-flat.vmdk | |||
hostname_1.vmdk | |||
hostname_1-flat.vmdk | |||
on files: | |||
http://www.vmware.com/support/ws5/doc/ws_learning_files_in_a_vm.html | |||
== Creating an ESXi usb key == | |||
Procedure | |||
1 If your USB flash drive is not detected as /dev/sdb, or you are not sure how your USB flash drive is detected, determine how it is detected. | |||
a In a terminal window, run the following command. | |||
tail -f /var/log/messages | |||
This command displays current log messages in the terminal window. | |||
b Plug in your USB flash drive. | |||
The terminal window displays several messages identifying the USB flash drive, in a format similar to the following message. | |||
Oct 25 13:25:23 ubuntu kernel: [ 712.447080] sd 3:0:0:0: [sdb] Attached SCSI removable disk | |||
In this example, "[sdb]" identifies the USB device. If your device is identified differently, use that identification, without the brackets, in place of sdb, in this procedure. | |||
2 Create a partition table on the USB flash device. | |||
/sbin/fdisk /dev/sdb | |||
a Type d to delete partitions until they are all deleted. | |||
b Type n to create primary partition 1 that extends over the entire disk. | |||
c Type t to set the type to an appropriate setting for the FAT32 file system, such as c. | |||
d Type a to set the active flag on partition 1. | |||
e Type p to print the partition table. | |||
The result should be similar to the following text: | |||
Disk /dev/sdb: 2004 MB, 2004877312 bytes | |||
255 heads, 63 sectors/track, 243 cylinders | |||
Units = cylinders of 16065 * 512 = 8225280 bytes | |||
Device Boot Start End Blocks Id System | |||
/dev/sdb1 * 1 243 1951866 c W95 FAT32 (LBA) | |||
f Type w to write the partition table and quit. | |||
3 Format the USB flash drive with the Fat32 file system. | |||
/sbin/mkfs.vfat -F 32 -n USB /dev/sdb1 | |||
4 Run the following commands. | |||
/usr/bin/syslinux /dev/sdb1 | |||
cat /path_to_syslinux-3.86_directory/syslinux-3.86/usr/share/syslinux/mbr.bin > /dev/sdb | |||
5 Mount the USB flash drive. | |||
mount /dev/sdb1 /usbdisk | |||
6 Mount the ESXi installer ISO image. | |||
mount -o loop VMware-VMvisor-Installer-5.x.x-XXXXXX.x86_64.iso /esxi_cdrom | |||
7 Copy the contents of the ISO image to /usbdisk. | |||
cp -r /esxi_cdrom/* /usbdisk | |||
8 Rename the isolinux.cfg file to syslinux.cfg. | |||
mv /usbdisk/isolinux.cfg /usbdisk/syslinux.cfg | |||
9 In the file /usbdisk/syslinux.cfg, change the line APPEND -c boot.cfg to APPEND -c boot.cfg -p 1. | |||
10 Unmount the USB flash drive. | |||
umount /usbdisk | |||
11 Unmount the installer ISO image. | |||
umount /esxi_cdrom | |||
The USB flash drive can now boot the ESXi installer. | |||
== Unattended vmware tools install == | |||
vmware-install.pl --default EULA_AGREED=yes" | |||
== unattned vmware tool update == | |||
... | |||
== See Also == | |||
* [[/Vmware cluster setup]] |
Latest revision as of 20:29, 13 July 2014
block2csv
Copy paste all selected servers in the cluster view
use this to csv it.
block2csv.pl
#!/usr/bin/perl -w use strict; use Data::Dumper; $/ = "\n\n"; print "Name,State,Status,Host,provisioned,used,cpu,mem,percent,vmwaretools,dnsname,evc,uuid,notes,alarms\n"; while (<>){ # print; my $r; ( $r->{'name'} , $r->{'state'}, $r->{'status'}, $r->{'host'}, $r->{'provisioned'}, $r->{'used'}, $r->{'cpu'} , $r->{'mem'}, $r->{'percent'}, $r->{'vmwaretools'}, $r->{'dnsname'}, $r->{'evc'}, $r->{'uuid'} , $r->{'notes'} , $r->{'alarms'} ) = split "\n"; print $r->{'name'} .",". $r->{'state'}.",". $r->{'status'}.",". $r->{'host'}.",". $r->{'provisioned'}.",". $r->{'used'}.",". $r->{'cpu'} .",". $r->{'mem'}.",". $r->{'percent'}.",". $r->{'vmwaretools'}.",". $r->{'dnsname'}.",". $r->{'evc'} .",". $r->{'uuid'} .",". $r->{'notes'} .",". $r->{'alarms'} . "\n";}
extending a disk with no vcentre
windows:
- In the OS powered down with a shutdown /i ( pointed back to itself)
- ssh into the esxi host: cd to the vmfs dir and : vmkfstools --extendvirtualdisk 100G mydisk.vmdk
- vim-cmd vmsvc/getallvms to figure out what the ID of the vm is
- vim-cmd vmsvc/power.on 81
cool tools
files REQUIRED for a vm
hostname.vmx hostname.vmdk hostname-flat.vmdk hostname_1.vmdk hostname_1-flat.vmdk
on files:
http://www.vmware.com/support/ws5/doc/ws_learning_files_in_a_vm.html
Creating an ESXi usb key
Procedure 1 If your USB flash drive is not detected as /dev/sdb, or you are not sure how your USB flash drive is detected, determine how it is detected.
a In a terminal window, run the following command.
tail -f /var/log/messages
This command displays current log messages in the terminal window.
b Plug in your USB flash drive.
The terminal window displays several messages identifying the USB flash drive, in a format similar to the following message.
Oct 25 13:25:23 ubuntu kernel: [ 712.447080] sd 3:0:0:0: [sdb] Attached SCSI removable disk
In this example, "[sdb]" identifies the USB device. If your device is identified differently, use that identification, without the brackets, in place of sdb, in this procedure.
2 Create a partition table on the USB flash device.
/sbin/fdisk /dev/sdb
a Type d to delete partitions until they are all deleted.
b Type n to create primary partition 1 that extends over the entire disk.
c Type t to set the type to an appropriate setting for the FAT32 file system, such as c.
d Type a to set the active flag on partition 1.
e Type p to print the partition table.
The result should be similar to the following text:
Disk /dev/sdb: 2004 MB, 2004877312 bytes 255 heads, 63 sectors/track, 243 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 1 243 1951866 c W95 FAT32 (LBA)
f Type w to write the partition table and quit.
3 Format the USB flash drive with the Fat32 file system.
/sbin/mkfs.vfat -F 32 -n USB /dev/sdb1
4 Run the following commands.
/usr/bin/syslinux /dev/sdb1 cat /path_to_syslinux-3.86_directory/syslinux-3.86/usr/share/syslinux/mbr.bin > /dev/sdb
5 Mount the USB flash drive.
mount /dev/sdb1 /usbdisk
6 Mount the ESXi installer ISO image.
mount -o loop VMware-VMvisor-Installer-5.x.x-XXXXXX.x86_64.iso /esxi_cdrom
7 Copy the contents of the ISO image to /usbdisk.
cp -r /esxi_cdrom/* /usbdisk
8 Rename the isolinux.cfg file to syslinux.cfg.
mv /usbdisk/isolinux.cfg /usbdisk/syslinux.cfg
9 In the file /usbdisk/syslinux.cfg, change the line APPEND -c boot.cfg to APPEND -c boot.cfg -p 1.
10 Unmount the USB flash drive.
umount /usbdisk
11 Unmount the installer ISO image.
umount /esxi_cdrom
The USB flash drive can now boot the ESXi installer.
Unattended vmware tools install
vmware-install.pl --default EULA_AGREED=yes"
unattned vmware tool update
...