Anders Tall

Windows, end to end: NTFS, grow, shrink, compress

4 min read

NTFS is the filesystem you meet on every Windows machine, and it’s the counter-example to ext4 and XFS: it grows and shrinks online, compresses per file, and has its own scanner. The videos were recorded on Windows Server 2025 (Server Core) over OpenSSH, with the same terminal, theme and keysound as the rest; this page explains why the commands work.

The model has three views, and PowerShell names them directly:

disk      Get-Disk
  └── partition   Get-Partition
        └── volume      Get-Volume

Create it

On a blank 2 GB disk (disk 1):

Get-Disk
Initialize-Disk 1 -PartitionStyle GPT
New-Partition 1 -Size 1GB -DriveLetter F
Format-Volume F -FileSystem NTFS -NewFileSystemLabel data -Force

Initialize-Disk writes the partition table and creates the MSR (16 MB); New-Partition creates the data partition, and Format-Volume writes NTFS. Then the usual proof:

Set-Content -Path F:\hello.txt -Value 'hello from ntfs'
Get-Content F:\hello.txt
Get-Partition 1 | Format-Table PartitionNumber,DriveLetter,Type,Size

Watch on YouTube →

Grow it

NTFS grows online, and the size comes from the partition, so ask Windows what the maximum is instead of guessing:

$max = (Get-PartitionSupportedSize -DriveLetter F).SizeMax
Resize-Partition -DriveLetter F -Size $max

On the 2 GB disk that takes the 1 GB volume to 1.98 GB, mounted, with the file still readable. The remaining ~20 MB is the MSR partition (16 MB) plus GPT metadata and alignment.

Watch on YouTube →

Shrink it

This is where NTFS differs most from the Linux filesystems. The same cmdlet, the other way:

(Get-PartitionSupportedSize -DriveLetter F).SizeMin   # how far it can shrink
Resize-Partition -DriveLetter F -Size 1GB

NTFS shrinks online, while mounted. Two caveats:

NTFS, Btrfs and APFS shrink online; ext4 shrinks offline; XFS can’t, and ZFS only via zpool remove.

Watch on YouTube →

Compress it

NTFS compresses per file or folder (new files inherit the folder’s setting), while the volume stays mounted. A volume can default to compression, but it is still applied file by file. Write ~20 MB of repeated text, then compress it:

1..90000 | ForEach-Object { 'hello ntfs ' * 20 } | Set-Content F:\text.txt
(Get-Item F:\text.txt).Length
compact /c F:\text.txt
compact /q F:\text.txt
(Get-Item F:\text.txt).Attributes

In the lab: 19,980,000 bytes stored in 2,498,560 bytes — 8.0 to 1 — and the attributes report Archive, Compressed. The free space goes back up by roughly the difference: compact /c rewrites the file compressed, and in a compressed folder new files are compressed as they are written.

compact /q is the query; compact /c the compression; compact /u undoes it. For a whole directory, compact /c /s:F:\folder. The trade-off is the same as everywhere: CPU on read and write for space.

Watch on YouTube →

Check it

NTFS has an online scanner and the classic chkdsk:

Repair-Volume -DriveLetter F -Scan
chkdsk F:
Repair-Volume -DriveLetter F -OfflineScanAndFix

Repair-Volume is the modern cmdlet; chkdsk /f is still the tool for a volume that will not mount.

Watch on YouTube →

NTFS or ReFS?

ReFS is the newer Windows filesystem, built for integrity streams and large volumes (Hyper-V, backup targets). It is not a drop-in replacement for NTFS:

For a homelab Windows VM, NTFS is the right default; ReFS is a choice for data volumes where integrity matters more than flexibility.

What to remember

Part of Filesystems, end to end.

#windows #ntfs #powershell #filesystem #storage #server #homelab #devops