Freeing up space

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

I like VMs. Sure, everything should be cloud, and AWS, Azure, etc are great (if you can afford them). But nothing beats having a local VM running with 6GB RAM even when you are not online. Cost? 0 $. I am just electively using the laptop I already use. Put a VM on an external USB drive is not a problem. With USB 3.0 the performance is quite good, even with USB 2.0 you can run a VM; starting and stopping takes a while, but once the services are started, they work quite nicely.

To not occupy all the disk space at once, my VMs are configured to dynamically allocate space. This allows me to run VMs from the SSD of the laptop, speeding things up even more. A normal VM takes only a few GB: the OS + software.

A problem is the ext4 file system used by my Linux VMs. Once a space was allocated, it stays allocated. The effect is that a VM is occupying internally 30 GB consumes 100 GB on my hard drive. Why? Adding and deleting files, caches, etc. The DB may take only 20 GB, but adding and deleting 10GB results that the VM occupies 30 GB. Do that for some time and suddenly the VM eats up 100 GB of your hard drive instead of 30GB.

How to regain hard drive space?

VMWare comes with a compact tool to recover space, but that only works ootb with Windows VMs. For Linux VMs with a journaling file system like ext4 some preparations are needed. In short, the preparation is to create huge empty file that only contains 0.

First, stop the running services. The file going to be created will consume the free space of the virtual disk. Running services will get into trouble when they cannot write anymore to the disk. Like log files or real data. To not let your database or Tomcat server crash uncontrolled, stop them before creating the file.

Command to create the file:

dd if=/dev/zero of=/dummy bs=4096

This command lets dd create a file named dummy in /. The file size will be the entire free space of the virtual disk. If you configured your virtual disk to be 500GB and you have 400GB free, the resulting file size will be 400GB. You do not need to have 400GB free on your physical disk where the VM is stored on. As you write zeros, the real space needed will be 0 MB.

After dd filled you file system, it will exit. Delete the dummy file

rm /dummy

Shut down your VM. Open VM Player, open the properties of the VM, select the hard disk you want to compact and start the Compact tool from the Utilities drop down.

This will start the compact tool. After a while you’ll see a success message, informing you that the disk was compacted.

 

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Afaria Setup: Install roles – Active Directory

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Afaria does not necessarily need Active Directory. In fact it works nicely with LDAP or integrated Windows authorization too. As Afaria will be installed on a Windows server and AD is available out of the box, it makes sense to enable AD. Creating later new users for device enrollment is easy as they only have to be added to AD.

To add AD, the corresponding role must be added in the server configuration.

Click on Add roles.

Select Active Directory Domain Services.

AD needs the .NET framework. Therefore, the wizard will present a pop up asking to add this feature too. To do so, select Add Required Features.

After Windows installed AD, it needs to be configured. This is done via dcpromo. The installation wizard offers the option to run this tool directly after the installation finished. If the blue link wasn’t clicked, or promoting the server to a AD server should be done later, this tool can be run from command line at any time.

Open a shell (cmd.exe) and start dcpromo.

The Windows Server 2008 R2 is not part of any other domain. A new domain in a new forest must be created. Here I give as name of the domain tobias.de. Of course any other valid domain name can be chosen, like afariatest.corp.

This finishes the installation and initial configuration of AD. After restart, the Windows Server is an AD domain controller.

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Afaria Setup – Windows preparations

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

The specific server requirements for Afaria can be taken from SAP PAM.

For the scenario of this document I assume that you simply want to try out things with Afaria, like getting a understanding of how things work, how to get a device managed by Afaria. To be able to install Afaria, you need a Windows Server 2008 R2 with SP1. To be able to enroll devices, a Certificate Authority that supports NDE is needed. While you can find Windows Ser2008 R2 on Amazon EC, these are not Enterprise Editions. And you need a EE for installing a CA that supports NDE. This feature is included in Server 2012 R2, but Afaria does not run on Windows Server 2012 R2.

To start with Afaria, you need to have a Windows Server 2008 R2 SP1 installation available. An alternative to buying one is to use the trial version. Microsoft offers a trial that is valid for 180 days. http://www.microsoft.com/en-us/download/details.aspx?id=2227. After all, the objective is to try things out with Afaria. The trial offered by Microsoft is delivered as a VHD image, so you’ll need Hyper-V (or transform it to a VMDK image).

After starting the image for the first time, Windows will configure itself.

After finishing the initial configuration, a password for the user Administrator must be given.

You do not have to change the password after the first logon, so you can already chose the one you want to work with.

In case you run your Windows 2008 R2 server in VMWare, it is a good idea to install the VM Ware tools.

Install VMWare tools

To install the VMWare tools, proceed as instructed by VMWare. Go to Manage and select Install VMWare Tools option.

This inserts a virtual CD that contains the VM Ware tools files. Open the Windows Explorer, navigate to the CD drive. Start the installation by running the file setup64.exe.

This will run the VMWare tools installer and install the tools.

To finish the installation, restart the computer.

Update system

The image provided by Microsoft is from 2009, meaning it comes with the same patch level it was built with in 2009. This also means that this Windows version does not meet the minimum requirements of Afaria: SP1 for Windows Server 2008. To get the SP1 you either download the complete SP1 stack from Microsoft or you download and install it through Windows update. The Windows update process brings the image to a current and patched version. Therefore this is the process you should follow.

Start Windows update and turn on automatic updates.

To be able to use Windows 2008 R2 with Windows update, you first must update Windows update.

Afterwards, Windows update will start searching for missing updates. This will show already 127 missing updates. Be prepared, this is only the start of a lengthy update process.

This will take a while to finish. During this first update run IE 9 will be installed. Afterwards, restart the computer. Windows will configure and install the updates.

Log on to Windows. Install more Window updates.

Restart Windows. Log on again and install more updates.

Check for updates

Important: Afaria needs Windows 2008 Server with SP1. Make sure SP1 is part of the updates to be installed list.

Download updates including SP1 for Windows 2008.

SP1 is getting installed and configured.

Let Windows reboot and log on again.

SP1 for Windows 2008 R2 Server is installed. The minimum requirement of Afaria regarding Windows are now met.

Best is to check again for new updates and install them. Go to Windows update and check for new updates.

Update Windows Update (yes, this is as funny as it sounds).

 

Good thing is that this will get you IE11.

After restarting Windows, continue installing patches

Restart Windows to finish installing the patches. Finally, Windows is up to date

Backup

In case you use a VM: take a snapshot or take a backup.

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn