Problem with read-only virtual disk.

Hello,

I have a problem with my virtual disk driver. The driver creates
a read-only NTFS virtual disk from a partition on the disk. It
works fine on XP and Server2003 beta, but fails on 2K. Following
is a sequence of events when running a “dir” on the virtual disk

//// On test machine:
c:\dir k:
The media is write protected

//// On debug machine:
cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and return

cmd.exe - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x200
// read from block device

cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and return

cmd.exe - ReadWriteDispatch: Read. Offset: (0, 32768), Len: 0x800
// read from block device

System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
// set Irp->IoStatus.Status = STATUS_SUCCESS and return

System - DevControlDispatch: IOCTL_DISK_IS_WRITABLE
// set Irp->IoStatus.Status = STATUS_MEDIA_WRITE_PROTECTED and return

System - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and return

System - DevControlDispatch: IOCTL_DISK_GET_PARTITION_INFO
// set values for (PPARTITION_INFORMATION) Irp->AssociatedIrp.SystemBuffer
and return

System - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x1000
// read from block device

System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
// set Irp->IoStatus.Status = STATUS_SUCCESS and return

There is no error if Irp->IoStatus.Status is set to STATUS_SUCCESS
for IOCTL_DISK_IS_WRITABLE control code. It looks like the system
requires write access to the device. Otherwise, access to the drive
will fail.
I know it’s hard to say what’s wrong without looking at the code.
But if someone is familiar with this problem, please give me some
suggestions. Thanks.

Chu Bun

Just want to add that, there is no error if the file system used is
FAT instead of NTFS.

Prior to XP, NTFS will not mount on read-only storage volumes.

-----Original Message-----
From: ChuBun [mailto:xxxxx@yahoo.com]
Sent: Monday, April 21, 2003 10:12 AM
To: File Systems Developers
Subject: [ntfsd] Problem with read-only virtual disk.

Hello,

I have a problem with my virtual disk driver. The driver creates
a read-only NTFS virtual disk from a partition on the disk. It
works fine on XP and Server2003 beta, but fails on 2K. Following
is a sequence of events when running a “dir” on the virtual disk

//// On test machine:
c:\dir k:
The media is write protected

//// On debug machine:
cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return

cmd.exe - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x200
// read from block device

cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return

cmd.exe - ReadWriteDispatch: Read. Offset: (0, 32768), Len: 0x800
// read from block device

System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
// set Irp->IoStatus.Status = STATUS_SUCCESS and return

System - DevControlDispatch: IOCTL_DISK_IS_WRITABLE
// set Irp->IoStatus.Status = STATUS_MEDIA_WRITE_PROTECTED and return

System - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return

System - DevControlDispatch: IOCTL_DISK_GET_PARTITION_INFO
// set values for (PPARTITION_INFORMATION)
Irp->AssociatedIrp.SystemBuffer
and return

System - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x1000
// read from block device

System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
// set Irp->IoStatus.Status = STATUS_SUCCESS and return

There is no error if Irp->IoStatus.Status is set to STATUS_SUCCESS
for IOCTL_DISK_IS_WRITABLE control code. It looks like the system
requires write access to the device. Otherwise, access to the drive
will fail.
I know it’s hard to say what’s wrong without looking at the code.
But if someone is familiar with this problem, please give me some
suggestions. Thanks.

Chu Bun


You are currently subscribed to ntfsd as: xxxxx@powerquest.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

>I have a problem with my virtual disk driver. The driver creates

a read-only NTFS virtual disk from a partition on the disk. It
works fine on XP and Server2003 beta, but fails on 2K. Following
is a sequence of events when running a “dir” on the virtual disk

NTFS on Win2000 does NOT support read only partitions!!!

What I did was act as read/write, but throw the writes away in
the bit bucket. It isn’t the best depending on what layer you
are at because of caching, but you don’t have a lot of options.
You will end up with no data written to the partition backing file,
however, and that appears to be what you want.

One option might be to do a file system filter driver as well and
don’t allow opens for write.

Rick Cadruvi…

It is working as designed by Microsoft. Read-only NTFS is not supported
prior to XP.

----- Original Message -----
From: “ChuBun”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Monday, April 21, 2003 12:11 PM
Subject: [ntfsd] Problem with read-only virtual disk.

> Hello,
>
> I have a problem with my virtual disk driver. The driver creates
> a read-only NTFS virtual disk from a partition on the disk. It
> works fine on XP and Server2003 beta, but fails on 2K. Following
> is a sequence of events when running a “dir” on the virtual disk
>
> //// On test machine:
> c:\dir k:
> The media is write protected
>
> //// On debug machine:
> cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
> // set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return
>
> cmd.exe - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x200
> // read from block device
>
> cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
> // set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return
>
> cmd.exe - ReadWriteDispatch: Read. Offset: (0, 32768), Len: 0x800
> // read from block device
>
> System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
> // set Irp->IoStatus.Status = STATUS_SUCCESS and return
>
> System - DevControlDispatch: IOCTL_DISK_IS_WRITABLE
> // set Irp->IoStatus.Status = STATUS_MEDIA_WRITE_PROTECTED and return
>
> System - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
> // set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return
>
> System - DevControlDispatch: IOCTL_DISK_GET_PARTITION_INFO
> // set values for (PPARTITION_INFORMATION) Irp->AssociatedIrp.SystemBuffer
> and return
>
> System - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x1000
> // read from block device
>
> System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
> // set Irp->IoStatus.Status = STATUS_SUCCESS and return
>
>
> There is no error if Irp->IoStatus.Status is set to STATUS_SUCCESS
> for IOCTL_DISK_IS_WRITABLE control code. It looks like the system
> requires write access to the device. Otherwise, access to the drive
> will fail.
> I know it’s hard to say what’s wrong without looking at the code.
> But if someone is familiar with this problem, please give me some
> suggestions. Thanks.
>
> Chu Bun
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

> There is no error if Irp->IoStatus.Status is set to STATUS_SUCCESS

for IOCTL_DISK_IS_WRITABLE control code. It looks like the system
requires write access to the device. Otherwise, access to the drive
will fail.

Yes, pre-XP NTFS was always such.

Max

NTFS prior to XP, NTFS will not mount read-only volume. This is because
NTFS needs to update last access date and time. NTFS was modified in XP
to support read-only mounting…

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ChuBun
Sent: Monday, April 21, 2003 9:12 AM
To: File Systems Developers
Subject: [ntfsd] Problem with read-only virtual disk.

Hello,

I have a problem with my virtual disk driver. The driver creates
a read-only NTFS virtual disk from a partition on the disk. It
works fine on XP and Server2003 beta, but fails on 2K. Following
is a sequence of events when running a “dir” on the virtual disk

//// On test machine:
c:\dir k:
The media is write protected

//// On debug machine:
cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return

cmd.exe - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x200
// read from block device

cmd.exe - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return

cmd.exe - ReadWriteDispatch: Read. Offset: (0, 32768), Len: 0x800
// read from block device

System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
// set Irp->IoStatus.Status = STATUS_SUCCESS and return

System - DevControlDispatch: IOCTL_DISK_IS_WRITABLE
// set Irp->IoStatus.Status = STATUS_MEDIA_WRITE_PROTECTED and return

System - DevControlDispatch: IOCTL_DISK_GET_DRIVE_GEOMETRY
// set values for (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer and
return

System - DevControlDispatch: IOCTL_DISK_GET_PARTITION_INFO
// set values for (PPARTITION_INFORMATION)
Irp->AssociatedIrp.SystemBuffer
and return

System - ReadWriteDispatch: Read. Offset: (0, 0), Len: 0x1000
// read from block device

System - DevControlDispatch: IOCTL_DISK_MEDIA_REMOVAL
// set Irp->IoStatus.Status = STATUS_SUCCESS and return

There is no error if Irp->IoStatus.Status is set to STATUS_SUCCESS
for IOCTL_DISK_IS_WRITABLE control code. It looks like the system
requires write access to the device. Otherwise, access to the drive
will fail.
I know it’s hard to say what’s wrong without looking at the code.
But if someone is familiar with this problem, please give me some
suggestions. Thanks.

Chu Bun


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Rick,

What exactly you mean by “throw the writes away in the bit bucket”. Is it
something like not writing the data and returning success or writing the
data to some other place and when read comes for that location returning the
data you wrote at that place?

Avi

-----Original Message-----
From: xxxxx@rdperf.com [mailto:xxxxx@rdperf.com]
Sent: Monday, April 21, 2003 1:02 PM
To: File Systems Developers
Subject: [ntfsd] Re: Problem with read-only virtual disk.

I have a problem with my virtual disk driver. The driver creates
a read-only NTFS virtual disk from a partition on the disk. It
works fine on XP and Server2003 beta, but fails on 2K. Following
is a sequence of events when running a “dir” on the virtual disk

NTFS on Win2000 does NOT support read only partitions!!!

What I did was act as read/write, but throw the writes away in
the bit bucket. It isn’t the best depending on what layer you
are at because of caching, but you don’t have a lot of options.
You will end up with no data written to the partition backing file,
however, and that appears to be what you want.

One option might be to do a file system filter driver as well and
don’t allow opens for write.

Rick Cadruvi…


You are currently subscribed to ntfsd as: xxxxx@commvault.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Just succeed the write.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Avinash Kumar
Sent: Monday, April 21, 2003 12:54 PM
To: File Systems Developers
Subject: [ntfsd] Re: Problem with read-only virtual disk.

Hi Rick,

What exactly you mean by “throw the writes away in the bit bucket”. Is
it
something like not writing the data and returning success or writing the
data to some other place and when read comes for that location returning
the
data you wrote at that place?

Avi

-----Original Message-----
From: xxxxx@rdperf.com [mailto:xxxxx@rdperf.com]
Sent: Monday, April 21, 2003 1:02 PM
To: File Systems Developers
Subject: [ntfsd] Re: Problem with read-only virtual disk.

I have a problem with my virtual disk driver. The driver creates
a read-only NTFS virtual disk from a partition on the disk. It
works fine on XP and Server2003 beta, but fails on 2K. Following
is a sequence of events when running a “dir” on the virtual disk

NTFS on Win2000 does NOT support read only partitions!!!

What I did was act as read/write, but throw the writes away in
the bit bucket. It isn’t the best depending on what layer you
are at because of caching, but you don’t have a lot of options.
You will end up with no data written to the partition backing file,
however, and that appears to be what you want.

One option might be to do a file system filter driver as well and
don’t allow opens for write.

Rick Cadruvi…


You are currently subscribed to ntfsd as: xxxxx@commvault.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I tried to throw away the write requests, but once in a while,
get a bunch of failed assertions and debug checks with a message
read something like this
“NT marked volume as dirty. Vcb context: 0x???”.
Did you have this problem?

wrote in message news:xxxxx@ntfsd…
>
> >I have a problem with my virtual disk driver. The driver creates
> >a read-only NTFS virtual disk from a partition on the disk. It
> >works fine on XP and Server2003 beta, but fails on 2K. Following
> >is a sequence of events when running a “dir” on the virtual disk
>
> NTFS on Win2000 does NOT support read only partitions!!!
>
> What I did was act as read/write, but throw the writes away in
> the bit bucket. It isn’t the best depending on what layer you
> are at because of caching, but you don’t have a lot of options.
> You will end up with no data written to the partition backing file,
> however, and that appears to be what you want.
>
> One option might be to do a file system filter driver as well and
> don’t allow opens for write.
>
>
> Rick Cadruvi…
>
>
>

It is not an open-for-write issue. Even read-only opens update the last
access date and time.

Create a file on the hard disk and copy write blocks to this file with
an index and read them back when required.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ChuBun
Sent: Monday, April 21, 2003 1:36 PM
To: File Systems Developers
Subject: [ntfsd] Re: Problem with read-only virtual disk.

I tried to throw away the write requests, but once in a while,
get a bunch of failed assertions and debug checks with a message
read something like this
“NT marked volume as dirty. Vcb context: 0x???”.
Did you have this problem?

wrote in message news:xxxxx@ntfsd…
>
> >I have a problem with my virtual disk driver. The driver creates
> >a read-only NTFS virtual disk from a partition on the disk. It
> >works fine on XP and Server2003 beta, but fails on 2K. Following
> >is a sequence of events when running a “dir” on the virtual disk
>
> NTFS on Win2000 does NOT support read only partitions!!!
>
> What I did was act as read/write, but throw the writes away in
> the bit bucket. It isn’t the best depending on what layer you
> are at because of caching, but you don’t have a lot of options.
> You will end up with no data written to the partition backing file,
> however, and that appears to be what you want.
>
> One option might be to do a file system filter driver as well and
> don’t allow opens for write.
>
>
> Rick Cadruvi…
>
>
>


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com