Windows 10 Create a Virtual Read-Only Partition

  • Thread Author
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
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • Now you will need to create a virtual hard drive by typing create vdisk file="pathtofile" type=(fixed|expandable) maximum=(size in MBs)
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • 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
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • Now that the disk is created you need to create a partition with create part primary
    An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • 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
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • It's time to assign the virtual hard drive a drive letter, you can pick any that you like assign letter=R
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.
  • 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
  • An image from 'Create a Virtual Read-Only Partition'. Creating, partitioning, formatting, assigning, and setting a virtual disk as read-only using DiskPart in Windows.

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
 

Last edited by a moderator:
interresting idea
 

Someone requested it so I wrote the tutorial :)
 

Back
Top