grub-probe
Detect GRUB information about a device or file
TLDR
Get GRUB filesystem module for a path
Get the system device containing a path
Get GRUB disk name for a system device
Get filesystem UUID
Get filesystem label
Get MBR partition type code(two hexadecimal digits)
Probe using a custom device map
SYNOPSIS
grub-probe [OPTION...] DEVICE
PARAMETERS
--help, -h
display this message and exit
--version, -V
print version information
--verbose, -v
print verbose messages
--boot-device
probe the boot device
--device-map=FILE
use FILE directly as the device map
-d, --device-map-dev=DIR
use DIR as the prefix for the device map
--print=PARAMS
show info for PARAMS (fs,device,uuid,label,partition,dir,ostype)
--target=TARGET
transform DEVICE map to TARGET map (e.g., 'i386-pc', 'x86_64-efi')
--no-floppy
do not probe floppy devices
DESCRIPTION
grub-probe is a command-line tool from the GRUB bootloader suite used to inspect devices and filesystems, determining properties like filesystem type, UUID, label, partition details, and more. It is essential for generating accurate GRUB configuration files (grub.cfg), as it allows GRUB scripts to locate kernels, initramfs images, and root filesystems dynamically.
Typically invoked by grub-mkconfig during bootloader updates, it supports probing local filesystems (ext2/3/4, btrfs, xfs, etc.), logical volumes (LVM), MD RAID arrays, encrypted devices (LUKS), and network filesystems. The tool translates device paths using device maps and can output specific parameters in a machine-readable format.
For example, it helps resolve paths like /dev/disk/by-uuid/... or handles multipath setups. It must run with root privileges to access raw devices and may require kernel modules for certain filesystems. Output is plain text by default, making it suitable for scripting.
CAVEATS
Requires root privileges; slow on large/complex devices like full disks or RAID; may fail without loaded kernel modules for exotic filesystems; output assumes single-line results.
COMMON USAGE
grub-probe --target=device /boot outputs mapped device (e.g., hd0,msdos1).
grub-probe --print=fs,uuid /dev/sda1 shows filesystem type and UUID.
EXIT CODES
0 on success, non-zero on probe failure or invalid device.
HISTORY
Introduced in GRUB 2.00 (2012), replacing GRUB Legacy functionality. Developed by the GNU GRUB project since ~2005 to support modern filesystems, LVM, and EFI. Actively maintained for distributions like Ubuntu, Fedora.
SEE ALSO
grub-mkconfig(8), grub-install(8), grub-mkdevicemap(8), os-prober(8)


