I feel like this is a really simple and fundamental function that Windows should have, but so far Google has been telling me it isn't possible. How can I mount an NTFS partition read-only in Windows?
Asked
Active
Viewed 6.4k times
62
-
1Without trying to detract from an otherwise nice question and answer, if one wants to try to use ATTR/ATT on an old and archaic version of Windows (i.e. XP), diskpart 5.1.3565 doesn't support that command. Why one might want to use an XP version of diskpart might be seem to present quite a puzzle, but, well, just saying, I couldn't use the goodness in this question and answer - the question did not constrain the question to particular vintages of Windows. – kbulgrien Aug 09 '17 at 22:19
1 Answers
64
You can modify the volume attributes to make it read-only:
- Switch off "automount" by running
mountvol.exe /N - Connect disk to Windows (do not mount the disk)
- Run
diskpart - Enter
list volume - Enter
select volume X(where X is the correct volume number from the previous command) - Enter
attributes volume set readonly - Enter
detail volumeand ensure the read-only bit is set
Now you can mount the volume and it will be read-only.
Note that the diskpart commands can be abbreviated, e.g. att vol, det vol.
See also: http://crawlmsdn.microsoft.com/en-us/magazine/cc302206.aspx
Cristian Ciupitu
- 5,583
Everett
- 5,990
- 1
- 23
- 33
-
15Note: those attributes are persistent and stored on the partition, so this is a bit different from the "read-only mount" notion on Linux (ie. simply putting the hard drive back in the original enclosure won't make the partition read-write, and Windows won't be able to boot on it). – Damien B Jul 12 '12 at 21:03
-
11To re-enable automatic mounting of new volumes use
mountvol.exe /E. To remove the readonly flag, select the volume indiskpart(use the commands in this answer) and enteratt vol clear readonly. – Ronald Dec 05 '12 at 23:52 -
1Thank you Everett, this also answers my question. I wrote a PowerShell script according to your explanations, may be useful for someone else. – mmdemirbas Mar 23 '13 at 21:03
-
it also works for volumes mounted on directories instead of dos units! thanks! – user1586274 Jul 27 '13 at 05:18
-
3Under Windows 8.1,
mountvol /ndid not prevent drive from being automounted. One should consider using this beforehand: http://www.petri.co.il/configure_usb_disks_to_be_read_only_in_xp_sp2.htm – Ivan Vučica Feb 05 '14 at 21:19 -
Curious, is it possible to mount the system volume as read-only? I imagine I would need to disable the pagefile and any logging will crap itself. – Adam Plocher Dec 12 '16 at 09:42
-
Although under Windows 8.1,
mountvol /Ndidn't prevent the drive from being automounted, all of the other commands worked as specified. – Adrian Jul 23 '17 at 16:25 -
1Alternative to
mountvol /Ncommand, indiskpartyou can useAUTOMOUNT ENABLEandAUTOMOUNT DISABLEcommands. – Slider2k Oct 07 '21 at 14:33