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.
Dig Deeper on Alternative operating systems
Related Q&A from Serdar Yegulalp
This week, our expert answers the question of how to get DVD data off a disc, even if the user's PC doesn't have an optical drive. Continue Reading
This week, our expert answers a question on how to connect a phone or tablet to a USB drive with a micro-USB connector. Continue Reading
Open source and free suites such as LibreOffice and OpenOffice could save organizations money, but not effort in comparison with Microsoft Office. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.