community.windows.win_format (2.2.0) — module

Formats an existing volume or a new volume on an existing partition on Windows

Authors: Varun Chopra (@chopraaa) <v@chopraaa.com>

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

The M(community.windows.win_format) module formats an existing volume or a new volume on an existing partition on Windows

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a partition with drive letter D and size 5 GiB
  community.windows.win_partition:
    drive_letter: D
    partition_size: 5 GiB
    disk_number: 1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Full format the newly created partition as NTFS and label it
  community.windows.win_format:
    drive_letter: D
    file_system: NTFS
    new_label: Formatted
    full: True

Inputs

    
full:
    default: false
    description:
    - A full format writes to every sector of the disk, takes much longer to perform than
      the default (quick) format, and is not recommended on storage that is thinly provisioned.
    - Specify C(true) for full format.
    type: bool

path:
    description:
    - Used to specify the path to the volume to be formatted.
    type: str

force:
    default: false
    description:
    - Specify if formatting should be forced for volumes that are not created from new
      partitions or if the source and target file system are different.
    type: bool

label:
    description:
    - Used to specify the label of the volume to be formatted.
    type: str

compress:
    description:
    - Enable compression on the resulting NTFS volume.
    - NTFS compression is not supported where I(allocation_unit_size) is more than 4096.
    type: bool

large_frs:
    description:
    - Specifies that large File Record System (FRS) should be used.
    type: bool

new_label:
    description:
    - Used to specify the new file system label of the formatted volume.
    type: str

file_system:
    choices:
    - ntfs
    - refs
    - exfat
    - fat32
    - fat
    description:
    - Used to specify the file system to be used when formatting the target volume.
    type: str

drive_letter:
    description:
    - Used to specify the drive letter of the volume to be formatted.
    type: str

integrity_streams:
    description:
    - Enable integrity streams on the resulting ReFS volume.
    type: bool

allocation_unit_size:
    description:
    - Specifies the cluster size to use when formatting the volume.
    - If no cluster size is specified when you format a partition, defaults are selected
      based on the size of the partition.
    - This value must be a multiple of the physical sector size of the disk.
    type: int

See also