LSBLK(8)

okay so this is lsblk(8) from the System Administration section, and bestie, we're about to list some block devices ๐Ÿ’…

๐ŸŒธ NAME ๐ŸŒธ

lsblk โ€” list block devices โœจ

๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

lsblk [options] [device...]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

lsblk lists info about all available block devices, or just the ones you specify. It gets its tea from the sysfs filesystem and the udev db. But if the udev db isn't available, or if lsblk was compiled without udev support, it tries to read LABELs, UUIDs, and filesystem types straight from the block device. And in that case? root permissions are necessary, no cap.

By default, the command prints all block devices (except RAM disks) in a tree-like format. The same device can show up multiple times in the tree if it relates to other devices. For more complicated setups, the --merge option is recommended to gather groups of devices and describe complex N:M relationships.

The tree-like output (or the children[] array in the JSON output) is only enabled if the NAME column is present in the output, or when the --tree command line option is used. See also --nodeps and --list to control the tree formatting.

The default output, as well as the default output from options like --fs and --topology, is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list and --list in environments where a stable output is required.

bestie, do NOT rely on default outputs in scripts, periodt. Lock in your columns. ๐Ÿ’…

Use lsblk --list-columns to get a list of all available columns. Obsessed with how easy that is.

Note that lsblk might be executed at a time when udev does not have all information about recently added or modified devices yet. In this case it is recommended to use udevadm settle before lsblk to synchronize with udev. Like, give udev a sec to catch up, fr fr.

The relationship between block devices and filesystems is not always one-to-one. The filesystem may use more block devices, or the same filesystem may be accessible by more paths. This is the reason why lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column MOUNTPOINT displays only one mount point (usually the last mounted instance of the filesystem), and the column MOUNTPOINTS displays by multi-line cell all mount points associated with the device. It's giving thorough. ๐Ÿฆ‹

๐Ÿ’– OPTIONS ๐Ÿ’–

Bestie, welcome to the wardrobe. Every single flag below is a fit, and lsblk is about to serve looks. No cap, you can mix and match. Let's go.

  • -A, --noempty โ€” Don't print empty devices. That's it. Ghost devices get no screen time. ๐Ÿ’…
  • -a, --all โ€” Turn off all the built-in filters and list all empty devices plus RAM disk devices too. The full chaos menu. โœจ
  • -b, --bytes โ€” Print sizes in bytes instead of human-readable form. By default sizes use units that are powers of 1024 bytes, and the formal abbreviations (KiB, MiB, GiB, ...) get shortened to just their first letter: K, M, G, .... So yes, bytes mode is the raw-number vibe. ๐Ÿ”ข
  • -H, --list-columns โ€” List the columns you can specify with --output. You can pair it with --json or --raw to get that list in a machine-readable format. Very demure, very parseable. ๐ŸŽ€
  • -D, --discard โ€” Print info about the discarding capabilities (TRIM, UNMAP) for each device. Spring cleaning data, literally. ๐Ÿงน
  • -d, --nodeps โ€” Do not print holder devices or slaves. For example, lsblk --nodeps /dev/sda prints info about the sda device only. No entourage. ๐Ÿ™ˆ
  • -E, --dedup column โ€” Use column as a de-duplication key to de-duplicate the output tree. If the key is not available for the device, or the device is a partition and the parental whole-disk device provides the same key, then the device is always printed. The usual use case is de-duplicating output on system multi-path devices, for example by -E WWN. One icon, one line, no duplicates. ๐Ÿ‘‘
  • -e, --exclude list โ€” Exclude devices specified by the comma-separated list of major device numbers. Note that RAM disks (major=1) are excluded by default if --all is not specified. The filter is applied to the top-level devices only. This may be confusing for --list output format where hierarchy of the devices is not obvious. So yeah, read the fine print, bestie. ๐Ÿ’€
  • -f, --fs โ€” Output info about filesystems. This option is equivalent to -o NAME,FSTYPE,FSVER,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINTS. The authoritative information about filesystems and raids is provided by the blkid(8) command. Periodt. ๐Ÿ’–
  • --hyperlink[=when] โ€” Print paths as terminal hyperlinks. The optional when argument can be always, never, or auto. If the argument is omitted, it defaults to auto, which means that hyperlinks will only be used when the output goes to a terminal. Cute link energy only when it makes sense. ๐Ÿ”—
  • -I, --include list โ€” Include devices specified by the comma-separated list of major device numbers. The filter is applied to the top-level devices only. This may be confusing for --list output format where hierarchy of the devices is not obvious. Same warning as exclude, so don't act surprised. ๐Ÿ˜ญ
  • -i, --ascii โ€” Use ASCII characters for tree formatting. For when emoji branches are too much (never, but okay). ๐ŸŒˆ
  • -J, --json โ€” Use JSON output format. It's strongly recommended to use --output and also --tree if necessary. Note that children[] is used only if NAME column or --tree is used. JSON girlies, this is your moment. โœจ
  • -l, --list โ€” Produce output in the form of a list. The output does not provide information about relationships between devices, and since version 2.34 every device is printed only once if --pairs or --raw not specified (the parsable outputs are maintained in backwardly compatible way). Flat and unbothered. ๐Ÿ’…
  • -M, --merge โ€” Group parents of sub-trees to provide more readable output for RAIDs and Multi-path devices. The tree-like output is required. It's giving family reunion, but organized. ๐Ÿซถ
  • -m, --perms โ€” Output info about device owner, group and mode. This option is equivalent to -o NAME,SIZE,OWNER,GROUP,MODE. Permission slip: signed. ๐Ÿ“
  • -N, --nvme โ€” Output info about NVMe devices only. NVMe besties, this one's for you. ๐Ÿ”ฅ
  • -v, --virtio โ€” Output info about virtio devices only. Virtual girlies, rise. ๐Ÿฆ‹
  • -n, --noheadings โ€” Do not print a header line. Minimalist. Clean. No labels. โญ
  • -o, --output list โ€” Specify which output columns to print. Use --list-columns to get a list of all supported columns. The columns may affect tree-like output. The default is to use tree for the column NAME (see also --tree). The default list of columns may be extended if list is specified in the format +list (e.g., lsblk -o +UUID). Customize your feed, bestie. ๐ŸŽ€
  • -O, --output-all โ€” Output all available columns. The whole spreadsheet, the entire lore. ๐Ÿ‘‘
  • -P, --pairs โ€” Produce output in the form of key="value" pairs. The output lines are still ordered by dependencies. All potentially unsafe value characters are hex-escaped (\x<code>). See also option --shell. Very key-value core. ๐Ÿ”‘
  • -p, --paths โ€” Print full device paths. No shorthand, just the whole address. ๐Ÿ 
  • -Q, --filter expression โ€” Print only the devices that meet the conditions specified by expression. The filter is assessed prior to lsblk collecting data for all output columns. Only the necessary data for the lazy evaluation of the expression is retrieved from the system. This approach can enhance performance when compared to post-filtering, as commonly done by tools such as grep(1). This feature is EXPERIMENTAL. See also scols-filter(5). For example, to exclude sda and sdb, but print everything else (!~ is a negative regular-expression matching operator):
lsblk --filter 'NAME !~ "sd[ab]"'
  • --highlight expression โ€” Colorize lines matching expression. This feature is EXPERIMENTAL. See also scols-filter(5). Highlight reel, but make it terminal. ๐ŸŒˆ
  • --ct name[:parameter[:function]] โ€” Define a custom counter. Custom counters are printed after the standard output. The name is the custom name of the counter, the optional parameter is the name of the column to be used for the counter, and the optional function specifies the aggregation function. Supported functions are: count, min, max, sum. The default function is count. If parameter is not specified, then the counter counts the number of lines. This feature is EXPERIMENTAL. See also --ct-filter. For example, --ct MyCounter:SIZE:sum reports the total of the SIZE values. To report the number of SATA disks, one can use:
lsblk --ct-filter 'TYPE=="disk" && TRAN=="sata"' \
      --ct "Number of SATA devices"
  • --ct-filter expression โ€” Define a restriction for the next counter. This feature is EXPERIMENTAL. See also --ct and scols-filter(5). For example, to aggregate sizes by device type:
lsblk --ct-filter 'TYPE=="part"' --ct Partitions:SIZE:sum \
      --ct-filter 'TYPE=="disk"' --ct WholeDisks:SIZE:sum
  • -r, --raw โ€” Produce output in raw format. The output lines are still ordered by dependencies. All potentially unsafe characters are hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns. Raw and unfiltered, but safe-ish. ๐Ÿ’€
  • -S, --scsi โ€” Output info about SCSI devices only. All partitions, slaves and holder devices are ignored. SCSI only, no plus-ones. ๐Ÿ’…
  • -s, --inverse โ€” Print dependencies in inverse order. If the --list output is requested then the lines are still ordered by dependencies. Flip the script, but keep the order. ๐Ÿ”„
  • -T, --tree[=column] โ€” Force tree-like output format. If column is specified, then a tree is printed in the column. The default is NAME column. Tree mode: activated. ๐ŸŒณ
  • -t, --topology โ€” Output info about block-device topology. This option is equivalent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME. Topology tea, served. ๐Ÿ“
  • -w, --width number โ€” Specifies output width as a number of characters. The default is the number of the terminal columns, and if not executed on a terminal, then output width is not restricted at all by default. This option also forces lsblk to assume that terminal control characters and unsafe characters are not allowed. The expected use-case is for example when lsblk is used by the watch(1) command. Width control, because sometimes the terminal is messy. ๐Ÿ“
  • -x, --sort column โ€” Sort output lines by column. This option enables --list output format by default. It is possible to use the option --tree to force tree-like output and then the tree branches are sorted by the column. Sort it out, literally. ๐Ÿ”ค
  • -y, --shell โ€” The column name will be modified to contain only characters allowed for shell variable identifiers, for example, MIN_IO and FSUSE_PCT instead of MIN-IO and FSUSE%. This is usable, for example, with --pairs. Note that this feature has been automatically enabled for --pairs in version 2.37, but due to compatibility issues, now it's necessary to request this behavior by --shell. Shell-safe names, because variables can't have dashes and percent signs. ๐Ÿš
  • -z, --zoned โ€” Print the zone related information for each device. Zoned out, in the cool way. ๐ŸŒŒ
  • --sysroot directory โ€” Gather data for a Linux instance other than the instance from which the lsblk command is issued. The specified directory is the system root of the Linux instance to be inspected. The real device nodes in the target directory can be replaced by text files with udev attributes. Peek into another system, respectfully. ๐Ÿ‘€
  • --properties-by list โ€” This option specifies the methods used by lsblk to gather information about filesystems and partition tables. The list is a comma-separated list of method names. The default setting is "file,udev,blkid". The supported methods are:
    • udev โ€” Reads data from udev DB. If unsuccessful, it continues to the next probing method.
    • blkid โ€” Reads data directly from the device using libblkid. If unsuccessful, it continues to the next probing method.
    • file โ€” Reads data from a file. This method is only used if the --sysroot option is specified. This method always stops probing if used.
    • none โ€” Does not probe. This method always stops probing.
  • -h, --help โ€” Display help text and exit. The classic "help me bestie" button. ๐Ÿ†˜
  • -V, --version โ€” Display version and exit. Version check, periodt. ๐Ÿ’–

๐Ÿšช EXIT STATUS ๐Ÿšช

When lsblk leaves the chat, it tells you how it went:

  • 0 โ€” success ๐Ÿ’–
  • 1 โ€” failure ๐Ÿ˜ญ
  • 32 โ€” none of specified devices found ๐Ÿ’€
  • 64 โ€” some specified devices found, some not found ๐Ÿ™ˆ

๐ŸŽจ COLORS ๐ŸŽจ

The output colorization is implemented by terminal-colors.d(5) functionality. Implicit coloring can be disabled by an empty file /etc/terminal-colors.d/lsblk.disable for the lsblk command or for all tools by /etc/terminal-colors.d/disable.

Since version 2.41, the $NO_COLOR environment variable is also supported to disable output colorization unless explicitly enabled by a command-line option.

The user-specific $XDG_CONFIG_HOME/terminal-colors.d or $HOME/.config/terminal-colors.d overrides the global setting.

Note that the output colorization may be enabled by default, and in this case terminal-colors.d directories do not have to exist yet. ๐ŸŒˆ

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

okay bestie, these are the little environment variables that change how lsblk behaves. they're like the settings menu but for your shell, iykyk ๐Ÿ’…

  • LSBLK_DEBUG=all โ€” turns on lsblk debug output. all the tea, all of it ๐Ÿ”
  • LIBBLKID_DEBUG=all โ€” turns on libblkid debug output โœจ
  • LIBMOUNT_DEBUG=all โ€” turns on libmount debug output โœจ
  • LIBSMARTCOLS_DEBUG=all โ€” turns on libsmartcols debug output โœจ
  • LIBSMARTCOLS_DEBUG_PADDING=on โ€” use visible padding characters ๐Ÿ‘€ (so you can literally see the padding, iconic)
  • LIBSMARTCOLS_JSON=compact|lines โ€” controls the JSON output format when you're using --json. the supported values are compact for JSON output with minimal whitespace, and lines for JSON Lines format (one JSON object per line). if it's unset, or set to literally any other value, you get pretty-printed JSON ๐ŸŒธ
  • LSBLK_COLUMNS= โ€” specifies a comma-separated list of output columns to print. every single column listed by --list-columns can be used here ๐ŸŽ€

๐Ÿ“ NOTES ๐Ÿ“

for partitions, some information (e.g., queue attributes) is inherited from the parent device. so yeah, they get it from their parent, main character energy runs in the family fr fr ๐Ÿซถ

the lsblk command needs to be able to look up each block device by major:minor numbers, which is done by using /sys/dev/block. this sysfs block directory appeared in kernel 2.6.27 (October 2008). in case of problems with a new enough kernel, check that CONFIG_SYSFS was enabled at the time of the kernel build. no cap, that's the vibe check ๐Ÿ”


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Milan Broz <gmazyland@gmail.com>, Karel Zak <kzak@redhat.com>

(absolute legends, we stan ๐Ÿ’–)


๐Ÿ”— SEE ALSO ๐Ÿ”—

blkid(8), findmnt(8) ls(1), scols-filter(5)

go read those too bestie, they're all part of the same friend group ๐ŸŒˆ


๐Ÿ› REPORTING BUGS ๐Ÿ›

found a bug? don't just suffer in silence ๐Ÿ˜ญ for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. tell them everything, they wanna know ๐Ÿ’œ


โญ AVAILABILITY โญ

the lsblk command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. go get it, it's free, it's iconic ๐Ÿ’…


and that's a wrap on LSBLK(8) bestie!! ๐ŸŽ€ this page came to you from util-linux 2.42.4, dated 2026-09-21 โ€” slay, ate, no crumbs left, periodt ๐Ÿ’–โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms