I have a partition which I want to be readonly. It is one of several partitions on an external USB drive with GPT-style partitioning.
I have followed the instructions here and it works great for a while. In other words:
C:\Windows\system32>diskpartMicrosoft DiskPart version 10.0.19041.3636Copyright (C) Microsoft Corporation.On computer: TURNIPDISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 I DVD-ROM 0 B No Media Volume 1 System Rese NTFS Partition 100 MB Healthy Volume 2 E Medium SSD NTFS Partition 465 GB Healthy Volume 3 NTFS Partition 521 MB Healthy Hidden Volume 4 F Small SSD NTFS Partition 111 GB Healthy Volume 5 D Magnetic di NTFS Partition 931 GB Healthy Volume 6 C Large SSD NTFS Partition 1862 GB Healthy Boot Volume 7 FAT32 Partition 100 MB Healthy System Volume 8 NTFS Partition 554 MB Healthy Hidden Volume 9 G Crucial X6 NTFS Partition 476 GB Healthy Volume 10 H Crucial X6 NTFS Partition 976 GB HealthyDISKPART> sel vol GVolume 9 is the selected volume.DISKPART> att vol set readonlyVolume attributes set successfully.
That works fine for a few days. But eventually I find that I can edit files on the partition again. Checking in diskpart, I can see the readonly attribute was cleared.
This doesn't seem to be caused by unplugging and replugging the USB drive, or by restarting the machine. The docs don't have much to say about it.
Why is the readonly flag being cleared on my partition against my will?