IVdsAdvancedDisk::Clean method

[Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage Management API.]

Removes partition information and uninitializes basic or dynamic disks.

Windows Server 2003:  The Clean method is not supported for removable devices.


  BOOL      bForce,
  BOOL      bForceOEM,
  BOOL      bFullClean,
  IVdsAsync **ppAsync



If TRUE, cleans a disk containing data volumes or ESP partitions.


If TRUE, cleans a MBR-based disk containing the known OEM partitions in the following table or cleans a GPT-based disk containing any OEM partition. An OEM partition has the GPT_ATTRIBUTE_PLATFORM_REQUIRED flag set on a GPT-based disk.

Partition type Description
0x12 An EISA partition.
0x84 A hibernation partition for laptops.
0xA0 A diagnostic partition for some HP laptops.
0xDE A partition defined by Dell.
0xFE An IBM IML partition.


If TRUE, cleans the entire disk by replacing the data on each sector with zeros; otherwise, this method cleans only the first and the last megabytes on the disk.


The address of a pointer to the IVdsAsync interface pointer, which VDS initializes on return. Callers must release the interface. Use this pointer to cancel, wait for, or query the status of the operation.

Return Value

This method can return standard HRESULT values, such as E_INVALIDARG or E_OUTOFMEMORY, and VDS-specific return values. It can also return converted system error codes using the HRESULT_FROM_WIN32 macro. Errors can originate from VDS itself or from the underlying VDS provider that is being used. Possible return values include the following.

Return code/value Description
The data was removed successfully and the disk was uninitialized.
There is no media in the removable device.
The disk is missing.
The operation failed under one of the following conditions:
  • The disk contains an OEM partition and bForceOEM is false.
  • The disk contains a volume or ESP partition and bForce is FALSE.
  • The disk contains one of the system volumes regardless of whether bForce is TRUE or FALSE. A system volume can be any of the following items:
    • A volume containing the operating system loader.
    • A boot volume, which contains the system32 directory.
    • A volume containing the pagefile or hibernation file, or a volume used as a crash dump.
    • An ESP partition (the partition from which the system boots).
The partition table is cleaned, but not all sectors are cleaned during a full clean. Alternatively, some sectors of the first megabyte and the last megabyte are cleaned; however, unless the clean is a full clean, the remaining sectors are not cleaned.


Before calling this method, the caller should dismount any mounted volumes on the disk by calling IVdsVolumeMF::Dismount for each volume.

Use the bForce parameter, the bForceOEM parameter, or both with this method unless you first delete all data volumes, known OEM partitions, and ESP partitions on the disk. This requirement excludes metadata partitions such as the MSR, the LDM metadata partition, and unknown OEM partitions.

Windows Server 2003:  The Clean method is not supported for removable devices.

Implementers must return a pointer to the IVdsAsync interface for this method, regardless of whether the call initiates an asynchronous operation.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header vds.h
Library Uuid.lib

See Also

Disk Object