容量の大きいSSDへ換装後、クリーンインストールを前にデュアルブートのUbuntuを削除、Windows回復パーティションをディスク最後尾に再作成してWindows領域を拡張しました。
Ubuntu削除のいきさつ
前回、Windows 10とUbuntu 22.04デュアルブート仕様のまま、容量大きめのSSDへ換装したSony Vaio VPCSA26GGは、増えた空き容量がWindows回復パーティションの後方に展開されてしまっているので、微妙に邪魔。
加えてUbuntuも16.04からのアップグレードを繰り返した経緯から、そろそろクリーンインストールしたいので、今回は一旦これを削除してWindows 10のみの構成へと、戻したいと思います。
ちなみにこのディスクのパーティションテーブルはMBRです。
Windows Boot Managerの復権
Windows 10の 設定→更新とセキュリティ→回復 の中にある、 今すぐ再起動 を押下します。
再起動後、青画面の オプションの選択 では、 トラブルシューティング を選択。

図04.オプションの選択
トラブルシューティング では、 詳細オプション を選択。

図05.トラブルシューティング
そして、 詳細オプション の中にある コマンドプロンプト を選びます。

図06.詳細オプション
ここで再び再起動後、Windowsユーザアカウントを選択し、パスワードを入力。

図07.アカウントを選択

図08.パスワードを入力
こうしてようやくたどり着いた、Windows回復環境のコマンドプロンプトでは、以下の3つのコマンドを実行します。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
X:\windows\system32> bootrec /RebuildBcd Scanning all disks for windows installations. Please wait, since this may take a while... Successfully scanned Windows installations. Total identified Windows installations: 0 The operation completed successfully. X:\windows\system32> bootrec /fixmbr The operation completed successfully. X:\windows\system32> bootrec /fixboot Acccess is denied. X:\windows\system32> |
コマンド実行後、 exit コマンドでプロンプトを抜けると、 オプションの選択 に戻るので続行か、一度電源を切っての再起動へ。
Ubuntuパーティションの削除
以上の作業により、もうgrubメニュー無しでWindows 10が起動するのを確認したら、心置きなくUbuntuパーティションを削除します。
ディスクの管理で、Ubuntuのルートとswapの2つのボリュームをそれぞれ削除。
2つのボリュームを包んでいた、拡張パーティションを削除します。
Windows回復パーティションの削除
次に、空き領域に挟まれたWindows回復パーティションが際立って邪魔なので、ディスクの最後尾へ追いやります。
その具体的な手順は以下の通り。全て管理者権限のコマンドプロンプトで行います。
- [reagentc] 回復パーティション内のWinREをC:ドライブへ回収。
- [diskpart] 回復パーティション削除。
- [diskpart] C:ドライブのパーティションを最大拡張。
- [diskpart] 少し削ってWinRE用の回復パーティション作成。
- [reagentc] C:ドライブ内のWinREを回復パーティションへエクスポート。
まず、WinREの現状をREAgentCコマンドで確認。回復パーティション内で有効化されています。
|
1 2 3 4 5 6 7 8 9 10 11 12 |
C:\WINDOWS\system32> reagentc -info Windows Recovery Environment (Windows RE) and system reset configuration Information: Windows RE status: Enabled Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE Boot Configuration Data (BCD) identifier: 98cccef2-7a35-11e8-9b89-b7f888820213 Recovery image location: Recovery image index: 0 Custom image location: Custom image index: 0 REAGENTC.EXE: Operation Successful. |
このREagentCコマンドに /disable オプションを付与することで、WinREが無効化されて、バイナリ Winre.wim がC:ドライブのWindowsフォルダ内に格納されます。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
C:\WINDOWS\system32> reagentc /disable REAGENTC.EXE: Operation Successful. C:\WINDOWS\system32> reagentc /info Windows Recovery Environment (Windows RE) and system reset configuration Information: Windows RE status: Disabled Windows RE location: Boot Configuration Data (BCD) identifier: 00000000-0000-0000-0000-000000000000 Recovery image location: Recovery image index: 0 Custom image location: Custom image index: 0 REAGENTC.EXE: Operation Successful. |
エクスプローラでも見えないシステムファイルなので、PowerShellで存在を確認。
|
1 2 3 4 5 6 7 |
PS C:\WINDOWS\system32> Get-ChildItem -Hidden C:\Windows\System32\Recovery Directory: C:\Windows\System32\Recovery Mode LastWriteTime Length Name ---- ------------- ------ ---- -a-hs- 2024/03/01 22:30 653860530 Winre.wim |
diskpart ツールで回復パーティションを削除して、ようやく未割り当てが一つになりました。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
C:\WINDOWS\system32> diskpart Microsoft DiskPart version 10.0.19041.3636 Copyright (C) Microsoft Corporation. On computer: VPCSA26GG DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 447 GB 323 GB DISKPART> select disk 0 Disk 0 is now the selected disk. DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 Primary 500 MB 1024 KB Partition 2 Primary 121 GB 501 MB Partition 3 Recovery 951 MB 237 GB DISKPART> select partition 3 Partition 3 is now the selected partition. DISKPART> delete partition override DiskPart successfully deleted the selected partition. |
Windowsパーティションの拡大
このまま diskpart でWindowsパーティションを最大拡張します。
|
1 2 3 4 5 6 7 8 9 10 11 |
DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 Primary 500 MB 1024 KB Partition 2 Primary 121 GB 501 MB DISKPART> select partition 2 Partition 2 is now the selected partition. DISKPART> extend DiskPart successfully extended the volume. |
Windows回復パーティションの再作成
拡張したWindowsの後方1GB分を拝借して、空き領域を確保します。
|
1 2 3 |
DISKPART> shrink minimum=1024 DiskPart successfully shrunk the volume by: 1024 MB |
空き領域にプライマリパーティションを作成。
|
1 2 3 |
DISKPART> create partition primary DiskPart succeeded in creating the specified partition. |
プライマリパーティションをNTFSでフォーマット。
|
1 2 3 4 5 |
DISKPART> format quick fs=ntfs label=Recovery 100 percent completed DiskPart successfully formatted the volume. |
回復パーティション固有のIDを設定して、 diskpart を終了します。
|
1 2 3 4 5 6 7 |
DISKPART> set id=27 DiskPart successfully set the partition ID. DISKPART> exit Leaving DiskPart... |
WinREを回復パーティションへ戻す
新しい回復パーティションのお膳立てが終わったので、REagentCコマンドに /enable オプションを付与して winre.wim を再配置します。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
C:\WINDOWS\system32> reagentc /enable REAGENTC.EXE: Operation Successful. C:\WINDOWS\system32> reagentc /info Windows Recovery Environment (Windows RE) and system reset configuration Information: Windows RE status: Enabled Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE Boot Configuration Data (BCD) identifier: a6ba368c-69af-11ef-a4e3-84144de696f4 Recovery image location: Recovery image index: 0 Custom image location: Custom image index: 0 REAGENTC.EXE: Operation Successful. |
これにより、C:ドライブにいた winre.wim はいなくなります。
|
1 2 |
PS C:\WINDOWS\system32> Get-ChildItem -Hidden C:\Windows\System32\Recovery PS C:\WINDOWS\system32> |
Windows回復パーティションの確認
本当に winre.wim は再配置されたのか、回復パーティションにドライブ符号を割り当てて、その中身を閲覧してみます
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
C:\WINDOWS\system32> diskpart Microsoft DiskPart version 10.0.19041.3636 Copyright (C) Microsoft Corporation. On computer: VPCSA26GG DISKPART> select disk 0 Disk 0 is now the selected disk. DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 Primary 500 MB 1024 KB Partition 2 Primary 445 GB 501 MB Partition 3 Recovery 1023 MB 446 GB DISKPART> select partition 3 Partition 3 is now the selected partition. DISKPART> assign letter=R DiskPart successfully assigned the drive letter or mount point. DISKPART> exit |
割り当てたR:ドライブを参照してみると、確かに winre.wim がいました。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
C:\WINDOWS\system32> R: R:\> dir \Recovery\WindowsRE /ahs Volume in drive R is Recovery Volume Serial Number is 6AC9-0281 Directory of R:\Recovery\WindowsRE 2024/09/03 12:47 <DIR> . 2024/09/03 12:47 <DIR> .. 2019/12/07 17:08 3,170,304 boot.sdi 2024/09/03 12:47 1,118 ReAgent.xml 2024/03/01 22:30 653,860,530 Winre.wim 3 File(s) 657,031,952 bytes 2 Dir(s) 400,343,040 bytes free |
|
1 2 3 4 5 6 7 8 9 |
PS C:\WINDOWS\system32> Get-ChildItem -Hidden R:\Recovery\WindowsRE\ Directory: R:\Recovery\WindowsRE Mode LastWriteTime Length Name ---- ------------- ------ ---- ---hs- 2019/12/07 17:08 3170304 boot.sdi ---hs- 2024/09/03 12:47 1118 ReAgent.xml ---hs- 2024/03/01 22:30 653860530 Winre.wim |
確認後はドライブレターの後始末。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
R:\> diskpart DISKPART> select disk 0 Disk 0 is now the selected disk. DISKPART> select partition 3 Partition 3 is now the selected partition. DISKPART> remove letter=R DiskPart successfully removed the drive letter or mount point. DISKPART> exit Leaving DiskPart... |
最後に、Windows回復環境の 詳細オプション の項目が、最初と変わらないことを確認して今回の作業は終了です。















