- 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
att vol set readonly
- Enter
detail vol
and ensure the read-only bit is set
- Enter
Now you can mount the volume and it will be read-only.
To re-enable automatic mounting of new volumes, run mountvol.exe /E
.
To remove the read-only flag, select the volume in diskpart
and in step 3.3 enter att vol clear readonly
.