Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Gigabytes to Bytes

Gigabytes to Bytes

Monitoring gauges and quota tools count in bytes. Turn a gigabyte threshold into the raw integer an alert expression, quota command or config value expects.

Why Monitoring Wants a Raw Byte Count

An exporter has no opinion about prefixes. node_filesystem_avail_bytes, container_memory_usage_bytes, the block counts behind a filesystem quota — each is a plain integer of bytes. The moment "alert when the data volume drops below 50 GB free" has to become something a rule file or a quota script can evaluate, that sentence needs rewriting as digits.

1 GB = 1 000 000 000 bytes — multiply by one billion. A 50 GB floor is 50 × 1 000 000 000 = 50 000 000 000, so the expression reads node_filesystem_avail_bytes{mountpoint="/data"} < 50000000000.

Gauges Ship in Base Units

Instrumentation convention says a metric ending in _bytes holds bytes and nothing else. Dashboards add a human-readable prefix at display time; the stored series stays raw.

One Zero Too Few Is an Incident

A threshold of 5 000 000 000 instead of 50 000 000 000 fires ten times too late — after the volume is already full. Long byte literals deserve a check, not a mental count of zeros.

The Same Figure Lands in Three Places

A capacity decision usually becomes an alert expression, a quota command and a runbook line. Converting once and pasting one integer keeps the three from drifting apart.

Getting a Paste-Ready Number for a Rule File

1

Enter the Threshold as a Human Would Say It

Type the gigabyte figure from the capacity ticket — 5, 20, 50, 250. Fractions work too: 2.5 GB parses with either a dot or a comma.

2

Read the Byte Count

The byte side updates live, with digits grouped so you can confirm the magnitude at a glance. From 10 GB upward the display switches to scientific notation, which PromQL happily accepts as 1e10.

3

Copy the Integer, Not the Formatting

The copy button returns the bare number with no unit and no grouping spaces — exactly what a YAML expression, a JSON value or a shell variable expects.

4

Read an Existing Gauge Backwards

Swap the direction, or simply type into the byte field, and a value scraped from a metrics endpoint comes back as gigabytes you can put in an incident note.

Both directions, one page: the fields are independent inputs, so nothing stops you pasting 17 179 869 184 from a dashboard into the byte side to find it is about 17.18 GB, then adjusting the gigabyte side until you have the round threshold you want to standardise on.

Threshold Table for Alert Rules and Quotas

These are the round gigabyte figures that keep reappearing in rule files and quota scripts. Free-space alerts are often written as a percentage, but an absolute byte floor is what stops a 20 TB array from paging only when 200 GB — an hour of ingest — is left.

ThresholdBytesWhere it usually lands
1 GB1 000 000 000Last-resort critical page on a small root volume
5 GB5 000 000 000Warning on a container host's overlay filesystem
10 GB10 000 000 000Free-space floor under a database data directory
20 GB20 000 000 000Hard limit on an individual home directory
50 GB50 000 000 000Per-project quota on a shared build server
100 GB100 000 000 000Headroom check run before a bulk restore
250 GB250 000 000 000Capacity-planning ceiling on an artifact volume

Output Shaped for an Expression

Copy gives the digits alone — nothing to strip, no suffix to confuse a parser that only wants a number on the right of a comparison.

Decode a Firing Alert

When a notification carries a raw gauge value, put it in the byte field and read the gigabytes back before writing the timeline entry.

Binary Units When the Tool Insists

Some subsystems count in 1 024-based units. Both dropdowns list GiB, MiB and KiB, so a mismatch is one selection away from resolved.

A Second Pair of Eyes on the Zeros

Grouped digits make 50 000 000 000 visibly different from 5 000 000 000 — the check a review of a long integer literal rarely catches.

Questions From the Alerting Rulebook

Why does node_filesystem_avail_bytes never report gigabytes?

Prometheus naming convention asks every metric to use base units and name them in the suffix, which keeps one series comparable across machines of very different sizes. Prefixes are a presentation concern applied at render time. Note also that the avail gauge excludes blocks reserved for root, so it is the one to alert on rather than node_filesystem_free_bytes.

Should a disk alert use a fixed byte floor or a percentage?

Percentages travel well across a fleet — 80% warning, 90% critical is the usual pairing — but 10% of a 4 TB volume is 400 GB, either wasteful or far too late depending on the write rate. Many teams run both: a percentage rule for drift and an absolute floor such as 50 000 000 000 bytes so the page arrives with predictable runway left.

Why do df and du disagree on the same filesystem?

du walks directory entries and adds up what it can see; df asks the filesystem how many blocks are allocated. A file deleted while a process still holds it open has left the tree but still occupies blocks, and reserved space plus metadata belong to df alone. A gap of several gigabytes is usually a held-open file, not a bug.

What unit do the quota tools expect when I set a limit?

Classic setquota takes block counts, and its block is 1 KiB — so a 50 GB soft limit is 50 000 000 000 ÷ 1 024 = 48 828 125 blocks. Other stacks accept a suffix instead. Converting to bytes first gives one authoritative figure to divide down for whichever tool you are driving, rather than three approximations.

Can I just write "50GB" in the YAML and let it sort itself out?

Only where the consuming program documents a suffix parser, and those rarely agree — some read G as a billion, others as 230, and a PromQL comparison accepts no suffix at all. In a plain JSON or YAML value it is just a string, and a strict schema will reject it. An explicit integer with a comment naming the gigabyte figure never surprises anyone.

GB
B

Thresholds Used in Rule Files

1 GB=1,000,000,000 B
5 GB=5,000,000,000 B
10 GB=10,000,000,000 B
20 GB=20,000,000,000 B
50 GB=50,000,000,000 B
100 GB=100,000,000,000 B

Gigabyte (GB)

The unit a capacity ticket is written in. Convenient for humans, but no rule engine compares against it — the threshold has to reach the rule file as digits.

Byte (B)

The base unit every _bytes gauge and quota block count is built on. One gigabyte is 1 000 000 000 of them, and a single missing zero moves an alert by a factor of ten.

Copy from the byte field to get the bare integer — no unit, no grouping spaces to strip
From 10 GB upward the display uses scientific notation, which PromQL accepts as 1e10
Paste a gauge value into the byte field to read a firing alert back in gigabytes
Switch either dropdown to GiB when a subsystem counts in 1 024-based units
Want to learn more? Read documentation →
1/5
Start typing to search...
Searching...
No results found
Try searching with different keywords