Showing posts with label vmware. Show all posts
Showing posts with label vmware. Show all posts

Thursday, April 11, 2013

How to auto start vmware guest OS when Windows host computer restart

Step 1. Create a new text file and save it as "startVM.bat"

Step 2. Ensure that the path of vmware is added in envrionment variable and enter the following into the "startVM.bat" and save:
vmrun -T ws start "Your_VM_Image.vmx"
Step 3. Open up "Task Scheduler" and select "Create Basic Task" under "Actions" tab.


Step 3.1 Give the task a name and click next.


Step 3.2 Choose "When the computer starts" when asked when you want the task to start.


Step 3.3 Choose "Start a program" when asked what action do you want the task to perform.


Step 3.4 Under "Program/script", browse to the location where you saved the "startVM.bat"


Step 3.5 Check "Open the properties dialog for this task when I click Finish" and click "Finish".



The "startVM.bat" is now scheduled to run when computer start. Now we will tweak the task to start one minute after the computer start so to allow the system to start up all the services before running the vmware. 

Step 4. Go to "Triggers" tab and double click on the trigger in the list.


Step 5. Check "Delay task for:" under "Advanced settings" and choose "1 minute". Press "ok" and you have successfully configure your vmware OS to auto start when your host OS restart.




Wednesday, April 10, 2013

How to shrink Linux .vmdk file on Windows host

Ever face the problem of your Linux image file keep growing bigger in size while the actual usage is smaller? I encountered this when my apache server created a massive 15GB log file and after deleting the log file, my image file is still 15GB+.

 Follow the steps to reduce the image file.

Step 1. Fill the unused space with zero with the following command:
sudo cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill
Wait for it to complete as it will take some times to complete depending on the assigned storage size.

Step 2. Power down the Linux guest OS when Step 1 complete.

Step 2.   If you have not set a path for your vmware, locate the location of where you installed your vmware. For mine, it is located at "C:\Program Files (x86)\VMware\VMware Workstation".

Step 3. Open command prompt and browse to the directory of the .vmdk file you want to reduce and enter the following command to begin shrinking:

"C:\Program Files (x86)\VMware\VMware Workstation" -k "Your_Image_File.vmdk"