Answer

Yes, you can make a Windows disk partition read-only

I've noticed that, in Linux and other operating systems, it's possible to mount a disk partition as read-only. Can this be done in Windows?

Yes, although the approach to a Windows disk partition might seem a little more roundabout than in other OSes. Here's why.

NTFS volumes have a flag that informs the system it's attached to if the volume in question should be set as read-only. This flag is not something you can get to through Explorer, since it's rarely used.

In addition, if you set a volume as read-only by accident, it can have unexpected results. (Imagine doing this by mistake to your system volume. Ouch.)

Windows automatically attempts to mount partitions on any volumes it discovers, by way of the MOUNTVOL utility. This way, when you plug in a flash drive or attach an external hard drive, you don't have to go through the trouble of manually mounting the volume. The vast majority of the time, people want to mount a volume as read-write anyway.

That said, there may be times when you want to temporarily disable auto-mounting, for the sake of manually mounting a volume as read-only. To do this, run MOUNTVOL /N (as an administrative user) to switch off auto-mounting.

You can then use the DISKPART tool to look for the appropriate volume and set the flag by way of the ATTRIBUTES VOLUME SET READONLY command.

One nice side effect of having the read-only flag stored on the volume itself is that the volume will mount as read-only everywhere, not just on that particular system.

Programmer Muhammed Demirbaş has written a PowerShell script to make the job a little easier, without requiring the use of DISKPART.

This was first published in September 2013

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: