How to Online / Offline a Disk Using Diskpart? [Ultimate Guide]

Ariel Mu
3 min readMar 12, 2023


Many users find the Online / Offline option is greyed out in Disk Management. Is there a way to Online / Offline a disk in Command Prompt? In this post, MiniTool will show you how to Online / Offline a disk using diskpart in detail.

When righting-click the disk, lots of users find the Online/Offline option is greyed out in Disk Management. So, many of them want to Online / Offline a disk using CMD. How to Online / Offline a disk using diskpart? This question is discussed in different forums, but there are no detailed steps or clear screenshots about the operation. That’s why we write this post.

Hello, If I remember correctly, in previous operating systems I could right-click on a disk in Disk Management to be given the option to Offline/Online the Disk. Is there a simple way to offline and online a disk? Grateful for any help.

From the forum

What Is Online/Offline Disk

Before you Online / Offline a disk in Command Prompt, it’s necessary to figure out what online and offline mean on a disk. Here we will explain this question in detail.

For basic disks, bringing offline disk to online means that the selected disk and all volumes on the disk will go back to the online state. For dynamic disks, it means that all volumes and disks that are not marked as foreign disk on the local computer will go back online.

In addition, if the dynamic disk contains mirrored or RAID 5 volumes, the online command will resynchronize these volumes.

If you set a dynamic disk in a group to offline, the group will show the disk as offline, and the status of the disk changes to missing. Then the missing disk is moved to the invalid group. If the dynamic disk is the last one in the group, then the status of the disk changes to offline, and the empty group is removed.

How to Online / Offline a Disk Using Diskpart

Diskpart is a Windows built-in partitioning utility that uses command lines to perform various operations such as format/wipe/create/extend volumes, list disks, convert disks, etc. Here you can use it to bring offline disk to online.

Before You Do

As discussed above, the Online / Offline command has different impacts on basic and dynamic disks. So, we highly recommend you check your disk type before performing the operation. If you want to convert your dynamic disks to basic, MiniTool Partition Wizard can help you do that easily.

It is a professional and trustworthy disk manager that can convert dynamic disk to basic without data loss, convert MBR to GPT, convert NTFS to FAT, migrate OS, recover lost partitions, and more.

How to Set a Disk Online / Offline using diskpart

Now, you should have known the difference between online and offline disks. Let’s see how to Online / Offline a disk using CMD.


Make sure you have signed in as an administrator before you do. Besides, don’t offline a system disk.

Step 1. Type cmd in the Search box, and then right-click the Command Prompt app from the top result and select Run as administrator. Then click on Yes in the UAC window.

Step 2. In the elevated Command Prompt window, type the following commands in order and hit Enter after each one.

  • diskpart
  • list disk (which shows all available disks on your computer)
  • select disk * (* represents the number of the disk that you want to online or offline)
  • online disk or offline disk

About The Author

Position: Columnist

Originally published at on March 12, 2023.