Install Windows Server 2012 R2 in UEFI Mode on USB

0. Here I leave notes on how to install windows server 2012 R2 on a USB attached HDD. I did all of below from Windows 8.1 Enterprise Evaluate edition on Virtualbox. 1. Run CMD as an administrator. 2. Partitioning

# Start diskpart.exe
# Show available disks
list disk
# Choose the disk
select disk 1
# Change label to gpt
convert gpt
# Create EFI partition of 100MB
create partition efi size=100
# Format as fat32
format quick fs=fat32 label="BOOT"
# Assign a windows drive letter of your preference.
assign letter=B
# Create OS partition of 128GB
create partition primary size=128000 format quick fs=ntfs label="OS"
assign letter=O
list volume

3. Installing the OS on USB

# Find available index number of edition.
dism /Get-WimInfo /WimFile:c:\install.wim
# Extract install.wim from the OS media, and place it on C drive root, and then run command below.
dism /apply-image /imagefile:c:\install.wim /index:2 /applydir:o:\

4. Install bootmgr on efi partion.

o:\windows\system32\bcdboot o:\windows /f ALL /s b:

5. Boot the PC from the USB drive, and finish the setup.

Cygwin Installation Notes

1. Get Cygwin and apt-cyg
Required packages for apt-cyg


Recommended extra packages

inetutils (telnet,ftp client)
util-linux (for script command)
openssh (for ssh server)
tftp (tftp client)
tcp-wrappers (for xinetd)
xinetd (for ftp,telnet,tftp server)
luit (for character encoding)

Install apt-cyg. If the command below fails just save
and place it under /usr/bin and make it executable.

svn –force export /bin/
chmod +x /bin/apt-cyg

2. Configuration for Japanese Windows.
vi .inputrc

set kanji- sjis
set convert-meta off
set meta- on
set output-meta on

3. Configure Windows environment variables to use cygwin commands in Windows Powershell.
Right-click Computer, properties, Advanced system setting, environment variable
edit PATH and append the below. With Powershell, you don’t have to worry about character encodings.

4. Tuning to my preference.

vi /etc/bash.bashrc
PS1='[\u@\h \W]\$ '
alias explorer=/cygdrive/c/Windows/explorer.exe

To clear banner on ssh, ftp, telnet login, do…
echo '' > /etc/motd
echo '' > /etc/defaults/etc/motd

To make blue coloured text visible on black background, do…
echo 'Blue=127,127,255' >> ~/.minttyrc
echo 'BoldBlue=191,191,255' >> ~/.minttyrc

Cygwin vim does not set vimrc by default, so place vimrc under home directory and edit to your liking.
cp /usr/share/vim/vim74/vimrc_example.vim ~/.vimrc

To install ssh on Cygwin, do below.
cygrunsrv.exe -S sshd

To activate ftp, tftp, telnet server, do below.
vi /etc/xinetd.d/ftpd
vi /etc/xinetd.d/tfppd
vi /etc/xinetd.d/telnet
disable = no
user = username

Cygwin does not accept from outside by default, so edit below and comment all to accept from all.
vi /etc/hosts.deny
cygrunsrv -S xinetd

5. Whenever you have errors like “child info fork abort”, stop all cygwin related service and start ash.exe under bin directory, annd run /bin/rebaseall -v

6. In order to uninstall cygwin, stop and remove all cygwin services, and open regedit and search for keyword cyg and remove them. There are something like Cygnus Solution ~, and Cygwin totalling to four.