Skip to content

Instantly share code, notes, and snippets.

@rplaurindo
Last active January 28, 2023 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rplaurindo/fbb73916466b7251ba9d4f15844341c3 to your computer and use it in GitHub Desktop.
Save rplaurindo/fbb73916466b7251ba9d4f15844341c3 to your computer and use it in GitHub Desktop.
Managing Disks On Windows By Line Command

Managing Disks

Using the DISKPART

Open the terminal as administrator, and run:

$ diskpart

Listinig All Disks

$ DISKPART> list disk

Selecting a Disk

$ DISKPART> select disk <number>

Cleaning the Selected Disk

$ DISKPART> clean

Converting the Selected Disk To GPT or MBR

$ DISKPART> convert <gpt|mbr>

Creating a Primary Partition

$ DISKPART> create partition primary size=<size in Mib>

Note: to create others partitions you must specify the offset option. This option must be specified in Kib unity. The first default offset is of 1024Kib, so to create a second, third, ... partition primary, specify the offset as (size in Mib of the last partition ⨯ 1024) + 1024.

Listing All Partitions

$ DISKPART> list partition

Selecting a Partition

$ DISKPART> select partition <number>

Formating a Selected Partition

$ DISKPART> format fs=<filesystem name> quick

Note: to convert a partition to FAT32, it must be a maximum of 32 Gib (32.768 Mib).

Assigning a Letter to a Partition

$ assign letter=<letter>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment