Skip to content

Instantly share code, notes, and snippets.

View Delnegend's full-sized avatar
🌙

Delnegend Delnegend

🌙
View GitHub Profile
@Delnegend
Delnegend / calculate-tbw.sh
Last active July 15, 2024 09:33
Calculate the TBR and TBW of an SSD, requires `smartmontools` to be installed.
#!/bin/bash
# Change this to the SSD you want to check
drive="/dev/sda"
# Extract the sector size and LBA written from the output
sector_size=$(sudo smartctl -Ai $drive | grep 'Sector Size' | awk '{print $3}')
lba_written=$(sudo smartctl -Ai $drive | grep 'Total_LBAs_Written' | awk '{print $10}')
lba_read=$(sudo smartctl -Ai $drive | grep 'Total_LBAs_Read' | awk '{print $10}')
# Calculate TBW and print the result
tb_write=$(echo "scale=2; $sector_size * $lba_written / 1024^4" | bc -l)
from dataclasses import dataclass
import argparse
import os, binascii
@dataclass
class AccessPoint:
name: str
mac_addr: str