2

How can I access/boot a/via a specific partition (in this case, the Lenovo Recovery partition) when starting a virtual machine which should become a Windows 8.1 OS?

Original Disk Layout

The ThinkPad X1 Carbon 2nd Gen., holds a recovery partition in its original disk layout. For example, in the model 20A7005RGE, the disk layout is structured as:

  • sda1: ntfs, WINRE_DRV, ~1GB
  • sda2: fat32, SYSTEM_DRV, ~260MB
  • sda3: unknown, Microsoft Reserved Partition, ~128MB
  • sda4: ntfs, Windows8_OS, ~217GB
  • sda5: ntfs, Lenovo_Recovery, ~14GB
  • sda6: unknown, Basic data partition, ~7GB [/list]

Look also at http://users.wfu.edu/yipcw/lenovo/2014/X1C2/: read disk layout in section OEM Softare.

Clones of Important Partitions

I kept a clone of each important partition using dd. To exemplify, for sda1, I instructed: dd if=/dev/sda1 of=/mnt/usb/WINRE_DRV.dd and similarly done for the rest (except for sda3 and sda4).

Creating a Virtual Disk

Mainly for hardware testing purposes (i.e. mobile broadband modem), as well as for some software, I am trying to install Windows (8.1) from the recovery partition in VirtualBox. To do this, I re-created the original disk layout in a virtual disk. Note, partition sizes were extracted from original disk layout (as described above) and attention was given to select the proper type of partition(s) (NTFS, Windows Recovery Environment, EFI, et.c.).

# create sparse image
dd if=/dev/zero of=ThinkPad_Recovery.img bs=1 count=0 seek=256G

# re-create partitioning scheme as root
fdisk ThinkPad_Recovery.img

# OR
gdisk ThinkPad_Recovery.img

# access partitions contained in image via /dev/loop*?
partx -a ThinkPad_Recovery.img

Confirm the Virtual Disk's Layout

# check...
fdisk -lu ThinkPad_Recovery.img 

Disk ThinkPad_Recovery.img: 256 GiB, 274877906944 bytes, 536870912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3E289338-246A-44DE-B7F6-80250FDFD417

Device                        Start          End   Size Type
ThinkPad_Recovery.img1         2048      2050047  1000M Windows recovery environment
ThinkPad_Recovery.img2      2050048      2582527   260M EFI System
ThinkPad_Recovery.img3      2582528      2844671   128M Microsoft reserved
ThinkPad_Recovery.img4      2844672    457926655   217G Microsoft basic data
ThinkPad_Recovery.img5    457926656    491481087    16G Windows recovery environment
ThinkPad_Recovery.img6    491481088    506161151     7G Microsoft basic data

Clone Original Partitions inside Virtual Disk

# copy content of dd-ed partitions into corresponding partitions inside the virtual disk 
dd if=WINRE_DRV.dd of=/dev/loop1p1
dd if=SYSTEM_DRV.dd of=/dev/loop1p2
dd if=Lenovo_Recovery.dd of=/dev/loop1p5
dd if=Basic_data_partition.dd of=/dev/loop1p6

# device mappings removed after rebooting!

Just to be sure...

# reporting
tpx1c2g original_partitions # fdisk -l ThinkPad_Recovery.img

Disk ThinkPad_Recovery.img: 256 GiB, 274877906944 bytes, 536870912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3E289338-246A-44DE-B7F6-80250FDFD417

Device                        Start          End   Size Type
ThinkPad_Recovery.img1         2048      2050047  1000M Windows recovery environment
ThinkPad_Recovery.img2      2050048      2582527   260M EFI System
ThinkPad_Recovery.img3      2582528      2844671   128M Microsoft reserved
ThinkPad_Recovery.img4      2844672    457926655   217G Microsoft basic data
ThinkPad_Recovery.img5    457926656    491481087    16G Windows recovery environment
ThinkPad_Recovery.img6    491481088    506161151     7G Microsoft basic data

gdisk -l ThinkPad_Recovery.img
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk ThinkPad_Recovery.img: 536870912 sectors, 256.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 3E289338-246A-44DE-B7F6-80250FDFD417
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 536870878
Partitions will be aligned on 2048-sector boundaries
Total free space is 30711741 sectors (14.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2050047   1000.0 MiB  2700  WINRE_DRV
   2         2050048         2582527   260.0 MiB   EF00  SYSTEM_DRV
   3         2582528         2844671   128.0 MiB   0C01  Microsoft Reserved ...
   4         2844672       457926655   217.0 GiB   0700  Windows8_OS
   5       457926656       491481087   16.0 GiB    2700  Lenovo_Recovery
   6       491481088       506161151   7.0 GiB     0700  Unlabeled

So far, so good. Converting the .img into .vdi via VBoxManage convertfromraw ThinkPad_Recovery.img ThinkPad_Recovery.vdi --format VDI and using this a new virtual machine, seems to work.

The screen, however, after booting the machine is: enter image description here.

It seems that the actual recovery partition (named after "Lenovo_Recovery") isn't accessed. How can I proceed?

Various Sources

12
  • You can't since VirtualBox doesn't have support for the Lenovo button.
    – Ramhound
    Sep 2, 2014 at 11:51
  • 1
    I can't identify any dedicated Lenovo button in the new X1 Carbon! You mean some kind of a soft-button? Sep 2, 2014 at 12:06
  • Can you examine the lenovo partition? Maybe you can just chain load to its boot record?
    – Milind R
    Sep 12, 2014 at 4:17
  • @MilindR Can you, please, elaborate a bit on your idea? Sep 12, 2014 at 8:25
  • 1
    @MilindR If you try to use the Recovery partition in another computer, it won't work. And, perhaps, it is illegal as well. I am not sure. Accessing the Recovery in the new(er) X1 Carbon (2nd Gen) is done right after Turning on the machine (some F-key or similar brings you to a couple of choices). Sep 12, 2014 at 10:50

0

You must log in to answer this question.

Browse other questions tagged .