Disks: eMMC is one device, not three, and reports wear from its own registers
mmcblkNboot0/boot1/rpmb are hardware areas of the chip; hide them on Disks and Dashboard. Badge eMMC/SD instead of SSD. smartctl cannot talk to MMC, so read life_time and pre_eol_info from /sys instead of showing its error. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
488d929733
commit
232163ff4c
+8
-2
@@ -6,7 +6,7 @@ import { Btn, Loading, Spinner, toast } from './ui'
|
||||
import { useRefreshMs } from './prefs'
|
||||
|
||||
const pct = (v: number) => `${Math.round(v)}%`
|
||||
const KIND: Record<string, string> = { nvme: 'NVMe', ssd: 'SSD', hdd: 'HDD', usb: 'USB', other: 'disk' }
|
||||
const KIND: Record<string, string> = { nvme: 'NVMe', ssd: 'SSD', hdd: 'HDD', usb: 'USB', emmc: 'eMMC', sd: 'SD', other: 'disk' }
|
||||
const hours = (h: number) => (h >= 24 * 365 ? `${(h / 8760).toFixed(1)} y` : h >= 48 ? `${Math.round(h / 24)} d` : `${h} h`)
|
||||
const ago = (ms: number) => { const s = (Date.now() - ms) / 1000; return s < 3600 ? `${Math.round(s / 60)}m ago` : s < 86400 ? `${Math.round(s / 3600)}h ago` : `${Math.round(s / 86400)}d ago` }
|
||||
|
||||
@@ -26,7 +26,7 @@ function SmartPanel({ dev, rotational }: { dev: string; rotational: boolean }) {
|
||||
useEffect(() => { load() }, [load])
|
||||
|
||||
if (err) return <div className="error">{err}</div>
|
||||
if (!s) return <Loading label="Reading SMART…" />
|
||||
if (!s) return <Loading label="Reading health…" />
|
||||
if (!s.available) return <div className="notice">smartmontools isn't installed, so there's no SMART data. Install it from the button above.</div>
|
||||
if (s.standby) return <div className="notice">Disk is spun down; SMART wasn't read so it stays asleep. <Btn className="btn" onClick={() => load(true)}>Wake and read</Btn></div>
|
||||
if (s.error) return <div className="notice">{s.error}</div>
|
||||
@@ -43,6 +43,12 @@ function SmartPanel({ dev, rotational }: { dev: string; rotational: boolean }) {
|
||||
<div><span className="k">Read</span><span className="muted">{ago(s.fetched_at)} <button className="link" onClick={() => load(true)}>refresh</button></span></div>
|
||||
</div>
|
||||
{s.warnings.length > 0 && <div className="notice attn">{s.warnings.join(' · ')}</div>}
|
||||
{s.mmc && (
|
||||
<div className="props">
|
||||
<div><span className="k">Wear</span><span>{[['A', s.mmc.life_a], ['B', s.mmc.life_b]].filter(([, v]) => v).map(([k, v]) => `type ${k} ${v === 11 ? 'past rated life' : `${(v as number) * 10 - 10}–${(v as number) * 10}% used`}`).join(' · ') || 'not reported'}</span></div>
|
||||
<div><span className="k">Reserve</span><span>{['not reported', 'normal', 'warning — 80% of spare blocks used', 'urgent — 90% of spare blocks used'][s.mmc.pre_eol] ?? s.mmc.pre_eol}</span></div>
|
||||
</div>
|
||||
)}
|
||||
{s.nvme && (
|
||||
<div className="props">
|
||||
<div><span className="k">Endurance</span><span>{s.nvme.percentage_used}% used · spare {s.nvme.available_spare}% (threshold {s.nvme.spare_threshold}%)</span></div>
|
||||
|
||||
Reference in New Issue
Block a user