回復パーティションの拡張操作(Windows10 Pro 22H2)
2024/02/07
Windows Updateに失敗する原因を調べていったら,回復パーティションのサイズが足りないためらしい.
よって,パーティション操作を珍しくWindowsでやることになりました*1.
以下では,コマンドプロンプトを管理者権限で起動して作業します.
この記事で記載するのはGPTでフォーマットされたディスクに対する処理です.
MBR方式のディスクはほかのサイトを参照ください.
また,パーティション操作はデータが消える可能性がある操作です.
本記事の操作を行う場合もデータや設定内容のバックアップを取ってから実施することをオススメします.
1 Windows 回復環境 (Windows RE)を無効化する
Microsoft Windows [Version 10.0.19045.3930] (c) Microsoft Corporation. All rights reserved. C:\Windows\system32>reagentc /info Windows 回復環境 (Windows RE) およびシステム リセット構成 情報: Windows RE の状態: Enabled Windows RE の場所: \\?\GLOBALROOT\device\harddisk1\partition4\Recovery\WindowsRE ブート構成データ (BCD) ID: 43fab709-652d-11ee-95e0-dee59aaa6d6c 回復イメージの場所: 回復イメージ インデックス: 0 カスタム イメージの場所: カスタム イメージ インデックス: 0 REAGENTC.EXE: 操作は成功しました。 C:\Windows\system32>reagentc /disable REAGENTC.EXE: 操作は成功しました。 C:\Windows\system32>
2 diskpartでパーティション操作
マウントしたまま作業できる模様.2.1 diskpartの起動
C:\Windows\system32>diskpart Microsoft DiskPart バージョン 10.0.19041.3636 Copyright (C) Microsoft Corporation. コンピューター: XXX-OWL DISKPART>
2.2 対象ディスク(SSD)の選択
ディスク0は以前使用していたシステムディスクで,現在未使用(MBR方式).なので,GPTのディスク1を選択する.
DISKPART> list disk ディスク 状態 サイズ 空き ダイナ GPT ### ミック ------------ ------------- ------- ------- --- --- ディスク 0 オンライン 931 GB 0 B ディスク 1 オンライン 931 GB 1024 KB * DISKPART> select disk 1 ディスク 1 が選択されました。 DISKPART>
2.3 Cドライブのパーティションを選択し,リサイズする
DISKPART> list partition Partition ### Type Size Offset ------------- ------------------ ------- ------- Partition 1 システム 100 MB 1024 KB Partition 2 予約 16 MB 101 MB Partition 3 プライマリ 930 GB 117 MB Partition 4 回復 564 MB 930 GB DISKPART> select partition 3 パーティション 3 が選択されました。 DISKPART>shrinkコマンドで指定サイズ分小さくする.
単位はMB.初期の回復パーティションは564MBだが,容量1.5GBくらいにしておきたいので1000MB増やすことに*2.
DISKPART> shrink desired=1000 minimum=1000 ボリュームは、次の方法で正常に縮小されました: 1000 MB DISKPART> list partition Partition ### Type Size Offset ------------- ------------------ ------- ------- Partition 1 システム 100 MB 1024 KB Partition 2 予約 16 MB 101 MB * Partition 3 プライマリ 929 GB 117 MB Partition 4 回復 564 MB 930 GB DISKPART>
2.4 回復パーティションの削除
DISKPART> select partition 4 パーティション 4 が選択されました。 DISKPART> delete partition override DiskPart は選択されたパーティションを正常に削除しました。 DISKPART> list partition Partition ### Type Size Offset ------------- ------------------ ------- ------- Partition 1 システム 100 MB 1024 KB Partition 2 予約 16 MB 101 MB Partition 3 プライマリ 929 GB 117 MB DISKPART>
2.5 回復パーティションの再作成
シュリンクした場所と,削除した回復パーティションの跡地に,回復パーティションを再作成する.
create partition primary id=de94bba4-06d1-4d40-a16a-bfd50179d6ac gpt attributes =0x8000000000000001 format quick fs=ntfs label="Windows RE tools"の3つのコマンドを対象のディスク上(この場合ディスク1.最初に選択しているのでここで明示的に指定する必要はない)で実施する.
実施後に“list volume”を行い,回復パーティションが新しく設定されていれば“exit”でdiskpartを終了する.
“create partition”で指定する“id=de94bba4-06d1-4d40-a16a-bfd50179d6ac”はどのようなシステムでも同じようだ.
また,gptの属性値“0x8000000000000001”はドライブ文字を非表示にする値で,回復パーティションは通常この値にするようだ.
DISKPART> list disk ディスク 状態 サイズ 空き ダイナ GPT ### ミック ------------ ------------- ------- ------- --- --- ディスク 0 オンライン 931 GB 0 B * ディスク 1 オンライン 931 GB 1565 MB * DISKPART> create partition primary id=de94bba4-06d1-4d40-a16a-bfd50179d6ac DiskPart は指定したパーティションの作成に成功しました。 DISKPART> list partition Partition ### Type Size Offset ------------- ------------------ ------- ------- Partition 1 システム 100 MB 1024 KB Partition 2 予約 16 MB 101 MB Partition 3 プライマリ 929 GB 117 MB * Partition 4 回復 1565 MB 929 GB DISKPART> gpt attributes =0x8000000000000001 選択された GPT パーティションに DiskPart で属性を割り当てました。 DISKPART> list partition Partition ### Type Size Offset ------------- ------------------ ------- ------- Partition 1 システム 100 MB 1024 KB Partition 2 予約 16 MB 101 MB Partition 3 プライマリ 929 GB 117 MB * Partition 4 回復 1565 MB 929 GB DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ---- ---------- ------- --------- -------- Volume 0 D システムで予約済み NTFS Partition 100 MB 正常 Volume 1 E NTFS Partition 930 GB 正常 Volume 2 NTFS Partition 877 MB 正常 非表示 Volume 3 C NTFS Partition 929 GB 正常 ブート Volume 4 FAT32 Partition 100 MB 正常 システム * Volume 6 RAW Partition 1565 MB 正常 非表示 DISKPART> format quick fs=ntfs label="Windows RE tools" 100% 完了しました DiskPart は、ボリュームのフォーマットを完了しました。 DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ---- ---------- ------- --------- -------- Volume 0 D システムで予約済み NTFS Partition 100 MB 正常 Volume 1 E NTFS Partition 930 GB 正常 Volume 2 NTFS Partition 877 MB 正常 非表示 Volume 3 C NTFS Partition 929 GB 正常 ブート Volume 4 FAT32 Partition 100 MB 正常 システム * Volume 6 Windows RE NTFS Partition 1565 MB 正常 非表示 DISKPART> exit DiskPart を終了しています... C:\Windows\system32>
3 Windows 回復環境 (Windows RE)を有効化する
C:\Windows\system32>reagentc /enable REAGENTC.EXE: 操作は成功しました。 C:\Windows\system32>reagentc /info Windows 回復環境 (Windows RE) およびシステム リセット構成 情報: Windows RE の状態: Enabled Windows RE の場所: \\?\GLOBALROOT\device\harddisk1\partition4\Recovery\WindowsRE ブート構成データ (BCD) ID: 43fab70b-652d-11ee-95e0-dee59aaa6d6c 回復イメージの場所: 回復イメージ インデックス: 0 カスタム イメージの場所: カスタム イメージ インデックス: 0 REAGENTC.EXE: 操作は成功しました。 C:\Windows\system32>この後にWindows Updateを実行したら成功した.