Inventory drives by interface and project when storage runs out
Task
Inventory the drives in your lab by interface, type and capacity, read the health counters that matter for each, and then do the capacity arithmetic a server purchase depends on: usable space after RAID, and how many months until it is full at the current growth rate.
Steps
- Save
lsblk -d -o NAME,SIZE,ROTA,TRAN,MODELtolab/drives/lsblk.txt(on Windows,Get-PhysicalDisk | Format-Listinstead). - For each drive, save
smartctl -aoutput tolab/drives/smart-<name>.txt. - Record each drive in
lab/drives/inventory.csvwith headername,interface,type,capacity_gb,power_on_hours,health_counter, wheretypeis HDD or SSD andhealth_counteris reallocated sectors for a hard drive or percentage used for an SSD. - Plan a file server: eight 4 TB drives in RAID 6 holding 9 TB today and growing 250 GB a month. Record in
lab/drives/plan.txtthe linesusable_tb: <n>,free_tb: <n>andmonths_to_full: <n>. - Repeat the plan for RAID 10 with the same drives and add
raid10_months_to_full: <n>to the file.
Verify
These checks run in a POSIX shell: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. A stock Windows PowerShell or Command Prompt has no awk or grep, so there the first line fails.
grep -Eic 'sata|nvme|sas|usb' lab/drives/lsblk.txt
ls lab/drives/smart-*.txt | wc -l
awk -F, 'NR>1 && ($3=="HDD" || $3=="SSD") {n++} END {print n" drive(s) typed"}' lab/drives/inventory.csv
grep -E '^usable_tb: 24' lab/drives/plan.txt
grep -E '^months_to_full: (5[89]|60|61)' lab/drives/plan.txt
Eight 4 TB drives in RAID 6 give six drives of data, 24 TB. With 9 TB used, 15 TB is free, and at 250 GB a month that lasts about 60 months. RAID 10 gives only 16 TB usable, so the same growth fills it in about 28 months -- the price of its better write performance and rebuild speed.
Notes
Vendors sell drives in decimal terabytes and operating systems report binary tebibytes, so a 4 TB drive shows as about 3.6 TiB. Real plans also keep 15 to 20 per cent free, which shortens both answers.
This is an independent study companion for CompTIA Server+ SK0-005 and is not produced by or endorsed by CompTIA.