New Volume - PowerShell


Overview

The New-Volume command in PowerShell creates a new logical disk volume on one or more physical disks. It allows administrators to partition and format storage devices to make them accessible for data storage and management. This command is commonly used when initializing new hard drives, expanding existing storage, or creating custom volume configurations.

Syntax

New-Volume -DriveLetter <drive_letter> -FileSystem <file_system> -Size <size_in_GB> [-Path <drive_path>] [-Force] [-NewFileSystemOnly] [-NoWait] [-WhatIf] [-Confirm] [-Debug]

Options/Flags

  • -DriveLetter: Specifies the drive letter to assign to the new volume.
  • -FileSystem: Specifies the file system to use for the new volume. Default: NTFS.
  • -Size: Specifies the size of the new volume in gigabytes (GB).
  • -Path: Specifies the path to the physical disk or partition where the new volume should be created.
  • -Force: Overwrites existing data on the target disk without prompting for confirmation.
  • -NewFileSystemOnly: Only creates a new file system on the specified disk without partitioning or formatting it.
  • -NoWait: Returns the volume object immediately without waiting for the operation to complete.
  • -WhatIf: Performs a simulation of the command without actually making any changes.
  • -Confirm: Prompts for confirmation before executing the command.
  • -Debug: Enables debug output for troubleshooting.

Examples

Creating a New NTFS Volume

New-Volume -DriveLetter D -FileSystem NTFS -Size 200

Creating a Volume on a Specific Disk

New-Volume -DriveLetter E -FileSystem FAT32 -Size 50 -Path \\.\PhysicalDrive1

Creating a Volume without Formatting

New-Volume -DriveLetter F -NewFileSystemOnly -Size 100

Common Issues

  • Insufficient space: Ensure that the target disk has enough unallocated space to create the new volume.
  • Permission denied: Make sure you have administrator privileges to create new volumes.
  • MBR partition limit: For disks using the Master Boot Record (MBR) partition table, you can only create up to four primary partitions.

Integration

New-Volume can be used in conjunction with other PowerShell commands for more complex storage management tasks. For example:

  • Get-Volume: Retrieves information about existing volumes.
  • Format-Volume: Formats a volume with a specific file system and parameters.
  • Resize-Volume: Adjusts the size of an existing volume.
  • Initialize-Disk: Prepares a physical disk for use by creating a partition table.
  • Format-Volume: Formats a volume with a specific file system.
  • Get-Disk: Retrieves information about physical disks.