Expand Hard Disk VMWare Linux (Debian)

I had Nagios running on a VM and the primary partition had almost no space left. Here the steps I had to do to expand the Partition.

1. Prepare the VM
1. Shutdown VM
2. Remove all Snapshots (Otherwise you can’t expand the HD)
3. Expand the Hard Drive
4. Make a Snapshot again in case something goes wrong

2. Check the State
Show all partitions and note the infos somewhere

fdisk -l

3. Find out the Start and the End Sector of the unallocated Space
Well the only way I found out was was actually to create an additional partition.

1. fdisk /dev/sda
2. n (new partition)
3. p (primary)
4. 3 (free number)
5. Enter (Note the default Start Number)
6. Enter (Note the default End Number)
7 w (To write/save it)

And now it looked like this and from the /dev/sda3 can I see now the last sector which is 5221:

First of all I didn’t understand why are the sectors from /dev/sda2 and /dev/sda5 overlapping. After some research it made sense because without and extended partition there would be a limit of just 4 primary partitions. This means that the /dev/sda2 is actually the container of the logical partition /dev/sda5.

Secondly I didn’t want to have a seperate partition /dev/sda3, instead I wanted to expand the /dev/sda1. But this is going to be a problem because we would need the sectors next to it and this would be overlapping with /dev/sda2 and /dev/sda5.

So with all previous information it is now easy to calcualte all Start and End Sectors of the partitions and the result should look like this

4. Repartition Everything
Now to get the result above we need to repartition everything.

1. First of all we need to switch off swapping so that the partiton /dev/sda2 and /dev/sda5 can be deleted
swapoff -a
2. fdisk /dev/sda
3. Delete all partitions even the /dev/sda1
d (Trough all numbers)
4. Recreate all partitions with the Start and End Sectors we calculated. /dev/sda1 should be a primary and the /dev/sda2 an extended. Then add the /dev/sda5 which is a logical in /dev/sda2.
n
5. With the /dev/sda5 I changed the Partition ID to SWAP
t
82
6. Save it
w

Switch swapping back on swapon /dev/sda5

4. Make sure the Kernels takes modified partition table into account
Now the partition table has been modified but the Kernel doesn’t take it to account yet.

partx /dev/sda

This command should fix this but I also rebooted the machine.

5. Finally expand the Partition
resize2fs /dev/sda1

Now you should have it. You can check the result with df.

No Comments »

admin on January 5th 2018 in IT, Linux

Convert VMWare VMDK into Hyper-V VHDX

1. Download and Install “Microsoft Virtual Machine Converter
2. Open Powershell with Elevated Privileges
3. Import Module / Convert VMDK
Import-Module “C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1”
convertTo-MvmcVhd -SourceLiteralPath c:\source\scource.vmdk -DestinationLiteralPath c:\destination\ -VhdType FixedHardDisk -VhdFormat vhdx

No Comments »

admin on January 1st 2018 in Hyper-V, IT, PowerShell, VMWare

ESXi change Kali screen resolution

Even I installed the VMWare Tools I wasn’t able to change the resolution. At the end I found out that I had to increase the video card memory from 4 up to 32. Now it works like a charm.

No Comments »

admin on December 26th 2017 in IT, Linux

Windows 2012 Server Installation get stuck on VMWare

I had the problem that Windows 2012 Server got stuck in the boot sequence. I just had to add a configuration parameter to make it work:
vmGenCounter.enable = FALSE

No Comments »

admin on January 16th 2013 in IT, VMWare, Windows Server

Make Backup Domain Controller work after Veeam Restore

Today I restored my Exchange Server and virtual Domain Controller but couldn’t get it working because our main Domain Controller wasn’t arround.
To make the second Domain Controller work just set the following setting in the registry and restart the Domain Controller. You might also need to restart all other servers.

image

No Comments »

admin on November 17th 2012 in IT, Windows Server

Determine ESx Host Version

Run this command from service console:
# vmware -v

No Comments »

admin on March 29th 2011 in IT, VMWare

Resize partition in VMWare Server

1. Delete all Snapshots or you can’t resize the disk
2. Shutdown Guest System
3. Go into Guest Properties and increase the disk size
4. Start Guest System
5. Create a Snapshot again

Windows Server Resize Partition
1. Download and install Diskpart from the Microsoft Webpage
2. Go into Command Console
3. Type: Diskpart
> LIST DISK
> SELECT DISK 0 [replace number with the disk you want to extend]
> LIST VOLUME
> SELECT VOLUME 1 [replace number with volume you want to extend]
> extend

Windows XP Resize Partition
Unfortunately Diskpart didn’t work for my Windows XP Version even it suppose to be supported. Anyway after try and error I found a good open source Partition Manager like Partition Magic.  It is called GParted and It is based on Linux and does a great job. You can get it here: http://gparted.sourceforge.net/

No Comments »

admin on May 11th 2010 in VMWare, Windows, Windows Server

Install VMWare tools in debian

1. Install Kernel Heaeders

  1. Get the Kernel version and remember it with:
    uname-r
  2. apt-get install linux-headers-[Kernel Version]

2. Install VMWare Tools

  1. Choose “install and upgrade VMWTools in VMWare” in your VM menu
  2. mount /dev/hda /media/cdrom
  3. cd /media/cdrom/
  4. cp VMWareTools[whateverversion]tar.gz /tmp/
  5. cd /tmp
  6. tar xvzf VMWareTools[whateverversion]tar.gz
  7. umount /media/cdrom/
  8. cd /tmp/vmware-tools-distrib/
  9. make a symlink:
    ln –s /usr/src/linux-headers-[Kernel Version] /usr/src/linux
  10. apt-get install gcc-4.1
  11. change using gcc version:
    export CC=/usr/bin/gcc-4.1
  12. I had make and killall missing on my installation so can you get it:
    apt-get install psmisc make
  13. ./vmware-install.pl

3. Uninstall VMWare Tools
After a failed installation of VMWare Tools I got following message:
A previous installation of VMWare Software has been detected… You may want to re-install VMWare Tools.

The solution was to run the uninstaller first and run the VMWare setup again:
1. ./vmware-uninstall.pl

No Comments »

admin on February 2nd 2010 in Linux, VMWare

Add Second Network Card in VMWare

Today I had to add a second virtual network in VMWare. Unfortunately I didn’t find any option first. To do this you need to actually power off the VMWare Host. Then go the settings of the VMWare Host. Click on Add Ethernet Card and confirm everything. Startup OS again.

No Comments »

admin on May 26th 2009 in IT, VMWare

Install VMWare Tools on Windows 2008 Server Core

I just installed Win2k8 Core on WMWare and tried to install VMWare as usual from the menu: VM\Install VMWare Tools… but nothing happened.

So I goggled and the solution is actually very easy:
1. Filemenu: “VM\Install VMWare Tools”
2. Command prompt run: “D:\Setup.exe”

That’s it…. have fun.

No Comments »

admin on January 22nd 2009 in Windows Server




Check out new movies online website. Download and buy movies now.
1