Windows 10 Create a Virtual Read-Only Partition

This is a tutorial to setup a read only virtual partition that can be used to store data that obviously can only be read by users. Local administrators can remove the write protection in the event that new or modified data needs to be added.

  • First off you will need to open an elevated command prompt. Click the start button and type cmd, right click on "Command Prompt" and select "Run As Administrator"
  • Next you need to launch the diskpart utility by simply tying diskpart
  • read_only1.png
  • Now you will need to create a virtual hard drive by typing create vdisk file="pathtofile" type=(fixed|expandable) maximum=(size in MBs)
  • read_only2.png
  • After creating the virtual hard drive we need to attach it so we can work on it by typing attach vdisk, I typed the command list disk just to show the new disk
  • read_only3.png
  • Now that the disk is created you need to create a partition with create part primary
  • Now select the partition with select part 1 and the second command does a quick format with the NTFS filesystem and a label of STATIC_DATA
  • read_only5.png
  • It's time to assign the virtual hard drive a drive letter, you can pick any that you like assign letter=R
  • read_only6.png
  • read_only7.png
  • When you open explorer you will see the virtual hard drive. It's time to copy your data over to the newly created. Make sure to leave the command prompt open, there is one more command to type after
  • Last step, back in the command prompt, type attributes disk set readonly. If you look in disk management you will see "Read Only" by it
  • read_only8.png

Steps to Modify Data

  • Open an elevated command prompt
  • Type diskpart
  • Type list disk this will give you a list of all of your disks. In my example the virtual disk is listed as disk 2 so to select it I type select disk 2
  • Now clear read-only with the following attributes disk clear readonly
  • Modify your data then type attributes disk set readonly again