Formatting Disk using DiskPart



Quite a while i’ve not post about Hyper V content.
Let look into several command that you should execute when formatting disk. Wait, won’t it be easy using Computer Management snap in to format a disk.
Well, you’re right but…you will not have Computer Management when Hyper V host machine is install with Server Core version.
Hope this command come to handy when you format a disk either local or iSCSI LUN presented to Hyper V host.
1. Execute Diskpart command.
image
2. Execute List Disk to view the disk available on the Hyper V machine
DISKPART > List disk
image
3. We are going to format disk 3. Execute select disk 3 to select disk 3.
DISKPART > Select disk 3
DISKPART > List disk
image
* indicated disk 3 is selected.
4. If the disk status is offline. Type
DISKPART > online disk
5. View the attribute of the disk. Make sure the disk read-only is not set to Yes.
DISKPART > attribute disk
image
If mark as Read-Only. Key in below command:
DISKPART > attribute disk clear readonly
6. Create primary partition using the entire disk volume.
DISKPART > create partition primary
DISKPART > list partition
image
7. Assign a drive letter
DISKPART > Assign letter =K
image
8. Quick format a disk with NTFS file format
DISKPART > format fs=ntfs quick
image

Installing Hyper-V on a Server Core Installation


Installing Hyper-V on a Server Core Installation

A Server Core installation entails the configuration of Windows Server 2012 without the Server Graphical Shell. In terms of system administration and configuration, this means that you either manage a server from the local console or remotely using a command line interface or Windows PowerShell, or you administer a server from a remote workstation using Microsoft Management Console based tools.
Here are the basic steps to install the Hyper-V role on a Server Core Installation of Windows Server 2012 using Windows PowerShell:
  1. At the Server Core installation console, a command line window opens after login (Figure 1).  

Figure 1:
 Windows Server 2012 Server Core Installation Command Line
  1. As shown in Figure 2, type PowerShell in the command window to access the Windows PowerShell interface.


Figure 2:
 Windows Server 2012 Command Windows – Starting PowerShell
  1. Type Get-WindowsFeature at the PowerShell Command Line (Figure 3) to view the server roles and features that are installed or available on the server.


Figure 3:
 Windows Server 2012 – Get-WindowsFeature PowerShell Cmdlet
  1. Type Install-WindowsFeature –Name Hyper-V – Restart to install the Hyper-V role and automatically restart the server after the installation of the role. (Figure 4).


Figure 4: Windows Server 2012 – Install-WindowsFeature PowerShell Cmdlet
  1. After the server restarts, start PowerShell from the command window, and type Get-WindowsFeature | where {$_.Installed –eq $True} to verify the successful installation of the Hyper-V role (Figure 5).


Figure 5:
 Windows Server 2012 Hyper-V Role Verification in Windows PowerShell
The command output is formatted to display only a list of the roles and features that are installed on the server, rather than the entire list of roles and features available. Using Windows PowerShell, roles and features can be installed individually as shown in this example, or you can install multiple roles and features using a single cmdlet. For example, you can install the Hyper-V and Web Server roles using the following syntax: Install-WindowsFeature –Name Hyper-V, Web-Server – Restart.

Installing Hyper-V on a Server with a GUI Installation

In order to install the Hyper-V role on a Server with a GUI installation, you can also use Windows PowerShell, or you can use the Server Manager if you prefer a graphical user interface:
  1. On the server desktop, open Server Manager (Figure 6).


Figure 6:
 Windows Server 2012 – Server Manager Console
  1. In Server Manager, in the menu, click Manage, and then click Add Roles and Features (Figure 7).


Figure 7:
 Server Manager Console – Add Roles and Features Selection
  1. In the Add Roles and Features Wizard (Figure 8), on the Before You Begin page, select Next.


Figure 8:
 Add Roles and Features Wizard - Before You Begin Page
  1. On the Select Installation Type page (Figure 9), select Role-based or feature-based installation, and click Next.


Figure 9:
 Add Roles and Features Wizard – Select Installation Type Page
  1. On the Select Destination Server page (Figure 10), select the server, and click Next.


Figure 10:
 Add Roles and Features Wizard – Select Destination Server Page
  1. On the Select Server Roles page (Figure 11), select Hyper-V, and then click Add Features in the dialog box.


Figure 11:
 Add Roles and Features Wizard – Add Features Dialog
  1. On the Select Server Roles page (Figure 12), click Next.


Figure 12: Add Roles and Features Wizard – Select Server Roles Page
  1. On the Select Features page (Figure 13), click Next.


Figure 13:
 Add Roles and Features Wizard – Select Features Page
  1. On the Hyper-V Page (Figure 14), click Next.


Figure 14:
 Add Roles and Features Wizard – Hyper-V Page
  1. On the Create Virtual Switches page (Figure 15), select a network adapter, and then click Next.


Figure 15:
 Add Roles and Features Wizard – Create Virtual Switches Page
  1. On the Virtual Machine Migration page (Figure 16), click Next.


Figure 16: 
Add Roles and Features Wizard – Virtual Machine Migration Page
  1. On the Default Stores page (Figure 17), click Next.


Figure 17:
 Add Roles and Features Wizard – Default Stores Page
  1. On the Confirmation page (Figure 18), check Restart the destination server automatically if required, and then click Yes in the restart dialog box.


Figure 18:
 Add Roles and Features Wizard – Restart Dialog Box
  1. On the Confirmation page (Figure 19), click Install.


Figure 19:
 Add Roles and Features Wizard – Confirmation Page
  1. On the Installation Progress page (Figure 20), you can monitor the Hyper-V role installation until the server automatically restarts.


Figure 20:
 Add Roles and Features Wizard – Installation Progress Page
  1. After the server restarts and opens the Server Manager, check the Installation Progress page (Figure 21) to ensure that the Hyper-V role installlation was successful, and then click Close.


Figure 21:
 Add Roles and Features Wizard – Installation Progress Page
Configuring Hyper-V Host Settings on a Server Core Installation
After installing the Hyper-V role on a server, you can perform configuration of Hyper-V host settings. Basic settings include the following items:
  • Configuration of the storage locations for virtual hard disk and virtual machine configuration files
  • Configuration of physical GPUs for use with RemoteFX (if the Remote Desktop Virtualization Host role is installed)
  • Configuration of NUMA spanning when the server has NUMA nodes to enhance virtual machine performance
  • Configuration of Live Migration and the authentication protocol to use, the number of simultaneous live migrations to allow (default is 2), and the server networks to support live migration events
  • Configuration of Storage Migration and configuring the number of simultaneous storage migrations to allow (default is 2)
  • Configuration of Replication to support the server Replica functionality and the authentication protocol to use, as well as the servers authorized to replicate
The following cmdlets provide examples of how to configure some of these basic Hyper-V host settings using Windows PowerShell:
  1. Modify the Virtual Hard Disk storage location to use a folder named Virtual Machines on drive D (just as an example, of course, as you customize drive and folder locations to suit your requirements):
    Set-VMHost –VirtualHardDiskPath ‘D:\Virtual Machines’
  1. Modify the Virtual Machine files storage location to be the same as the Virtual Hard Disks path:
    Set-VMHost –VirtualMachinePath ‘D:\Virtual Machines’
  1. Modify NUMA Spanning to be enabled:
    Set-VMHost –NumaSpanningEnabled $True
  1. Modify the number of concurrent Live Migrations to 4 events:
    Set-VMHost –MaximumVirtualMachineMigrations 4
  1. Modify the number of concurrent Storage Migrations to 4 events:
    Set-VMHost –MaximumStorageMigrations 4
In addition to basic Hyper-V host settings, you can also use Windows PowerShell to verify host network adapter settings, and configure Virtual Switch settings.
The following cmdlets provide examples of how to list network adapter information and IP addresses on a Hyper-V host, as well as how to configure a Virtual Switch:
  1. List the physical network adapters present in the Hyper-V host using Format-Table (ft in the cmdlet below) to list by name (Figure 22):
    Get-NetAdapter | ft Name


Figure 22: Format-Table Output for Get-NetAdapter | ft Name Cmdlet
  1. List the settings of a network adapter using the Network Adapter name (Figure 23):
    Get-NetAdapter -Name ‘NIC1’ | Get-NetIPAddress


Figure 23: Output of Get-NetIPAddress cmdlet for Network Adapter NIC1
  1. Create a new external Virtual Switch using the network adapter named NIC1, name the virtual switch Public, and allow the parent partition to have access to the network adapter bound to the virtual switch (Figure 24):
    New-VMSwitch -Name "Public" -NetAdapterName ‘NIC1’ -AllowManagementOS $True


Figure 24: Output of New-VMSwitch Cmdlet
For a complete list of Windows PowerShell cmdlets that are available to script and automate Hyper-V related tasks, you can refer to the Microsoft Technet Hyper-V Cmdlet site here.

Configuring Hyper-V Host Settings on a Server with a GUI Installation

If Windows PowerShell cmdlets don’t appeal to you, or you have access to a Server with a GUI installation, you can configure Hyper-V host settings using the Hyper-V Manage:
  1. On the server desktop, open the Server Manager (Figure 25).


Figure 25:
 Windows Server 2012 – Server Manager Console
  1. In Server Manager, in the navigation pane, click Hyper-V, then right-click the server, and then select Hyper-V Manager from the list (Figure 26).


Figure 26:
 Server Manager Console – Hyper-V Manager Selection
  1. In Hyper-V Manager, in the Actions pane, click Hyper-V Settings (Figure 27).


Figure 27:
 Hyper-V Manager Console
  1. On the Hyper-V Settings page, select Virtual Hard Disks to specify the default drive and folder to store virtual hard disk files, and then click Apply (Figure 28).


Figure 28:
 Hyper-V Manager – Virtual Hard Disks Page
  1. On the Hyper-V Settings page, select Virtual Machines to specify the default folder to store virtual machine configuration files, and then click Apply (Figure 29).


Figure 29:
 Hyper-V Manager – Virtual Machines Page
  1. On the Hyper-V Settings page, select NUMA Spanning to enable the setting, and then click Apply (Figure 30).


Figure 30:
 Hyper-V Manager – NUMA Spanning Page
  1. On the Hyper-V Settings page, select Live Migrations to set the number of simultaneous live migrations that are allowed, and then click Apply (Figure 31). Note that this setting requires the server to be a member of an Active Directory domain.


Figure 31: Hyper-V Manager – Live Migrations Page
  1. On the Hyper-V Settings page, select Storage Migrations to set the number of simultaneous storage migrations that are allowed, and then click Apply (Figure 32).


Figure 32:
 Hyper-V Manager – Storage Migrations Page
You can use the Virtual Switch Manager to create and manage virtual switches in Hyper-V:
  1. In Hyper-V Manager, in the Actions pane, click Virtual Switch Manager (Figure 33).


Figure 33:
 Virtual Switch Manager Console
  1. Create a new external Virtual Switch, name the virtual switch Public, allow the parent partition to have access to the network adapter bound to the virtual switch, and then click Apply (Figure 34).


Figure 34:
 Virtual Switch Manager – New Virtual Switch Creation

Network Boot with Windows 7, Windows XP and Vista with CCBoot


Network Boot Windows 7, Windows XP and Vista with CCBoot

  1. Network Boot Solution Background

    For most network administrators, they are facing the same difficulty. Now and then, they have to troubleshoot or diagnose a problematic computer. Sometimes even need to do a clean installation of the operating system. Fortunately, network boot can help them out of such annoyance.

    Network boot Windows involves two machines: boot server and boot client. The boot client is a computer you are trying to boot up over network, while the boot server is the machine that serves over the network the files which the client needs. Network boot program allows to remote boot a computer over an IP network without access to a hard disk. It is therefore ideally suited for diskless or thin clients.

    When using network boot solution, the boot process will be changed from the normal order to:
    Power on -> BIOS -> PXE stack built-in the NIC (Network Information Center) -> NBP (Network Boot Program) downloading from server to client's RAM by TFTP -> NBP's responsibility to perform the next step (a.k.a. 2nd stage boot).

    Advantages of Network Boot Solution
    • Reduce initial capital and implementation costs, reduce power and cooling requirements, reduce complexity and risk.
    • Accelerate deployments, upgrades, and server repurposing.
    • Implement enhanced Disaster Recovery solutions.
    As an administrator responsible for a network of about dozens of computers or more, network boot Windows 7, Windows XP, Vista, Windows Server 2003 and 2008 will drastically reduce your daily workload.
  2. Using CCBoot to Build a Network Boot Server

    1. Install Network Boot Server with CCBoot - An all-in-one Network Boot Software
      Download network boot software - CCBoot server installation package from -http://www.ccboot.com/download.htm.
      Launch ccbootsetup.exe on the network boot server and keep press the next button to the end.

      Figure 1
      CCBoot will use the following ports - 67 (DHCP), 69 (TFTP), 3260 (iSCSI), 1000 (Image Upload), 8001 (Service Control). You need to open these ports in the firewall of the network boot server. Since CCBoot v2.1, you also need to open port 66. V2.1 uses port 66 as DHCP backup.

      Note: Please shut down the other DHCP services on the LAN especially the DHCP service in the router.

      Launch CCBoot and you will get the main interface as bellow:

      Figure 2
    2. Initialize The Network Boot Server
      Demo Environment

      Server IP: 192.168.1.10
      Gateway: 192.168.1.1
      DNS Address: 192.168.1.1
      IP Mask: 255.255.255.0
      DHCP Range: 192.168.1.101-192.168.1.254

      Menu "Options"->"Options Wizard" and configure step by step as bellow:

      Figure 3
      You need to select the correct local IP address as "DHCP Server IP". Press "Scan DHCP" to check if there are other DHCP services on the LAN. You need to stop other DHCP services on the LAN.

      Figure 4
      Set "Server IP Address". Normally, it’s the same as "DHCP Server IP".
      Set "Write-back File Path" and "Image Save Path" as you want.

      "Write-back File Path" is used to store the network booted clients’ write-back data. You’d better use a big volume hard disk as "Write-back File Path". This disk should be formatted as NTFS and 64K bytes per cluster.

      "Image Save Path" is used to store the images for network booting. This disk should be also formatted as NTFS and 64K bytes per cluster. You’d better use a fast speed hard disk as "Image Save Path". For example, use an SAS hard disk.

      Figure 5
      Keep default values in "Server Cache Settings".

      Figure 6
      Keep default values in "Other Settings". Press the "Finish" button and confirm the popup dialog box.
    3. Create Image for Network Boot Windows XP
      To network boot Windows XP with CCBoot, you first of all need to create a system image and here're the steps -
      1. Choose one client PC as master PC used to create network boot image. Attach a hard disk on the PC.
      2. Delete all partitions first. Allocate a small MBR partition about 40G size and leave the rest unallocated. Format the 40G partition with NTFS. Install Windows XP and the latest SP into this partition.
      3. After complete Windows installation, open the local area connection network properties and configure as bellow:

        Figure 7
        Click "Properties".

        Figure 8
        Select "Internet Protocol (TCP/IP)" and click "Properties".

        Figure 9
        Select "Obtain an IP address automatically" and "Obtain DNS server address automatically", then click "OK" to save.
      4. On the CCBoot network boot server you will find a client in the client list (Figure 10) that was added by CCBoot automatically when the client PC got IP address from the CCBoot DHCP service.

        Figure 10
      5. Double click the client to edit and check both "Enable Upload Image" and "Keep Write-back File" (Figure 11), when press "save" button it will ask you "Are you sure to delete write-back file?" Just press "No".

        Figure 11
      6. Download CCBoot client installation package from: http://www.ccboot.com/download.htm. Launch ccbootsetupclient.exe and keep press the next button to the end. Then launch CCBoot client and you will see the main interface as bellow (Figure 12).

        Figure 12
      7. Press the "Install CCBoot Client" button. After finished, it will require reboot system. Reboot the client PC.
      8. After reboot, launch CCBootClient again, input the correct "Server IP address", it should be the IP address of the PC on which CCBoot server has been located. Input the image file name as you want in the "Image File Name". Press the "Upload Image" button to upload the image to the CCBoot server. Then CCBoot will create an image in the server "Image Save Path".

        Note: CCBoot supports two types image file format. It supports VMDK if you are using Windows 2003 as CCBoot server system. It will support both VMDK and VHD if you are using Windows 7 or Windows 2008. As you can see in Figure 12, the file format depends on what you have set for "Image File Name". For example, "XP01.vmdk" and "XP01.vhd".
    4. Network Boot Windows XP on LAN
      1. On CCBoot network boot server, double click PC101 (Figure 10) to open the master PC’s properties dialog box, uncheck "Enable Upload Image" and "Keep Write-back File".
      2. Remove the HDD from the master PC, set it firstly boot from network (or LAN, PXE rom, or some other similar settings) in BIOS settings so that it will start network boot Windows XP.(Figure 13).

        Figure 13
      3. The first time you network boot Windows XP on the master PC, you can modify its computer name (Figure 14).

        Figure 14
        Set the computer name as you wish then press enter key to boot it over network (Figure 15).

        Figure 15
      4. On CCBoot server, "Options" -> "Settings" -> "Default Client Settings" -> "Disk Group" -> press the ">>" button, select "XP01.vmdk" as the default boot image in "System Image Selection" section.
      5. Do the same as Step 2 and Step 3 for other client PCs with the same specifications as the master PC to network boot Windows XP for them.