LinuxCommandLibrary

grub-mount

Mount a GRUB image for filesystem access

SYNOPSIS

grub-mount [OPTION...] DEVICE MOUNT_POINT

PARAMETERS

-r, --read-only
    Mount the filesystem in read-only mode.

-d, --debug
    Print debug messages to standard error.

-o, --offset=OFF
    Specify an offset in bytes into the device or image from where to start interpreting the filesystem. Useful for mounting partitions within disk images.

-s, --skip=NUM
    Skip NUM bytes from the device. Similar to --offset.

-t, --type=FSTYPE
    Specify the filesystem type to be mounted (e.g., ext2, fat, ntfs). GRUB's internal drivers will be used.

-v, --verbose
    Print verbose messages.

--version
    Print program version information and exit.

--help
    Display a help message and exit.

DESCRIPTION

grub-mount is a utility from the GNU GRUB project that allows mounting filesystems understood by GRUB onto a regular Linux filesystem. This means it can interpret and mount various filesystems (like ext2/3/4, XFS, Btrfs, FAT, NTFS, HFS+, UFS, etc.) and even GRUB-specific constructs (like loopback devices or raid volumes) that might be part of a GRUB installation or disk image. It acts as a bridge, making GRUB's internal filesystem view accessible via the Filesystem in Userspace (FUSE) framework, enabling users to inspect or modify GRUB-related files (e.g., grub.cfg, GRUB modules) from a host operating system. It's particularly useful for debugging GRUB installations, examining bootable disk images, or managing GRUB modules without needing to boot into GRUB.

CAVEATS

Requires root privileges for most operations as it interacts with low-level device files or disk images.
Relies on the FUSE kernel module being loaded and available.
Only mounts filesystems that GRUB itself can understand and process, using GRUB's own internal drivers.
Can be destructive if used incorrectly in read-write mode on a live system or important image, though read-only mode is safer.
May not correctly interpret all complex GRUB device mappings (e.g., specific RAID or LVM setups if not fully supported by GRUB's internal filesystem drivers).

FUSE-BASED UTILITY

grub-mount utilizes the Filesystem in Userspace (FUSE) framework, which allows unprivileged users to create their own filesystems without modifying the kernel. This design choice makes grub-mount flexible and safe to operate in user space, while still providing the necessary low-level access to interpret GRUB-specific structures.

TYPICAL USAGE

A common use case for grub-mount is to inspect the contents of a GRUB installation on a raw disk image (e.g., a .img file from a virtual machine or a disk clone) or directly on a physical drive. For example, to check the grub.cfg file or verify if specific GRUB modules are present within the boot partition.

Example: sudo grub-mount /dev/sda1 /mnt/grub_root
Example with offset: sudo grub-mount -o 1048576 disk_image.img /mnt/img_mount (where 1048576 is an offset to a partition within the image).

HISTORY

grub-mount is a component of the GNU GRUB (Grand Unified Bootloader) project, which has been in active development since the late 1990s. As GRUB evolved to support a wider array of filesystems, disk layouts, and complex boot scenarios, the need arose for tools that could inspect and manage GRUB's internal view of the boot environment from a running operating system. grub-mount was developed to fill this gap, leveraging the FUSE framework to provide a convenient interface for debugging and development. It became a standard utility within the GRUB toolkit, alongside grub-mkimage and grub-install, enabling deeper interaction with GRUB's boot logic without needing to restart the machine or use a live environment.

SEE ALSO

Copied to clipboard