Difference between revisions of "Expand disks using Diskpart"

From Tech-Wiki
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
  <nowiki>
 
  <nowiki>
DISKPART > Select Disk 0 ("This assumes that DISK 0 is your boot disk")
+
DISKPART > list disk
 +
DISKPART > select Disk 0 (This assumes that DISK 0 is your boot disk)
 
  Disk 0 is now the selected disk.
 
  Disk 0 is now the selected disk.
  
DISKPART > Detail Disk
+
DISKPART > detail Disk
 
  Controller Type SCSI Disk Device
 
  Controller Type SCSI Disk Device
 
  Disk ID: 2FE43460
 
  Disk ID: 2FE43460
Line 22: Line 23:
 
  Volume 1    D  Data    NTFS  Partition  68 GB  Healthy  System
 
  Volume 1    D  Data    NTFS  Partition  68 GB  Healthy  System
  
DISKPART > Select Volume 1
+
DISKPART > select Volume 1
 
  Volume 1 is the selected volume.
 
  Volume 1 is the selected volume.
  
DISKPART > Extend Size=10000  
+
DISKPART > extend Size=10000  
 
Disk Part successfully extended the volume.
 
Disk Part successfully extended the volume.
  
 
DISKPART > Exit
 
DISKPART > Exit
 +
</nowiki>
  
 
If the Recovery partition is between the volume and the empty space, you can delete and recreate it:
 
If the Recovery partition is between the volume and the empty space, you can delete and recreate it:
  
Disable the existing Windows Recovery Partition by running reagentc /disable
+
Disable the existing Windows Recovery Partition by running:
Use diskpart to remove the recovery partition
+
reagentc /disable
  list disk
+
 
select disk # where # is the disk needing the recovery partition removed
+
Use Diskpart to remove the recovery partition
list partition
+
 
select partition # where # is the recovery partition
+
  <nowiki>
delete partition override to force deletion of the recovery partition
+
  DISKPART > list disk
  Expand the disk using Disk Management, leaving ~1024 MB at the end of the drive for recreating the recovery partition
+
  DISKPART > select disk # (where # is the disk needing the recovery partition removed)
Create New Simple Volume for Recovery, NTFS, no drive letter
+
  DISKPART > list partition
use diskpart to set the recovery partition attributes
+
  DISKPART > select partition 4 (where 4 is the recovery partition)
  list partition
+
  DISKPART > delete partition override (to force deletion of the recovery partition)
select partition # where # is the new recovery partition
+
  </nowiki>
  For GPT disks run set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac & gpt attributes=0x8000000000000001
+
 
  For MBR disks, run set id=27
+
Expand the disk using Disk Management, '''leaving ~1 GB at the end'''  of the drive for recreating the recovery partition
Re-enable the recovery partition by running reagentc /enable
+
 
 +
Create New Simple Volume for Recovery, NTFS, no drive letter
 +
Use Diskpart to set the recovery partition attributes
 +
 
 +
  <nowiki>
 +
  DISKPART > list partition
 +
  DISKPART > select partition 4 (where # is the new recovery partition)
 +
  </nowiki>
 +
 
 +
For GPT disks run:
 +
 
 +
<nowiki>
 +
  DISKPART > set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac  
 +
  DISKPART > gpt attributes=0x8000000000000001
 +
  </nowiki>
 +
 
 +
For MBR disks, run set id=27
 +
 
 +
Re-enable the recovery partition by running:
 +
reagentc /enable

Latest revision as of 14:45, 17 November 2024

Back to Misc

In example below it will expand the disk by 10GB, if no size is specified all available space will be allocated to the partition. Keep in mind that Windows 2003 doesn't allow to expand system volume.

This can be via GUI just with right click - expand if there is free space right after it.

DISKPART > list disk
DISKPART > select Disk 0 (This assumes that DISK 0 is your boot disk)
 Disk 0 is now the selected disk.

DISKPART > detail Disk
 Controller Type SCSI Disk Device
 Disk ID: 2FE43460
 Type : SCSI
 Bus : 3
 Target : 0
 LUN ID : 0

Volume ###  Ltr  Label    Fs    Type       Size    Status   Info
 ---------- --- -------- ----- ---------- ------- --------- --------
 Volume 1    D   Data     NTFS  Partition  68 GB   Healthy  System

DISKPART > select Volume 1
 Volume 1 is the selected volume.

DISKPART > extend Size=10000 
Disk Part successfully extended the volume.

DISKPART > Exit
 

If the Recovery partition is between the volume and the empty space, you can delete and recreate it:

Disable the existing Windows Recovery Partition by running:

reagentc /disable

Use Diskpart to remove the recovery partition

   DISKPART > list disk
   DISKPART > select disk # (where # is the disk needing the recovery partition removed)
   DISKPART > list partition
   DISKPART > select partition 4 (where 4 is the recovery partition)
   DISKPART > delete partition override (to force deletion of the recovery partition)
 

Expand the disk using Disk Management, leaving ~1 GB at the end of the drive for recreating the recovery partition

Create New Simple Volume for Recovery, NTFS, no drive letter Use Diskpart to set the recovery partition attributes

   DISKPART > list partition
   DISKPART > select partition 4 (where # is the new recovery partition)
 

For GPT disks run:

   DISKPART > set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac 
   DISKPART > gpt attributes=0x8000000000000001
 

For MBR disks, run set id=27

Re-enable the recovery partition by running:

reagentc /enable