IOCTL_VOLUME_OFFLINE - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntddvol.h

// CTL_CODE(0x0056, 0x003, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_VOLUME_OFFLINE 0x0056C00C
View the official Windows Driver Kit DDI reference
// winioctl.h

// CTL_CODE(0x0056, 0x003, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_VOLUME_OFFLINE 0x0056C00C
View the official Win32 API reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ni-ntddvol-ioctl_volume_offline)

IOCTL_VOLUME_OFFLINE IOCTL

Description

The IOCTL_VOLUME_OFFLINE IOCTL puts the volume in an OFFLINE state, which is a state where read and write operations will fail. The requests will not be passed down to the physical disk until a subsequent IOCTL_VOLUME_ONLINE is received.

A common use for IOCTL_VOLUME_OFFLINE is a case in which one application or driver wants to prevent a volume from being remounted by a call to open the volume from a second application or driver while the volume is in the process of being removed by the first application or driver. For example, before masking a Logical Unit Number (LUN), the volumes on the LUN should be locked (optional), dismounted, taken offline, and uninstalled. Now the LUN can be masked without causing Plug and Play (PnP) surprise removal events to be logged for the volumes and the disk itself. Without the call to take the volume offline, after the handle that is used to dismount it is closed, the volume can then be remounted by a call to open it from another application or driver, if it occurred before the call to uninstall the volume. A call to open a volume succeeds on an offline volume, but I/O directed toward an offline volume fails. Taking a volume offline has no effect on disk I/O (if the application or driver opened a handle to the disk), but stops volume I/O (if the application or driver opened a handle to the volume).

Parameters

Major code

Input buffer

None.

Input buffer length

None.

Output buffer

None.

Output buffer length

None.

Input/output buffer

Input/output buffer length

Status block

The Status member is set to STATUS_SUCCESS.

See also

IOCTL_VOLUME_ONLINE


Win32 API reference (ni-winioctl-ioctl_volume_offline)

IOCTL_VOLUME_OFFLINE IOCTL

Description

Takes a volume offline.

Windows Server 2003 and Windows XP: This control code is not supported for dynamic disks.

To perform this operation, call the DeviceIoControl function with the following parameters.

BOOL DeviceIoControl(
  (HANDLE) hDevice,             // handle to device
  IOCTL_VOLUME_OFFLINE,         // dwIoControlCode
  NULL,                         // lpInBuffer
  0,                            // nInBufferSize
  NULL,                         // lpOutBuffer
  0,                            // nOutBufferSize
  (LPDWORD) lpBytesReturned,    // number of bytes returned
  (LPOVERLAPPED) lpOverlapped   // OVERLAPPED structure
);

Parameters

Input buffer

Input buffer length

Output buffer

Output buffer length

Input/output buffer

Input/output buffer length

Status block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.

Otherwise, Status to the appropriate error condition as a NTSTATUS code.

For more information, see NTSTATUS Values.

Remarks

Applications must first successfully dismount the file system - via FSCTL_DISMOUNT_VOLUME - before using IOCTL_VOLUME_OFFLINE.

When a volume that is online is dismounted, the next call to open the volume causes it to be mounted. Taking the volume offline using the same volume handle as was used for the dismount prevents the dismounted volume from being mounted again.

When a volume is online, all requests sent to the volume are honored.

When a volume that is online is dismounted, the next call to open the volume causes it to be mounted. Taking the volume offline prevents the dismounted volume from being mounted again.

To bring a volume online, use the IOCTL_VOLUME_ONLINE control code.

In Windows 8 and Windows Server 2012, this code is supported by the following technologies.

Technology Supported
Server Message Block (SMB) 3.0 protocol No
SMB 3.0 Transparent Failover (TFO) No
SMB 3.0 with Scale-out File Shares (SO) No
Cluster Shared Volume File System (CsvFS) No

See also