15

I want Drive(Volume) D to be read-only so people can view its content but no file would be altered/added/deleted. For example if a user selects a file and clicks "delete" nothing would happen.

theroyn
  • 453

2 Answers2

23

Since the drive is probably being used, you need to open windows in command-prompt mode:

  1. While holding down the Shift key, click the restart button in the Start menu.
  2. Click Troubleshoot.
  3. Select Advanced Options
  4. Select Command Prompt

Now we will unmount Volume(drive) D, turn it to read-only, and remount:

  1. Enter mountvol to list all the volumes. D should look something like -
   \\?\Volume{b77a3ed1-0651-5gdf-90b1-d1a3672d96e4}\
        D:\

You should remember which one was D for later.

  1. Enter mountvol D: /p which will unmount D.
  2. Enter diskpart
  3. Enter list volume and note volume D's index in the ### column. Let's say it's 1.
  4. Enter sel vol 1 to select volume D.
  5. Enter att vol set readonly yo make D read only.
  6. Enter det vol to see the volume's info and confirm that D is now read only.
  7. Enter exit to go back to the command prompt.
  8. Enter mountvol D: \\?\Volume{b77a3ed1-0651-5gdf-90b1-d1a3672d96e4}\ to remount D. Of course, replace the gibberish address from this example with the one you have listed in mountvol.
  9. reboot.

Volume D should now be read-only! No one will be able to create new files or modify existing ones and you can see that the delete option is gone when right clicking files.

You can revert this by repeating the same process and only changing step 6 to att vol clear readonly.

Enjoy!

Toby Speight
  • 4,967
theroyn
  • 453
  • The only problem would be that it would require a real effort to intentionally write to it again. – Rohit Gupta Sep 14 '22 at 21:35
  • 6
    @RohitGupta That's the point. – Deduplicator Sep 15 '22 at 09:34
  • 10
    This is already implied by the last line, but I just wanted to highlight that this is not a security measure/protection against malicious users. This will only discourage writing to the drive but sufficiently knowledgeable users will still be able to revert this easily. If the drive contains important data, back it up! – user9123 Sep 15 '22 at 11:42
  • 3
    @user9123 The question does seem to imply protection against negligence, not malicious attacks. No data is truly safe from deletion by anyone with a sufficiently large hammer. – Hermann Sep 15 '22 at 15:20
1

If your Drive D volume is in a separate storage media (e.g. hard drive, SSD, USB flash drive etc.) (in diskpart: called disk) then probably OK for you to set read-only the whole storage media. (Obviously, if there are multiple volumes on this storage media, they will also be read-only.) The method is easy:

  1. In Windows Taskbar Search Box type diskpart and press Enter, then wait a few seconds.

  2. In diskpart enter list disk then you get the list of storage medias in your system, something like:

Disk ### Status Size Free Dyn Gpt

Disk 0 Online 238 GB 0 B *

Disk 1 Online 59 GB 15 MB

In this list your drive C is for example disk 0, and your drive D is for example disk 1. (You can not read drive letters in this list but you can identify your drive D about its size (capacity).)

  1. Enter select disk 1

  2. Enter att disk set readonly

That's all.

To set not read-only again, enter att disk clear readonly

tac
  • 11