原始磁碟佈局

原始磁碟佈局

在啟動應成為 Windows 8.1 作業系統的虛擬機器時,如何透過特定分割區(在本例中為 Lenovo Recovery 分割區)存取/開機?

原始磁碟佈局

ThinkPad X1 Carbon 第二代在原始磁碟佈局中保留了一個復原分割區。例如,在型號 20A7005RGE 中,磁碟佈局結構如下:

  • sda1:ntfs,WINRE_DRV,~1GB
  • sda2:fat32,SYSTEM_DRV,~260MB
  • sda3:未知,微軟保留分區,~128MB
  • sda4:ntfs,Windows8_OS,~217GB
  • sda5:ntfs,Lenovo_Recovery,~14GB
  • sda6:未知,基本資料分區,~7GB [/list]

另請參閱http://users.wfu.edu/yipcw/lenovo/2014/X1C2/: 讀磁碟佈局在部分OEM軟體

重要分區的克隆

我使用 dd 保留了每個重要分區的克隆。舉例來說,對於 sda1,我指示: dd if=/dev/sda1 of=/mnt/usb/WINRE_DRV.dd並對其餘部分執行類似操作(除了 sda3 和 sda4)。

建立虛擬磁碟

主要用於硬體測試目的(即行動寬頻數據機)以及某些軟體,我嘗試從 VirtualBox 中的復原分割區安裝 Windows(8.1)。為此,我在虛擬磁碟中重新建立了原始磁碟佈局。請注意,分割區大小是從原始磁碟佈局中提取的(如上所述),並注意選擇正確的分割區類型(NTFS、Windows 復原環境、EFI 等)。

# 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

確認虛擬磁碟的佈局

# 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

克隆虛擬磁碟中的原始分割區

# 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!

只是要確定...

# 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

到目前為止,一切都很好。轉換 .影像進入 。維迪通過VBoxManage convertfromraw ThinkPad_Recovery.img ThinkPad_Recovery.vdi --format VDI並使用這個新的虛擬機,似乎可以工作。

然而,啟動機器後的畫面是:在此輸入影像描述

似乎未訪問實際的恢復分區(以“Lenovo_Recovery”命名)。我該如何繼續?

各種來源

相關內容