Sunday, December 11, 2016

Raspberry Pi/PC - NAS: OpenMediaVault

Today I’m going to show you how to install and configure OpenMediaVault which is a very cool platform that allow you to make a NAS out of a Raspberry Pi or a PC and add a lot of services on top of that, these are either already builtin ou added via the many plugins that you can install with just a click.

Index

  • Install - PC / VM
  • Install - Raspberry Pi
  • Log In
  • System Basic SetUp
  • Storage SetUp
  • Users SetUp
  • Service SetUp – SMB/CIFS
  • Service SetUp – Other Services (Compact)

 

NOTE

On the Web Interface every change needs to be:

SAVED and APPLIED

or else the changes don't take efect

 

Install – PC / VM

 

Installing OMV

Go to:

    https://sourceforge.net/projects/openmediavault/files/3.0beta/

and get the iso, in my case i got this:

    openmediavault_3.0.36-amd64.iso   
   
for a real PC you must burn it to a CD and put it in the CD Drive and for a VM you just select
the ISO image.

Now start you PC/VM and boot the CD/ISO, then series of BLUE SCREENS will show and you should  configure it to your specific location, bellow  you have the default values OMV gives you.
   
Use Tab and Arrow Keys to move arround in
each screen

    ## BLUE SCREENS ##

  • Select Language | English
  • Select your location | United States
  • Keymap to use | American English
  • Configure the Network | Hostname: openmediavault
  • Configure the Network | Domain name: local
  • Set up users and passwords | Root password:********
  • Set up users and passwords | Re-enter password to verify:********
  • Configure the clock | Select your time zone: Eastern


    Wait...

  • Configure the package manager | Debian archive mirror country: United States
  • Configure the package manager | Debian archive mirror: ftp.us.debian.org  
  • Configure the package manager | HTTP proxy information: <blank>

    Wait...

  • Install the GRUB boot loader on a hard disk | Device for boot loader installation: /dev/sda

    Wait...

  •     Configuring resolvconf | Installation complete: <Continue>

    Now it boot up and starts OpenMediaVault showing you the CLI

 

Installing OMV Extras

The OMV Extras plugins adds multiple plugins repositories that make installing additional plugins very easy.

Download the plugin OMV Extras plugin here:

    http://omv-extras.org/joomla/index.php/guides

download the .deb for you version:
 
     For OMV 2.x (stoneburner) - openmediavault-omvextrasorg_latest_all.deb
     For OMV 3.x (erasmus) (STILL BETA) - openmediavault-omvextrasorg_latest_all3.deb

First find the IP your OpenMediaVault obtained via DHCP on the CLI

    openmediavault login: root
    Password: ********

    ifconfig

     eth0
     ...
     inet addr: 192.168.1.99    !--> OMV_IP
     ...

Now do the following steps:

  • On a Browser: http://<OMV_IP>
  • Go to the plugin tab in OMV's web interface
  • Upload the file.
  • Select the newly uploaded plugin openmediavault-omvextrasorg
  • Click on Install. Refresh page.
  • Go to the plugin tab and click Check.

 
from here on the PC version is indistinguishable from the Raspberry Pi version.

If you had any trouble check the following video, it has the procedure above and more:

 

Install - Raspberry Pi

Go to:

and download an image, then you install it with Win32 Disk Imager on your Raspberry Pi SD Card, like every other raspberry Pi Image.

00

 

Log In

The IP was assigned via DHCP, I found the IP on my internet router on the DHCP section  (the name associated with the IP was “raspberry” / “OMV3”)

01.1

WEB INTERFACE:
- username = admin
- password = openmediavault

CONSOLE/SSH:
- username = root
- password = openmediavault

 

System Basic Setup

First lets change the Web Interface password:

01

This does not change the SSH password, if want to change it you need to access it via SSH with a client like Putty

root@raspberrypi:~# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Bellow I activate the HTTPS option, and force it to be the only available web access, to garante a secure access (this step is optional).

Enabling HTTPs requires a certificate, so first we will have to create it:

02

Creating a certificate:

03

Enable HTTPS and force HTTPS to be the only option (“Force secure connection only”) :

03.1

Set time with via NTP server (this step is optional):

04

Change Hostname (this step is optional):

05

SetUp a private IP Adress (this step is optional):

06

07

 

Storage Setup

First lets wipe the Disk clean if it already has a filesystem (mine is a USB Flash Disk) :

08

Now let’s create a filesystem (disk with an EXT4 partition):

09

Now we mount the filesystem we created above:

10

 

Users Setup

Now we setup a user to use with the services we are going to configure later:

11

This user is automatically put in the users Group:

12

 

Service Setup – SMB/CIFS

Here we are going to setup the SMB/CISFS service (aka Windows Shared Folders).

First we add a folder to the filesystem:

13

Next we make this folder available via SMB/CIFS.

First we enable the service:

14

and next we add the previously created folder to SMB/CIFS:

15

the final step is to setup the access permissions to the folder:

16

Now let’s test the access via SMB/CIFS to the created folder.

17

18

19

 

Service SetUp – Other Services (Compact)

The setup of other the services is very similar to the setup of SMB/CIFS above, so lets take a more compact aproach

### FTP Service (Built In) ###
Services >> FTP >> Settings | Enable                   !--> Activate Service
Services >> FTP >> Shares | (v)                            !--> Add Folder to Service
Services >> FTP >> Shares | (Magnifying Glass)   !--> Define permissions

 

### TFTP Service (Built In) ###
Services >> TFTP >> Settings | Enable                   !--> Activate Service
Services >> TFTP >> Shares | (v)                            !--> Add Folder to Service
Services >> TFTP >> Shares | (Magnifying Glass)   !--> Define permissions
Services >> TFTP >> Allow new files                     !--> Allow new files creation

 

### RSync Server (Built In) ###
Rsync >> Server | Enable                                            !--> Activate Service
Rsync >> Server >> Modules >> Shared Folder | (v)   !--> Add Folder (Source)
Rsync >> Server >> Modules >> Shared Folder | (Magnifying Glass) !--> Define user permitions

!-- Syncing with the OMV Rsync Server – Remote to Local Folder --
rsync -avz -e ssh remoteuser@remotehost:/remote/ /local   

!-- Syncing with the OMV Rsync Server – Local to Remote Folder --  
rsync -avz /local/ -e ssh remoteuser@remotehost:/remote     

 

### BitTorrent Client (PlugIn) ###
Download your torrents directly to you OpenMediaVault and access them via the
other services (ex: SMB/CIFS | MiniDlna | Plex | etc).

System >> Network >> Plugins                                             !--> Install Plugin
- Section: Downloaders
- Plugin : openmediavault-transmissionbt 3.0.9
- Select Plugin + Install

Services >> BitTorrent >> Settings | Enable                          !--> Activate Service
Services >> BitTorrent >> Files and Locations | Download   !--> Add+Enable Done Folder

Services >> BitTorrent >> RPC | Enable                                !--> Enable Web Client
Services >> BitTorrent >> RPC | Port: 9091                            !--> Web Client TCP Port
Services >> BitTorrent >> RPC | Username                           !--> Web Client Username
Services >> BitTorrent >> RPC | Password                            !--> Web Client Password


To use the BitTorrent WebClient just go to:

 

### MINI DLNA (PlugIn) ###
This allows you to access/stream you
media files to you TV or Mobile device

System >> Network >> Plugins                               !--> Install Plugin
- Section: Multimedia
- Plugin : openmediavault-minidlna 3.3.4
- Select Plugin + Install

Services >> DLNA >> Settings | Enable                   !--> Activate Service
Services >> DLNA >> Shares | (v)                            !--> Add Folder to Service
Services >> DLNA >> Shares | (Magnifying Glass)   !--> Define permitions

 

### Plex Media Server (PlugIn) ###

!-- Install and Configure --
System >> OMV-Extras | Plexmediaserver: Edit+Enable              !--> Activate Repository

System >> Network >> Plugins                                                    !--> Install Plugin
- Section: Multimedia
- Plugin : openmediavault-plexmediaserver 3.7
- Select Plugin + Install

Services >> Plex Media Server >> Settings | Enable                   !--> Activate Plex Server
Services >> Plex Media Server >> Settings | Database Volume  !--> Pick Filesystem
Services >> Plex Media Server >> Plex Web Client                    !--> Local Plex Client

The Local Plex Client allow you to play you
media on you browser locally on you LAN, but
if you want to make it available on the internet
just create an account at:

    https://www.plex.tv/

Clic on the message at the top of the
Local Plex Client:

    "An unclaimed media server has been found on your network. Claim it now"

and click on "Claim Server"
 
If this message dos not show, just go to:

   Settings >> Server >> Claim Server

and add the user and password of the account
you created online
 
Now you can play the media on you disk from
anywer in the internet

!-- Play Media - On The internet --
https://www.plex.tv/ + LAUNCH

!-- Play Media - On The LAN --
Services >> Plex Media Server >> Plex Web Client

 

### Remote Desktop - RDP (PlugIn) ###
Remote desktop plugin for OpenMediaVault. Installs xfce4 minimal desktop environment
and rdp server.

System >> Network >> Plugins                                        !--> Install Plugin
- Section: Network
- Plugin : openmediavault-remotedesktop 3.6
- Select Plugin + Install

Services >> Remote Desktop >> Port: 3389                      !--> Default Port
Services >> Remote Desktop >> Encription Level: Low   !--> Default Encription

 

### USB Backup (PlugIn) ###
The new plugin ‘USB Backup’ can be used to automatically synchronise a shared
folder to an external USB storage device when the USB stick is plugged in.

System >> Network >> Plugins                                                   !--> Install Plugin
- Section: Multimedia
- Plugin : openmediavault-usbbackup 3.2.12
- Select Plugin + Install

Services >> USB Backup >> Settings | +Add                               !--> Add Job
Services >> USB Backup >> Settings | Enable                             !--> Activate Service
Services >> USB Backup >> Shared Folder | (v)                          !--> Add Folder (Source)
Services >> USB Backup >> Shared Folder | (Magnifying Glass) !--> Define user permitions
Services >> USB Backup >> Device                                             !--> Select USB Flash (Destination)

 

### OpenVPN (PlugIn) - UNTESTED ###
This is AWSOME OpenMediaVault can even have
a VPN Server in it's services for remote/secure
access to you files

This is AWSOME OpenMediaVault can even
have a VPN Server in it's services for
remote/secure access to you files

System >> Network >> Plugins                                                      !--> Install Plugin
- Section: Remote
- Plugin : openmediavault-openvpn 3.0.4
- Select Plugin + Install

Services >> OpenVPN >> Settings | Enable                                    !--> Activate OpenVPN
Services >> OpenVPN >> Settings | Public address: <Pub IP>       !--> Your Public IP
Services >> OpenVPN >> Settings | DNS servers(s): <IP1>;<IP2>   !—> DNS Server

 

### Shell In a Box (SSH via Web UI) ###
Web based SSH client to the local Open Media Vault

System >> Network >> Plugins
- Section: Administration
- Plugin : openmediavault-shellinabox 3.4
- Select Plugin + Install

Services >> Shellinabox >> Enable


To use the Web SSH Shell:

Services >> Shellinabox >> Web Client
 
or

 http://<Your_OpenMediaVault_IP>:4200
 

### Wake On Lan (WOL) ###
Plugin to send WAKE-ON-LAN magic
to wake a system at using rtcwake
and wakeonlan.

System >> Network >> Plugins
- Section: Administration
- Plugin : openmediavault-wol 3.1
- Select Plugin + Install

Services >> WOL >> System | +Add                            !--> Add Machine
- Name            : <Machine Name>
- MAC Address    : <Machine MAC>
- IP Address    : <Machine IP - Optional>

To use the Web SSH Shell:

Services >> WOL >> System | Select Machine +Send

Enjoy Smile

Related links:

- OpenMediaVault on VMWARE: https://www.youtube.com/watch?v=ox69xQaOfXM

Tuesday, October 11, 2016

VMWare - CLI: Convert Virtual Disks - Thin to Thick

Here I’m going to show you how to convert Thin Virtual Disk (dynamic space allocation up to the provisioned size) to a Thick Virtual Disk (all space provisioned at creation).

The Thick Virtual Disk does not save space, but it is safer because the space is already allocated, there are no surprises. With a Thin Virtual Disk you migth run out of space in the Datastore and the Disk can’t grow up to the provisioned size.

thin-provisioning[6]

!-- Log in via SSH (must activate first) --
# ssh root@192.168.1.45
Password: *******


!-- List DataStore Disks (if needed) --
# ls -lh /vmfs/volumes/


!-- Access the VM Folder --
# cd /vmfs/volumes/DS-VM-DISK/UBUNTU-VM/
# ls -lh

total 16779272
-rw-------    1 root  root   16.0G Oct 10 00:41 UBUNTU-VM-flat.vmdk
-rw-------    1 root  root    8.5K Oct 10 00:41 UBUNTU-VM.nvram
-rw-------    1 root  root     473 Oct  9 22:28 UBUNTU-VM.vmdk
-rw-r--r--    1 root  root       0 Oct  9 22:25 UBUNTU-VM.vmsd
-rwxr-xr-x  1 root  root    2.6K Oct 10 00:41 UBUNTU-VM.vmx
-rw-r--r--    1 root  root  187.4K Oct 10 00:41 vmware.log


!-- Convert the Virtual Disk - Thin to Thick (Easy Way) --
# vmkfstools -j UBUNTU-VM.vmdk
Inflate: 100% done.

This option converts a thin virtual disk to Eager Zeroed Thick,
you have the same conversion done bellow the "Hard Way"

 

!-- Convert the Virtual Disk - Thick to Thin (Hard Way) --

image

# vmkfstools -i UBUNTU-VM.vmdk -d zeroedthick UBUNTU-VM_thick.vmdk
Destination disk format: VMFS zeroedthick
Cloning disk 'UBUNTU-VM.vmdk'...
Clone: 100% done.

or

# vmkfstools -i UBUNTU-VM.vmdk -d eagerzeroedthick UBUNTU-VM_thick.vmdk
Destination disk format: VMFS eagerzeroedthick
Cloning disk 'UBUNTU-VM.vmdk'...
Clone: 100% done.

!-- Replace the Thin with Thick (Virtual Disks) (Hard Way) --
# rm UBUNTU-VM-flat.vmdk
# mv UBUNTU-VM_thick-flat.vmdk UBUNTU-VM-flat.vmdk
# rm UBUNTU-VM_thick.vmdk

 

!-- All Looks as When We Started --
# ls -lh
total 3246088
-rw-------    1 root  root  16.0G Oct 10 23:59 UBUNTU-VM-flat.vmdk
-rw-------    1 root  root   8.5K Oct 10 23:59 UBUNTU-VM.nvram
-rw-------    1 root  root    471 Oct 10 23:57 UBUNTU-VM.vmdk
-rw-------    1 root  root      0 Oct 10 16:46 UBUNTU-VM.vmsd
-rw-------    1 root  root   2.5K Oct 10 23:59 UBUNTU-VM.vmx

Now you can power the VM :)


To Reverse It Check Out:

VMWare - CLI: Convert Virtual Disks - Thick to Thin


Here I show you how to convert  Thick Virtual Disk (all space provisioned at creation) to a Thin Virtual Disk (dynamic space allocation up to the provisioned size).

This is a good way to save space because with a Thin Virtual Disk, only occupies the space of the files It holds at the time.

Warning with a Thin Virtual Disk you migth run out of space in the Datastore and the Disk can’t grow up to the provisioned size.

thin-provisioning

!-- Log in via SSH (must activate first) --
# ssh root@192.168.1.45
Password: *******


!-- List DataStore Disks (if needed)--
# ls -lh /vmfs/volumes/


!-- Access the VM Folder --
# cd /vmfs/volumes/DS-VM-DISK/UBUNTU-VM/
# ls -lh

total 16779272
-rw-------    1 root  root   16.0G Oct 10 00:41 UBUNTU-VM-flat.vmdk
-rw-------    1 root  root    8.5K Oct 10 00:41 UBUNTU-VM.nvram
-rw-------    1 root  root     473 Oct  9 22:28 UBUNTU-VM.vmdk
-rw-r--r--    1 root  root       0 Oct  9 22:25 UBUNTU-VM.vmsd
-rwxr-xr-x  1 root  root    2.6K Oct 10 00:41 UBUNTU-VM.vmx
-rw-r--r--    1 root  root  187.4K Oct 10 00:41 vmware.log


!-- Convert the Virtual Disk - Thick to Thin --
# vmkfstools -i UBUNTU-VM.vmdk -d thin UBUNTU-VM_thin.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'UBUNTU-VM.vmdk'...
Clone: 100% done.


!-- Replace the Thick with Thin (Virtual Disks) --
# rm UBUNTU-VM-flat.vmdk
# mv UBUNTU-VM_thin-flat.vmdk UBUNTU-VM-flat.vmdk
# rm UBUNTU-VM_thin.vmdk


!-- All Looks as When We Started --
# ls -lh
total 3246088
-rw-------    1 root  root  16.0G Oct 10 23:59 UBUNTU-VM-flat.vmdk
-rw-------    1 root  root   8.5K Oct 10 23:59 UBUNTU-VM.nvram
-rw-------    1 root  root    471 Oct 10 23:57 UBUNTU-VM.vmdk
-rw-------    1 root  root      0 Oct 10 16:46 UBUNTU-VM.vmsd
-rw-------    1 root  root   2.5K Oct 10 23:59 UBUNTU-VM.vmx

Now you can power the VM :)

To Reverse It Check Out:

Sunday, September 18, 2016

Cisco - Upgrade Switches From Tar (Bin+Html)

To upgrade a Cisco Switch from a .tar (IOS and Html - Management Web Page), just start TFTP64:

image

and use the command:

  • archive download-sw xxxxxxxxxx

on the switch command line, this will download and install the .tar, and set it to boot next time.

I normally use is the my “Main Command” this should work in most cases, but you have other options like the ones shown in “Command Options”, that you can use “as is”, or by combining them like the “Main Command”.

 

Main Command

Download & Install - Overwrite & Different Feauture Set
============================================
Download from TFTP server and unpack tar
and install it (IOS and Html - Management Web Page)
even if the current and the new image have diferent
feature sets (ex: ipbase vs ipservices)

archive download-sw /overwrite /allow-feature-upgrade tftp://192.168.1.230/c3560-ipservicesk9-tar.150-2.SE.tar

OPTIONS USED
/allow-feature-upgrade - update/downgrade to
                                    different feature set
                         
/overwrite                   - overwrite everything in
                                    the flash with the new
                                    IOS tar image

 

Command Options

Download & Install
============================================
Download from TFTP server and unpack tar and
install it (IOS and Html - Management Web Page)

archive download-sw tftp://192.168.1.230/c3560-ipservicesk9-tar.150-2.SE.tar


Download & Install - Overwrite
============================================
Download from TFTP server and unpack tar and
install it (IOS and Html - Management Web Page)
and overwrite everything in the flash with the
new downloaded IOS tar image

archive download-sw /overwrite tftp://192.168.1.230/c3560-ipservicesk9-tar.150-2.SE.tar

 OPTIONS USED
/overwrite - overwrite everything in the flash
                    with the new IOS tar image

 
Download & Install - Different Feauture Set
============================================
Download from TFTP server and unpack tar
and install it (IOS and Html - Management Web Page)
even if the current and the new image have diferent
feature sets (ex: ipbase vs ipservices)

archive download-sw /allow-feature-upgrade tftp://192.168.1.230/c3560-ipservicesk9-tar.150-2.SE.tar

OPTIONS USED
/allow-feature-upgrade - update/downgrade to different feature set
 


Download & Install - Image Only
============================================
Download from TFTP server and unpack tar
and install it only the IOS (.bin) and deletes
the Html files (Management Web Page)

archive download-sw /imageonly  tftp://192.168.1.230/c3560-ipservicesk9-tar.150-2.SE.tar

 OPTIONS USED
 /imageonly - Install only the IOS (.bin) image and
                      delete the Html files (Management Web Page)
 
 
Download & Install - Safe
============================================
Download from TFTP server and unpack tar
and install it (IOS and Html - Management Web Page).

Waits for new IOS to be downloaded successfully
before deleting the old IOS

archive download-sw /safe tftp://192.168.1.230/c3560-ipservicesk9-tar.150-2.SE.tar

OPTIONS USED
/safe - waits for the new IOS to be downloaded
           successfully before deleting the old IOS
        

Base On: https://cyruslab.net/2012/06/03/maintenance-ios-upgradedowngrade-with-archive-download-sw-command/

Tuesday, August 23, 2016

VMWare - Linked Clones Without vCenter (with vSphere Client)


As soon as you can create snapshots you have all the ingredients required to create linked clones.

This will walk you through the process of creating a bunch of linked clones from one master.
Only tools used are the vSphere client and a text editor on a Windows host.
First create the master VM.

It is recommended to use a thin disk ...

Give it a reasonable name - so that it stands out from the other VMs.
In the example I called the VM "dont_touch"

clip_image001
Install the new VM and when done reboot it and install VMware-tools.

Feel free to add more apps ... or sysprep the master VM ...

Once you are satisfied power down the VM.
Now create a snapshot with the vClient.

See the screenshot - the files that belong to the snapshot are hilighted.
From now on regard the directory "dont_touch" as readonly. Do not start the VM again.

clip_image002
Next use the datastore browser and download the two files hilighted in the next screen : the vmx and the snapshot-vmdk.

 clip_image003
On your Windows-host the two downloaded files should now look like this.

Don't worry - the datastorebrowser is a funny guy - he shows you two files but downloads three.
And ... he thinks this is helpful ;-)

clip_image004
First thing to do is edit the "dont_touch-000001.vmdk"
It now looks like :

# Disk DescriptorFile
version=1
encoding="UTF-8"
CID=fa3d08b7
parentCID=fa3d08b7
createType="vmfsSparse"
parentFileNameHint="dont_touch.vmdk"
# Extent description
RW 25165824 VMFSSPARSE "dont_touch-000001-delta.vmdk"
# The Disk Data Base
#DDB
ddb.longContentID = "9b8da3d63cda1e5dbea7c0f4fa3d08b7"

As we want an absolute path for the parentFileNameHint parameter we edit the vmdk descriptor so that it looks like:

Note the yellow line ! It shows the edited path.

# Disk DescriptorFile
version=1
encoding="UTF-8"
CID=fa3d08b7
parentCID=fa3d08b7
createType="vmfsSparse"
parentFileNameHint="/vmfs/volumes/4ba3aca0-eca4fd60-312d-f4ce46af50b6/dont_touch/dont_touch.vmdk"
# Extent description
RW 25165824 VMFSSPARSE "dont_touch-000001-delta.vmdk"
# The Disk Data Base
#DDB
ddb.longContentID = "9b8da3d63cda1e5dbea7c0f4fa3d08b7"

Tip: to find out the absolut path look it up in the vmx file - the parameter sched.swap.derivedName also uses the absolut path.

sched.swap.derivedName = "/vmfs/volumes/4ba3aca0-eca4fd60-312d-f4ce46af50b6/dont_touch/dont_touch-aafe8f9c.vswp"

The part marked in yellow shows the absolute path that is required to adjust the vmdk-description.

Now is also a good time to delete that parameter from the vmx file. Don't forget that !
Now we can create several copies of the vmx-file.

Give every file a new name and adjust the display name parameter.

displayName = "2k3-clone-1"

Screenshot below shows several new copies of the vmx-file - each one has the display-name adjusted and the sched.swap.derivedName line removed.

clip_image005
Now back on the ESXi create several new directories for the clones.

clip_image006
Into each new directory copy the appropriate vmx-file plus the two vmdks.

Again - don't worry - you need to upload three files but datastorebrowser only displays two.

clip_image007
Now all is left to do is add the vmx-file to the inventory and make sure you click "I copied it" on first launch.
clip_image008
During first boot of the cloned VM it is advisable to unconnect the network-card.

On a Windows VM you may want to run newsid.exe, change the hostname and configure the network on first boot.

Then reboot and enable the nics.

Taken From: http://sanbarrow.com/linkedcloneswithesxi.html

Tuesday, July 19, 2016

VMWare WhiteBox - Desktop and ESXi Server all in One PC

I was recently on the market for a new Desktop, I wanted a powerfull machine but on a budget, and also had the ability of becoming as ESXi host (aka ESXi whitebox).

So I started looking at AMD CPUs because of the lower price, I had always heard that Intel was the way to go for vitualization, but I soon found out that the AMD CPUs where very virtualization friendly suporting even the most advanced features, tha are normally only found on Intel’s high end Desktop CPUs or server CPUs.

One of these advanced features is:

  • AMD-Vi - Directed Path I/O / IOMMU / Passthrough

that only found on Intel on non "k" series i5, i7 (high end Deskop), and xeon CPUs (server). On intel this features it’s called:

  • VT-d - Directed Path I/O / IOMMU / Passthrough

This feature allows you to pass real hardware (PCI hardware), like a grafics card to a VM, so you can have for example a VM using your GPU directly and being displayed on you monitor like it was a real Desktop.

So If you can pass to the VM the following real hardware to the VM:

  • USB Ports (Keyboard/Mouse)
  • Grafics Card
  • Sound Card

you have yourself a VM working as a Real Desktop, while having a ESXi host, where you can run aditional VMs.

To do this you also need a MOTHERBOARD that suports it, I thought this was going to be quite hard, but once again I found that this was well suported on many AMD motherboards like the ones based on the 970 chipset, which are really cheap mother boards.

Aditionally you also need a GRAFICS CARD that is supported on IOMMU, I found that AMD/ATI grafics cards are very easily suported even the really cheap ones (like mine AMD R5 230 or my older ATI 5540) as for NVIDIA only very high end cards support it:

    Cards that work
    AMD Radeon R9 280   
    AMD Radeon R7 250   
    AMD Radeon HD 7970   
    NVIDIA Quadro K2000
      Cards that don't work
      NVIDIA GeForce GTX 780 Ti
      NVIDIA GeForce 660 Ti
      NVIDIA GeForce 560
      AMD Radeon R9 295x2

    You can find a list of hardware that suports IOMMU here:

    I found that gamers have been using this to make multiple gaming desktops out of only one computer with multiple grafics cards,as you can see at:

    Index

    • My Whitebox (for Passthrough / IOMMU)
    • Downloading ESXi and Getting the Free License Key
    • Making The ESXi Installer Flash Drive
    • BIOS - Configuring The BIOS for Virtualization and IOMMU (Passthrough)
    • ESXi – Instalation
    • ESXi - Configuring The ESXi Management Network (Static IP)
    • ESXi – Adding a Data Storage (aka VMs Storage Disk)
    • ESXi - Passthrough (IOMMU) Configuration
    • ESXi – HDs Passthrough (Mapping Physical HDs to Virtual)
    • Desktop VM - Installing Windows with Passthrough
    • Desktop VM - Adding Real HDDs (Virtual Representation)
    • Desktop VM - Configuring AutoStart
    • Desktop VM - Making The Desktop Hole Again
    • ESXi - Adding The Free ESXi License

     

    My Whitebox (for Passthrough / IOMMU)

    After some research I bougth the following:

    • 1x ASROCK 970A-G/3.1 SKT AM3+             
    • 1x AMD FX-8350 4.0 GHz Vishera 8-Core Black Edition
    • 1x ASUS RADEON R5 230 Silent 2GB GDDR3
    • 1x Intel 8492MT PRO/1000MT Dual Port Server (PCI)

    At the time I didn’t had confirmation that the my specific:

    • CPU
    • Motherboard
    • Grafics cards

    worked with IOMMU/Passthrough, but they worked perfectly.I found it amazing that all this hardware from less expensive/alternative brands all worked without a problem.

    The only thing that didn’t work on VMWare ESXi was the integrated NIC on my motherboard (Realtek Chipset), and you need a NIC that is supported on VMWare ESXi otherwise It will not install, so I bougth the:

    • Intel 8492MT PRO/1000MT Dual Port Server (PCI) – 14$ on ebay

    previously I used a desktop NIC that I already had:

    • Intel 8390MT PRO/1000MT Desktop Adapter (PCI) – 10$ on ebay

    this NIC gives a warning when instaling of ESXi about unsuported hardware but It let’s you install and it works perfectly (on VMware ESXi 6.0.0 Update2), but you should buy the first because it’s a server NIC and it will probably will be suported for more time on ESXi.

       

    Downloading ESXi and Getting the Free License Key

    In order to download the ESXi Hypervisor (aka vSphere), just go to:

    if you don’t have an account you have to register. After being registered, login:

    Screenshot 2016-06-13 09.59.41

    the ESXi you are going to download is the same as the paid version, the only diference is the license, we are going to use the free license wich is more limited.

    You can use ESXi without the license for 60 days, during this period you all the features on ESXi available to you.

    After the trial period you must enter a license, so you need to save this free license for later (or just come to this site again):

    Screenshot 2016-06-13 10.00.04_v2

    Download the most recent ESXi ISO installer image which the time I’m writing this post is vSphere 6.0.0 Update 2:

    Screenshot 2016-06-13 10.00.24

     

    Making The ESXi Installer Flash Drive

    Now that you have the image, you can either burn it on a CD (wich is very old school), or you can convert it to an USB PEN Drive wich is what I’m going to show here.

    Get Rufus, which is probably the simplest tool to make bootable USB Pen Drives from ISOs:

    Open it, select you USB Pen Drive, select “ISO Image” and then select the ESXi ISO, and press Start.

    Screenshot 2016-05-14 00.02.24_ENG

     

     

    BIOS - Configuring The BIOS for Virtualization and IOMMU

    (Passthrough)

    The BIOS config is specific to my motherboard (ASROCK 970A-G/3.1), but basically you just have to enable all the virtualization features you can find.

    In my mother board you have the specific option to enable IOMMU, but I have seen other motherboards that suport IOMMU where you don’t have the specific option, and you just enable the virtualization extensions.

    Enabling IOMMU (Directed Path I/O aka Passthrough)
    PHOTO_20160508_112010
    Enabling the Normal Virtualization Extensions
    PHOTO_20160508_112259

    Selecting the Boot Pen

    PHOTO_20160508_112543

    The Blue Flash Drive (Verbatin) is my ESXi installer (it’s the boot flash drive I made with Rufus), and the Yellow (Kingston) is where I’m going to install the ESXi (aka vSphere), but you can install it on a normal hard drive.

    I used a USB because ESXi wipes repartitions de disk where It is installed making it unusable for almost anything else while It only occupies 2-3 GB wich fits well in a Flash Drive.

    On usage is to use it as a Datastore, but that is not recommended, because when you install a new version it wipes the hole drive and when it upgrade It the is always the possibility off something going wrong.

    PHOTO_20160508_111406 - Cópia

     

     

    ESXi – Instalation

    Now that we have the boot pen selected as the first boot option, lets start installing VMWare ESXi (aka vSphere)

    VMware ESXi Installer Booting

    PHOTO_20160508_133310

    PHOTO_20160508_133335

    Selecting the Instalation Hard Drive

    Here you select where you want to install ESXi, in my case I’m going to install it on another USB Pen Drive (Yellow – Kingston), because ESXi will wipe you target disk (see repartition warning bellow).

    PHOTO_20160508_133747

    Starting the Instalation Process

    If you already had a previous ESXi on the target instalation disk you could Upgrade it.

    PHOTO_20160508_133844

    Selecting the Keyboard Layout

    PHOTO_20160508_133907

    Setting the root Password

    PHOTO_20160508_133927

    Warning – Your Disk Will Be Repartitioned

    This is a very important warning and it’s the main reason for me to install ESXi on a USB Pen Drive. What is going to happen is that you disk will repartitioned, which will make you loose all the data that where on the previous partitions.

    PHOTO_20160508_134009

    Installing ESXi…

    PHOTO_20160508_134031

    Instalation Done

    PHOTO_20160508_134832

    Reboot to Boot the Installed VMWare ESXi

    Here is where I remove the instalallation Pen Drive (Blue – Verbatin), and leave the target Pen Drive (Yellow – Kingston), in order to boot from my second boot option (Yellow – Kingston).

    You can always go to your BIOS and select the disk where you installed VMWare ESXi, as the first boot option.

    PHOTO_20160508_134850

    The Newly Installed ESXi Booting

    This looks a lot like the instalation process boot.

    In my case this is my Yellow Pen Drive Booting (Kingston)

    PHOTO_20160508_135025

    Boot Done

    At this stage the boot is done and VMWare ESXi, as gained it’s network configuration via DHCP, and you can already access it, the link is the one shown on the image, in my case:

    • http//192.168.1.5

    In the next step we are going to make the network config static so it doesn’t change over time.

    PHOTO_20160508_135143

     

    ESXi - Configuring The ESXi Management Network (Static IP)

    You can leave you network config via DHCP but each time you reboot you migth get a different IP, wich will prevent you from accessing your ESXi server (aka ESXi host)

    Management IP Configuration via DHCP (default)

    PHOTO_20160508_135143

    Let’s Access the Management Network IP Configuration

    PHOTO_20160521_004928

    PHOTO_20160521_004949

    Let’s Change it to Static

    PHOTO_20160521_005003

    PHOTO_20160521_005014

    Let’s Define the Static Management IP

    It assumes taht the static IP is the same IP that it got via DHCP but you can change It, and you probably should, for now I’m mantaining the same IP.

    PHOTO_20160521_005025

    PHOTO_20160521_005053

     

     

    ESXi – Adding a Data Storage (aka VMs Storage Disk)

    Now let’s start using ESXi, for that you just input your ESXi Host IP on a browser, and you will see the following page:

     Screenshot 2016-05-08 14.39.18

    Up until know we only had the vSphere Client for Windows, now you also use a webpage (VMWare Host Client), that looks like this:

    Screenshot 2016-05-08 14.40.11

    all the new feature are being implement in this webpage, which I found to be super intuitive, but because it’s only available in recent updates of versions 5.5 and 6.0, I’m going to use the vSphere Client for Windows because It’s available in all the versions.

    Logging In…

    Screenshot 2016-05-08 14.43.13

    Check Install this certificate and press Ignore:

    Screenshot 2016-05-08 14.43.23

    Now we are in ESXI for the first time… Hurray…

    Screenshot 2016-05-08 14.47.47

    Now let’s add a Datastorage, wich is a disk formated with the VMFS filesystem, where you are store the Virtual Machines.

    Screenshot 2016-05-08 14.47.53

    Select the HD you want to use as a Datastore:

    Screenshot 2016-05-08 14.48.32

    Normally people use a dedicated disk as a Datastore, as shown bellow, but you can use a disk with partitions on It, for that just leave some empty space and chose the “Use free space”’option:

    Screenshot 2016-05-08 14.49.30

    chose the size from the available space:

    Screenshot 2016-05-08 14.50.03

    Screenshot 2016-05-08 14.50.07

    And that’s it, you know have a Datastore to store your Virtual Machines

    Screenshot 2016-05-08 16.20.15

     

    ESXi - Passthrough (IOMMU) Configuration

    First you need to check if you hardware has Passthrough (IOMMU) suport, for that on the vSphere Client, just go to Summary, and check the DirectPath I/O, if you harware suports it it will say “Supported”, like in the picture bellow.

    Screenshot 2016-07-20 12.13.03

    Now that we need to define the hardware that will be available for the virtual machines via passthrough (Grafics Card / USB Ports / Sound Card, etc).

    Go to “Advanced Settings”":

    Screenshot 2016-05-08 16.23.46

    Select “Configure Passthrough

    Screenshot 2016-05-08 16.23.55

    Screenshot 2016-05-08 16.24.35

    Now you have a list of all the hardware that is compatible with Passthrough (I migth take some trial error to find out what each entry represents), in my case you have:

    • SATA II / III Disks Controller (all Sata II or III HardDrives)
    • AMD Grafics Card 1 - ASUS RADEON R5 230
    • AMD Grafics Card 2 - ATI 5540 (you don’t need a second grafics card)
    • USB 3.1 Controller (all USB 3.1 Ports)
    • Intel NIC
    • USB 3 Controller (all USB 3 Ports)
    • Onboard RealTek NIC

    Some of the things that weren’t compatible in my case where

    • Sata I Hard Drives
    • USB 2 Ports
    • Sound Card

    Select the hardware that you want to passthrough to the Desktop VM, I selected:

    • AMD Grafics Card 1 - ASUS RADEON R5 230
    • USB 3.1 Controller (all USB 3.1 Ports)
    • USB 3 Controller (all USB 3 Ports)

    Screenshot 2016-05-08 16.24.45

    Once selected you have to reboot the ESXI Host in order to make the selection efective:

    Screenshot 2016-05-08 16.25.08

    Screenshot 2016-05-08 16.25.16

    Now you can start assigning hardware to your VMs.

    Screenshot 2016-05-08 16.28.23

     

     

    ESXi – HDs Passthrough (Mapping Physical HDs to Virtual)

    You can passthrough you hard drives, the problem is that you either pass all or none, wich means that you will probably pass the disk with the Datastore (where we have the VMs), leaving you without any VMs.

    The alternative solution I found was to map the real hard drives that I wanted onto a virtual representation that I can add to VMs.

    First Step – Gaining Access to the ESXI CLI via SSH

    PHOTO_20160521_001211

    PHOTO_20160521_001442

    Activating the ESXi shell

    PHOTO_20160521_001535

    Activating the SSH access

    PHOTO_20160521_001750

    Restarting the agent

    PHOTO_20160521_001820 

     
    Second Step – Mapping the Physical HDs onto the Virtual Representations

    Connect to the ESXi server via SSH

    Screenshot 2016-05-21 00.56.38

    identify the disks that you want to map to a virtual disk,

    ls -al /vmfs/devices/disks

    Screenshot 2016-05-21 00.57.48

    and save their names:

    t10.ATA_____Hitachi_HDS721010CLA332_______________________JP2911HD0825KC    
    t10.ATA_____WDC_WD10EAVS2D22D7B0__________________________WD2DWCAU45211463
    t10.ATA_____WDC_WD15EADS2D11P8B2__________________________WD2DWMAVU3518099

    Identify the Datastore where you want to save the virtual representations of the physical disks

    ls -al /vmfs/volumes/

    Screenshot 2016-05-21 00.58.38

    I created the folder “Physical_HDs”, to store the virtual representations of the physical disks

    Screenshot 2016-05-21 01.03.50

    Now we create the virtual representations of the physical disks using the following command:

    vmkfstools -r <source-physical-disk> <destination-virtual-disk>

    in my case:

    vmkfstools -r  /vmfs/devices/disks/t10.ATA_____Hitachi_HDS721010CLA332_______________________JP2911HD0825KC     /vmfs/volumes/DS1_SSD/Physical_HDs/DISK1.vmdk

    vmkfstools -r  /vmfs/devices/disks/t10.ATA_____WDC_WD10EAVS2D22D7B0__________________________WD2DWCAU45211463 /vmfs/volumes/DS1_SSD/Physical_HDs/DISK2.vmdk

    vmkfstools -r  /vmfs/devices/disks/t10.ATA_____WDC_WD15EADS2D11P8B2__________________________WD2DWMAVU3518099 /vmfs/volumes/DS1_SSD/Physical_HDs/DISK3.vmdk

    Screenshot 2016-05-21 01.05.18

    Let’s check that the virtual disks where created:

    ls -al /vmfs/volumes/DS1_SSD/Physical_HDs

    Screenshot 2016-05-21 01.05.53

    After we install the Desktop VM we are going to add these virtual disks that represent the physical disks to the Desktop VM.

     

    Desktop VM - Installing Windows with Passthrough

    Let’s create the virtual machine that will become our Desktop.

    This will be a VM with real hardware assingned to it, that will look and fell like a real desktop.

    Screenshot 2016-05-08 16.28.39

    Select the Datastore where you want to store the VM:

    Screenshot 2016-05-08 16.28.55

    Select the VM OS:

    Screenshot 2016-05-08 16.29.08

    Select the type of virtual NIC (select the E1000 wich emulates a Intel 82545EM Gigabit Ethernet NIC, wich is a very widely suported real NIC), for more information on NICs check the following link:

    Screenshot 2016-05-08 16.29.12

    Create the VM virtual Hard Disk, where you will install the OS

    Screenshot 2016-05-08 16.29.25

    Add the real hardware to the VM:

    Screenshot 2016-05-08 16.29.42

    Screenshot 2016-05-08 16.29.50

    Screenshot 2016-05-08 16.29.57

    Now add the hardware that you want to passthrough,

    Screenshot 2016-05-08 16.30.03

    my selection:

    • AMD Grafics Card 1 - ASUS RADEON R5 230
    • USB 3.1 Controller (all USB 3.1 Ports)
    • USB 3 Controller (all USB 3 Ports)
    • Onboard RealTek NIC (I selected it but I will be using the virtual interface)

    The real hardware are the devices in bold (New PCI Device ….):

    Screenshot 2016-05-08 16.30.50

    Now open the console that will show the VM

    Screenshot 2016-05-08 16.35.37

    Start the VM…

    Screenshot 2016-05-08 21.48.29

    Screenshot 2016-05-08 21.49.33

    Select the OS ISO

    Screenshot 2016-05-08 21.49.39

    And after “Operating System not found” press enter one or more times to boot the ISO

    Screenshot 2016-05-08 21.49.44

    Now that the ISO is booting let’s install Windows (in this case Windows 7, but I have also done this with Windows 10).

    Screenshot 2016-05-08 21.57.22

    For the GPU Passthrough to work on the first try, it’s very important that you install VMWare Tools before installing the Graphics Card driver (real grafics card -- real drivers from the vendor)

    Screenshot 2016-05-08 21.58.43

    Screenshot 2016-05-08 21.59.08

    Screenshot 2016-05-08 22.00.18\

    Now that VMWare Tools are installed let’s install the Graffics Card drivers:

    Screenshot 2016-05-08 22.14.05

    Screenshot 2016-05-08 22.14.34

    In the process of installing the Grafics Card drivers the Passthrough started working, and showing the VM on my Desktop Screen.

    Screenshot 2016-05-08 22.17.34

     

     

    Desktop VM - Adding Real HDDs (Virtual Representation)

    Now that we have the Desktop VM with Passthrough let’s add the virtual representation of the physical HDs, that we created before at:

    • ESXi – HDDs Passthrough (Mapping Physical HDs to Virtual)

    Press Add..

    Screenshot 2016-05-21 01.24.23

    Select Hard Drive

    Screenshot 2016-05-21 01.24.31

    Select the option to add an existing disk

    Screenshot 2016-05-21 01.24.38

    Find the virtual disks (I put mine at /vmfs/volumes/DS1_SSD/Physical_HDs)

    Screenshot 2016-05-21 01.24.54

    add them to them Desktop VM, one by one:

    Screenshot 2016-05-21 01.25.13

    it should look like this (the bold entries are the new HDs):

    Screenshot 2016-05-21 01.26.10

    Power the Desktop VM and validate that you physical HDs now show up on the VM:

    Screenshot 2016-05-21 01.35.27-2

     

    Desktop VM - Configuring AutoStart

    Because we want the Desktop VM to be our main Destktop computer we need that it starts automatically with the ESXi Host, otherwise you need another PC just to start the Desktop VM.

    To make the Desktop VM start automatically select “Virtual Machine Startup/Shutdown” and “Properties”:

    Screenshot 2016-05-14 00.17.33

    Activate the Auto Start

    Screenshot 2016-05-14 00.17.38

    And configure it like this:

    Screenshot 2016-05-14 00.17.59

    next time you ESXi Host starts, so will the Desktop VM, giving you a desktop to use and manage ESXi.

     

    Desktop VM - Making The Desktop Hole Again

    At this point I had a fully operation desktop, but there where some things that I coludn’t Passthrough to the Desktop VM as refered before:

    • Sata I Hard Drives
    • USB 2 Ports
    • Sound Card

    the first item I solved by mapping the physical HDs onto their virtual representations and adding them to the VM as existing virtual disks:

    • ESXi – HDs Passthrough (Mapping Physical HDs to Virtual)
    • Desktop VM - Adding Real HDDs (Virtual Representation)

    to compensate the loss of the USB 2 Ports I bougth this card with four USB 3.0 ports on eBay for about 7 USD:

    USB3

    USB 3.0 4-Port Host To PCI-E PCI Card Express
    Expansion Card Adapter Speed 5Gbps

    these where fully compatible with Passthrough.

    Or you can try to attach USB 1 and 2 devices (not ports as above), just follow this tutorial:

    As for the Sound Card I bouth on eBay this usb sound card for about 1 USD, and connected it to a USB 3.0 port:

    s-l1600

    USB 2.0 to 3D Mic Speaker Audio Headset
    Sound Card Adapter 5.1 for PC Laptop E0

     

    but If you want a good usb sound (made in USA) card you should definitely go for this:

     

    image

    Sabrent USB External Stereo Sound Adapter

    For Windows And Mac. Plug And Play No

    It’s about 18 USD on ebay.

    And that’s it, now my Desktop is hole again, nothing is missing… Smile

     

     

    ESXi - Adding The Free ESXi License

    So far I have been doing things with the 60 days trial, this allows you to use all the feautures in VMWare ESXi, which we dont’t need for what we have done here.

    The Free License that we saved when we downloaded the ESXi ISO at:

    • Downloading ESXi and Getting the Free License Key

    is enough.

    If you want to stop the trial and make you ESXi fully licensed with the Free License, go to
    Configuration >> Licensed Features >> Edit

    Screenshot 2016-07-11 23.43.15

    Screenshot 2016-07-11 23.43.50_v2

    Screenshot 2016-07-11 23.44.01_v2

    As you can see now the Licensed Features list now is much smaller:

    Screenshot 2016-07-11 23.44.19

     

    Related Links