Tuesday, December 16, 2008

How to increase your Virtual Machine's Disk Size

Have been working on Virtual machines for my malware reaserch. Normally will create a 3.8GB image (for portablility in flashdrive). But recently face the problem of VM image running out of diskspace.

At first, i thought it is not possible to increase the VM disk size. Only way is to recreate a bigger image. But after some googling and testing, i manage to increase my VM disk size without recreating a new image.

Steps to increase VM disk size:
I have a 3.8GB VM image, the following steps will show how to increase it to 6GB.


1> To increase the VM disk size,
- Move to VMware directory. e.g "C:\Program Files\VMware\VMware Workstation"
- Use the command "vmware-vdiskmanager -x". e.g "vmware-vdiskmanager -x 6GB G:\myDisk.vmdk" (refer to picture above)
- The additional space created will be unallocated space in your VM image. To merge it into the exisitng partition, you can use "diskpart" (as shown in step 7 and 8).

Note: The "vmware-vdiskmanager" command only works on disk with no snapshots. The "diskpart" command will not be able to merge a system partition, you will need to mount it and boot up from another VM image.


2> To mount your "increased" VM image(VM1) to another image (VM2)
- Select "Edit Virtual Machine Settings" from VM2.
- Select "Hard Disk" and Click "Add".


3> Select the Hardware type
- Under "Hardware type", select "Hard Disk" and click "Next".


4> Select what type of disk to be used for the drive
- Under "Select a Disk", select "Use an existing virtual disk" and click "Next".


5> Select the location of the existing virtual disk
- Select the location (path) of VM1 .vmdk file by clicking the "Browse...".
- Click "Finish". The VM image (VM1) is mounted into VM2
- Startup VM2 image


6> Check that VM1 successfully mounted into VM2
- Under "Control Panel" > "Admintrative tools" > "Computer Management" > "Disk Management".
- You should see VM1 mounted as one of the virtual disk (with both allocated and unallocated space). In the picture above, it is mounted as Disk 1.


7> Using command line utility to resize disk partitions in Windows.
- From "Start" button, select "Run".
- Type "diskpart" to run the commandline utility.


8> Merge the unallocated space with diskpart
- Type "list volume" to list all the disk volume.
- Based on the drive letter and the vloume size, choose the volume to merge by typing "Select volume "
- Type "extend" to merge the unallocated space with the selected volume.


9> Check if the partition successfully extended
- If the merging is successful, you will see the unallocated space gone and the partition being extended to 6GB in the "Disk Management" console.
- You can shutdown the VM2 and remove VM1 from as the mounted disk.
- To remove VM1 from the mounted disk, follow step 2. Instead of adding, select the VM1 disk and Click "Remove".

Friday, December 12, 2008

Download Limits in Internet Explorer

IE with Registry editor
Recently, i heard an old question: "Why can only download 2 files at a time" again. This question was commonly asked during the times where most people were using dial-up and bandwidth were limited. I decided to blog this down as reference for those who might ask me again in future.

This download limitation only occurs in IE (Internet Explorer). But why does IE behave this way while some other Internet browsers don't?

This is because IE comply to the Internet standard (RFC2616). According to the RFC, Not more than 2 simultaneous connections should be maintain.

"Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy."

However, you can still bypass this restriction in IE by changing the registry setting. To increase the number of simultaneous connections follow these steps:

1) Run Registry Editor (Click on Start > Run, type "Regedit" and press OK)

2) Go to "HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings"

3) Select New > DWORD Value from the Edit menu

4) Name the new value "MaxConnectionsPer1_0Server"

5) Right-click the MaxConnectionsPer1_0Server value and choose Modify

6) Under Base, click the radio button next to "Decimal"

7) In the Value Data, enter the number of simultaneous connections you want to set (e.g. 10), and click OK

8) Repeat steps 3 - 7 using the new value MaxConnectionsPerServer

9) Exit the registry editor

Please note that changing this setting violates RFC standards. Use at your own risk!