A disk monitoring utility for Windows.
-
Make sure you have Go installed (version 1.18 or higher)
-
Create a new directory for the project:
mkdir disk-monitor
cd disk-monitor- Initialize a Go module:
go mod init disk-monitor- Install dependencies:
go get github.com/gizak/termui/v3-
Save the code from the first artifact into a file called main.go
-
Build the program:
go build -o disk-monitor.exe main.goJust run the program without any arguments:
disk-monitor.exeThe program will:
- Scan all available drives
- Show info for each drive (total size, free space, used space)
- Save the data to disk_monitor_history.json in the user's home folder
- Append new entries to that file every time you run it
To display a graph of free space over time, use the -graph flag:
disk-monitor.exe -graphThe graph shows:
- Different colored lines for each drive
- Free space in gigabytes on the Y axis
- Measurement numbers on the X axis
- Dates and times of each measurement at the bottom
- A legend with color coding for the drives
Press any key to exit graph mode.
You can set up automatic runs using Windows Task Scheduler:
- Open Task Scheduler
- Create a new task
- Set up a trigger (e.g. daily or at logon)
- In Actions, point it to
disk-monitor.exe
Data is stored in JSON format at %USERPROFILE%\disk_monitor_history.json:
{
"snapshots": [
{
"timestamp": "2024-01-15T10:30:00Z",
"disks": [
{
"drive": "C:\\",
"total_space": 500000000000,
"free_space": 150000000000,
"used_space": 350000000000
}
]
}
]
}- The program uses Windows API to get disk info, so it only works on Windows
- The graph looks best in terminals that support Unicode and colors (Windows Terminal, ConEmu, etc.)
- If your terminal doesn’t support fancy rendering, the graph might look messed up

