1. Disks and volumes #
Preparing a disk.
Initialize, partition, format #
A new disk is initialized as GPT (recommended, required beyond 2 TB and for UEFI) or MBR (legacy). Partitions are created, formatted with a file system and mounted on a letter or folder.
Get-Disk | Format-Table Number, FriendlyName, Size, PartitionStyle, OperationalStatus
Initialize-Disk -Number 1 -PartitionStyle GPT
New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter D |
Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -AllocationUnitSize 4096 -Confirm:$false
Get-Volume ; Get-PSDrive -PSProvider FileSystem
Resize-Partition -DriveLetter D -Size (Get-PartitionSupportedSize -DriveLetter D).SizeMax # étendre après agrandissement du disquediskpart
DISKPART> list disk
DISKPART> select disk 1
DISKPART> clean # efface la table de partitions : vérifiez le numéro !
DISKPART> convert gpt
DISKPART> create partition primary
DISKPART> format fs=ntfs quick label=Data
DISKPART> assign letter=DCommon mistake: RunningcleanorClear-Diskon the wrong disk. Check the number withGet-Disk(size, model, serial number) right before; a system or data disk is not recoverable afterwards.
NTFS or ReFS? #
| Criterion | NTFS | ReFS |
|---|---|---|
| Use | system, files, general purpose | Hyper-V, Storage Spaces Direct, backups, large volumes |
| Windows boot | yes | no |
| Integrity | journaling, chkdsk | checksums, automatic repair with mirror |
| Features | quotas, compression, EFS, deduplication | block cloning (fast VHDX), deduplication |
2. Redundancy: Storage Spaces and RAID #
Protecting data against a disk failure.
Storage Spaces #
Storage Spaces is Windows’ modern software RAID. Disks form a pool; virtual disks are created in it with a chosen resiliency. The old “dynamic disks” (mirror, RAID 5 in Disk Management) are deprecated in favor of Storage Spaces.
| Resiliency | RAID equivalent | Min. disks | Usable capacity | Failures tolerated |
|---|---|---|---|---|
| Simple | RAID 0 | 1 | 100 % | 0 |
| Two-way mirror | RAID 1 / 10 | 2 | 50 % | 1 |
| Three-way mirror | 3-copy RAID 1 | 5 | 33 % | 2 |
| Parity | RAID 5 | 3 | ≈ (N−1)/N | 1 |
| Dual parity | RAID 6 | 7 | ≈ (N−2)/N | 2 |
Get-PhysicalDisk -CanPool $true
New-StoragePool -FriendlyName Pool1 -StorageSubSystemFriendlyName 'Windows Storage*' -PhysicalDisks (Get-PhysicalDisk -CanPool $true)
New-VirtualDisk -StoragePoolFriendlyName Pool1 -FriendlyName Miroir -ResiliencySettingName Mirror -NumberOfDataCopies 2 -UseMaximumSize -ProvisioningType Fixed
Get-VirtualDisk Miroir | Get-Disk | Initialize-Disk -PartitionStyle GPT -PassThru |
New-Partition -UseMaximumSize -DriveLetter E | Format-Volume -FileSystem ReFS -NewFileSystemLabel Miroir
Get-StoragePool Pool1 | Get-PhysicalDisk | Select-Object FriendlyName, HealthStatus, Usage
Repair-VirtualDisk -FriendlyName Miroir # après remplacement d'un disqueGood to know: Parity has heavy write penalties: keep it for archives and backups, and use mirror for virtual machines and databases. RAID level principles are detailed in the Linux course. Storage Spaces Direct (Datacenter edition) extends this model to several clustered servers (hyperconvergence).
Hardware RAID #
A hardware RAID controller presents Windows a single, already redundant disk; it is managed with the vendor’s tool (iDRAC, iLO, MegaRAID). Do not combine hardware RAID and Storage Spaces on the same disks: Storage Spaces wants disks presented as is (HBA or JBOD mode).
3. Protecting and optimizing data #
Snapshots, quotas, deduplication.
Shadow copies, quotas and deduplication #
# Clichés instantanés (VSS) : versions précédentes des fichiers d'un partage
vssadmin add shadowstorage /for=D: /on=D: /maxsize=10%
vssadmin create shadow /for=D: # sur un serveur ; planifiez-les deux fois par jour
vssadmin list shadows
# Quotas et filtrage de fichiers (rôle FSRM)
Install-WindowsFeature FS-Resource-Manager -IncludeManagementTools
New-FsrmQuota -Path D:\Data\Users -Size 20GB -Description 'Dossiers personnels'
# Déduplication des données (fichiers, VDI, sauvegardes)
Install-WindowsFeature FS-Data-Deduplication
Enable-DedupVolume -Volume D: -UsageType Default ; Get-DedupStatusCommon mistake: Treating shadow copies or RAID as a backup. They are on the same server, often on the same volume: ransomware, a controller failure or a fire takes them away. See backup, Hyper-V and troubleshooting.
Commands to know #
| Action | Command |
|---|---|
| List disks | Get-Disk |
| Initialize as GPT | Initialize-Disk -Number 1 -PartitionStyle GPT |
| Create and format a volume | New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem NTFS |
| Extend a volume | Resize-Partition -DriveLetter D -Size 200GB |
| Create a pool | New-StoragePool -FriendlyName Pool1 -StorageSubSystemFriendlyName 'Windows Storage*' -PhysicalDisks (Get-PhysicalDisk -CanPool $true) |
| Virtual disk health | Get-VirtualDisk | Select-Object FriendlyName, ResiliencySettingName, HealthStatus |
| Check a volume | Repair-Volume -DriveLetter D -Scan |
| Free space | Get-Volume | Select-Object DriveLetter, SizeRemaining, Size |
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Group Policy (GPO): configuring the estate from Active Directory
Design and troubleshoot Group Policy: computer and user configuration, OU linking, LSDOU order, i...
Services, scheduled tasks, event logs and performance
Control Windows services and their recovery, automate with Task Scheduler, use event logs with Ge...
Azure storage: storage accounts, Blob, Files, disks and redundancy
Store data on Azure: storage accounts, Blob (hot, cool, archive tiers, lifecycle), Files, Queue a...
Linux administration best practices
Checklist for administering Linux servers: accounts and sudo, SSH, updates, systemd services, sto...
Backup, monitoring and troubleshooting of a Linux server
Operate a Linux server day to day: 3-2-1 backup strategy with rsync, tar, LVM snapshots and resti...
Processes, memory and performance: monitoring and troubleshooting a Linux server
Understand and control Linux processes (ps, top, signals, nice, jobs), interpret load, memory and...
Linux server security and hardening
Harden a Linux server: least privilege, updates, secure SSH, firewall, fail2ban, SELinux and AppA...
Google Cloud storage: Cloud Storage, persistent disks and Filestore
Store data on Google Cloud: Cloud Storage (classes, regional, dual-region and multi-region locati...
Networking on Linux: configuration, diagnosis, firewall and SSH
Configure and troubleshoot Linux networking: ip, ss, netplan and NetworkManager, DNS, layered dia...