DiskPart cannot mount a virtual disk from a readonly device
In my situation, I want the device to stay readonly and I want to mount a VHD from it. In the physical world, you can use DiskPart to disable automount, insert a disk in the system, select the disk and mark it readonly. Any volume mounted after that point will have the read-write attribute but any write will fail with a "media is write protected" eror message. A complete sample is provided below. This is the desired result. If you select a VHD located on a readonly device (select vdisk file=Y:\test.vhd where Y:\ is readonly), DiskPart's answer to the command "attach vdisk readonly" is "DiskPart has encountered an error: The media is write protected." To my knowledge, the only writable structure here is the MBR signature. Why do we need write access to the VDisk "device" when we obviously intend to mount the volumes inside readonly? Regards, Serge Caron --------------------------- Microsoft Windows [Version 6.1.7601] X:\Sources>diskpart Microsoft DiskPart version 6.1.7601 Copyright (C) 1999-2008 Microsoft Corporation. On computer: MININT-37FJILO DISKPART> automount disable Automatic mounting of new volumes disabled. DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 465 GB 0 B Disk 1 Online 465 GB 0 B DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 465 GB 0 B Disk 1 Online 465 GB 0 B Disk 2 Online 465 GB 18 MB DISKPART> select disk 2 Disk 2 is now the selected disk. DISKPART> attributes disk set readonly Disk attributes set successfully. DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 F OS_4631.01 UDF DVD-ROM 6072 MB Healthy Volume 1 C Reserved NTFS Partition 100 MB Healthy Volume 2 E NTFS Partition 465 GB Healthy Volume 3 D NTFS Partition 465 GB Healthy Volume 4 Partition 465 GB Healthy Offline DISKPART> select volume 4 Volume 4 is the selected volume. DISKPART> attributes volume set readonly DiskPart has encountered an error: The media is write protected. See the System Event Log for more information. DISKPART> assign letter=Y: DiskPart successfully assigned the drive letter or mount point. DISKPART> attributes disk Current Read-only State : Yes Read-only : Yes Boot Disk : No Pagefile Disk : No Hibernation File Disk : No Crashdump Disk : No Clustered Disk : No DISKPART> attributes volume Read-only : No Hidden : No No Default Drive Letter: No Shadow Copy : No DISKPART> exit Leaving DiskPart... X:\Sources>echo test > y:\test.txt The media is write protected. X:\Sources>
August 6th, 2011 9:56am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics