Advertisement

Make Disk Or Partition Readonly in Windows 10

In one of the previous articles, I covered how to write-protect removable USB drives. Today, we'll see how to write protect a specific non-removable disk partition or the entire disk drive without using third-party tools.

Advertisеment


There are many reasons to make a disk write-protected. It can be useful as an additional security option in some environments. Once you enable write protection for a drive or a partition, it will become read-only. Let's see how it can be done.

To make a disk readonly in Windows 10, do the following.

  1. Open an elevated command prompt.Elevated Command Prompt
  2. Type or copy-paste diskpart and press the Enter key. This will launch DiskPart. DiskPart is a text-mode command interpreter bundled with Windows 10. This tool enables you to manage objects (disks, partitions, or volumes) by using scripts or direct input at a command prompt.Run Diskpart
  3. In DiskPart, type the following command
    list disk

    In the output, see the disk which you are about to make read-only.Diskpart List Disk

  4. To continue with the required disk, you need to "select" it.
    In the following command use the disk number you got from the previous command.
    sele disk DISK_NUMBER

    For example, I need disk #1.Diskpart Sele Disk

  5. To make the whole disk read-only, type the following command:
    attributes disk set readonly

All partitions on the disk will be read-only.Windows 10 Make Disk Readonly

Windows 10 Disk Is Readonly

The undo command is

attributes disk clear readonly

Windows 10 Clear Disk Readonly State

To make a partition readonly in Windows 10, do the following.

  1. Open an elevated command prompt.Elevated Command Prompt
  2. Type or copy-paste diskpart and press the Enter key.
  3. To find a specific partition, type
    list volume

    Diskpart List Volume

  4. "Select" the required volume by typing the following command:
    select volume VOLUME_NUMBER

    Replace the volume number with a number you got from the previous command.Diskpart Select Volume

  5. Make it read-only using the following command
    attributes volume set readonly

    Windows Make Partition Readonly

The specified volume will be read-only.

Windows Readonly Partition

The undo command is:

attributes volume clear readonly

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

5 thoughts on “Make Disk Or Partition Readonly in Windows 10”

  1. Please note that the diskpart read only flag works only on the computer on which the command was issued. On another comptuer, the read only flag will not be respected – anyone can write on it.

    1. This operation is not allowed on the current boot, system or pagefile volume. It is also not allowed on any volume on a basic MBR disk that contains the boot, system or pagefile volume.

  2. An alternate way with PowerShell:

    Get-Disk # show disk numbers
    Set-Disk -Number 1 -IsReadonly $true # for example disk 1 ($false for r/w)

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.