Installing Windows Server 2019 from a remotely mounted ISO

Maciej Lawniczak maciej.lawniczak at linux.intel.com
Thu Oct 22 22:37:17 AEDT 2020


Mounting DVD-based ISOs in Intel-BMC Virtual Media is not supported by 
underlying USB Mass Storage gadget. To mount such iso files they need to 
be converted to MBR/FAT32 image. Attached instruction shows two ways of 
preparing such image.

On 10/21/2020 9:32 AM, Thaj wrote:
> Hi Alexander, I am also facing the same issue. Did you find any 
> workaround for this ?
>
> On Mon, May 25, 2020 at 4:04 PM Alexander Amelkin <a.amelkin at yadro.com 
> <mailto:a.amelkin at yadro.com>> wrote:
>
>     Hi all!
>
>     We're trying to install Windows Server 2019 from an ISO image
>     mounted as
>     remote media via OpenBMC WebUI.
>
>     The Windows installer boots, but then says that a media driver is
>     missing.
>
>     Are there any hints on how to accomplish the task?
>
>     Attached is the screenshot of the message we get with Windows
>     Server 2019.
>
>     With best regards,
>     Alexander.
>
>     P.S. We're using Intel-BMC version of OpenBMC for the task, but it
>     looks
>     like the remote media part is more or less the same.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20201022/4a400b44/attachment-0001.htm>
-------------- next part --------------
# Mouting Windows ISO image in OpenBMC VirtualMedia

OpenBMC implementation of VirtualMedia functionality is based on open source
 [Mass Storage Gadget](https://www.kernel.org/doc/html/latest/usb/mass-storage.html).
It has known limitation of no support for DVD ISO images.

By design VirtualMedia will mount all served images as USB Mass Storage device
for compatibility. While this doesn't affect modern ISO images for Linux
distributions, Windows installer is sensitive to the medium it's booted from.

To verify if ISO you're trying to mount is a CD/DVD image execute following
command:
```bash
file <path to iso>
# CD/DVD image will report 'ISO 9660 CD-ROM`
# Mass Storage compatible ISO will usually report 'DOS/MBR'
```

## Windows installation in OpenBMC VirtualMedia
Windows ISO images are meant to be mounted in following ways:
- DVD burned directly from ISO
- USB device prepared by Windows Media Creation Tool

None of these are applicable out of the box for OpenBMC VirtualMedia, so
following preparation is needed:

### Option 1: Create USB installation disk on Windows and dump drive image
```
Image size consideration

Please note that this method will create image of the whole partition. By default it means that resultant image will have size of your whole USB drive used for the operation (16GB image for 16GB USB drive).

To keep image size as small as possible it's best to use use smallest drive possible (preferably 8GB) for image creation.
Another (more advanced) option is to create/shrink partition on USB drive to preferred size, but keep in mind that it would require rolling back after operation to restore full USB drive capacity.

If you want to have full control over image size and don't want to modify your USB drive, please check 'Option 2', as it covers manual conversion of image without need of any USB device.
```

If Windows Media Creation Tool is not available for your version of Windows,
follow [instructions from Microsoft](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/install-windows-from-a-usb-flash-drive).
In short:
1. Format your USB drive as FAT32 'Active' partition
2. Mount ISO in the system (Windows have built-in support for that)
3. Using linked instruction copy over ISO contents to your USB drive
   - copy all files less than 4GB directly
   - split `sources/install.wim` file into multiple `.swm` files

Dump newly populated FAT32 partition into image. There are various tools to achieve
that, you can use following solution based on `Cygwin`:
1. Install Cygwin from https://cygwin.com/install.html
2. Find your FAT32 partition by executing command:
```bash
cat /proc/partitions
```
   - Find device descriptor for your USB Drive, in this system it has letter ‘D:\’ assigned
```bash
sdb1   D:\
```
3. Create image of the partition with following command,
```bash
dd if=/dev/*** conv=sync,noerror bs=64K status=progress of=***
```
Assuming your drive is at `/dev/sdb1`, and image should be placed at `C:\Users\Admin\Documents\disk_image.img`:
```bash
dd if=/dev/sdb1 conv=sync,noerror bs=64K status=progress of=/cygdrive/c/Users/Admin/Documents/disk_image.img
```

### Option 2: Convert ISO to FAT32 disk image on Linux
```
Following instruction is based on Ubuntu 18.04, but should be applicable
to wide range of modern GNU/Linux operating systems.

It requires wimtools and 7zip, which can be installed as such:
sudo apt install p7zip-full wimtools
```
#### Unpack image to 'iso' directory
```bash
# 7zip package should be available in all modern Linux distributions
7z x <path_to_iso> -oiso
```

#### Create empty image from_iso.img
```bash
# 8 gb should be suitable for double density DVD, but can be decreased to fit the image
dd if=/dev/zero of=from_iso.img count=8 bs=1G
```

#### Create FAT32 partition
```bash
# Interactive tool will require following inputs:
# n <enter> <enter> <enter> <enter> t c w
fdisk from_iso.img
```

```bash
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x84a6bd20.

# type 'n'
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
# type <enter>
Select (default p):

Using default response p.
# type <enter>
Partition number (1-4, default 1):
# type <enter>
First sector (2048-16777215, default 2048):
# type <enter>
Last sector, +sectors or +size{K,M,G,T,P} (2048-16777215, default 16777215):

Created a new partition 1 of type 'Linux' and of size 8 GiB.

# type 't'
Command (m for help): t
Selected partition 1
# type 'c'
Hex code (type L to list all codes): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

# type 'w'
Command (m for help): w
The partition table has been altered.
Syncing disks.
```

#### Format filesystems
```bash
mkfs.vfat from_iso.img
```

#### Modify ISO contents to fit into FAT32 partition
```bash
wimlib-imagex split "./iso/sources/install.wim" "$(pwd)/iso/sources/install.swm" 4000
```

```
WARNING:
Next commands should be performed as 'root' user.
Type 'sudo -s' to switch to root session, type 'exit' afterwards.
```

#### Copy ISO contents to newly created image
```bash
mkdir mounted
mount from_iso.img mounted
rsync -rv --exclude="sources/install.wim" ./iso/ ./mounted
```

#### Unmount devices
```bash
# Ensure that everything has been written to disk
sync
sync
umount mounted
```


More information about the openbmc mailing list