# How Ventoy Supports exFAT, NTFS, XFS, Btrfs, and Ext: A Deep Dive into Multi-Filesystem Boot Architecture

> Explore Ventoy's advanced multi-filesystem boot architecture. Learn how Ventoy supports exFAT, NTFS, XFS, Btrfs, Ext, and UDF without altering your USB drive.

- Repository: [longpanda/Ventoy](https://github.com/ventoy/Ventoy)
- Tags: deep-dive
- Published: 2026-03-01

---

**Ventoy implements a layered filesystem detection strategy that probes partition tables at boot, maps detected types to a unified `ventoy_fs_type` enumeration, and invokes read-only GRUB2 drivers to mount exFAT, NTFS, UDF, XFS, Btrfs, and Ext partitions without modifying the USB drive.**

Ventoy is an open-source boot manager that boots ISO, WIM, IMG, and VHD(x) files directly from USB drives. To ensure **Ventoy filesystem support** across Linux, Windows, and macOS environments, the project integrates a unified detection system that bridges the GRUB bootloader with the VTOY2DISK utility layer.

## Boot-Time Filesystem Detection

When a USB device initializes, Ventoy immediately analyzes the partition structure to determine which driver to load. This detection combines partition table metadata with filesystem-specific superblock inspection.

### Partition Table Analysis

Ventoy reads the MBR or GPT partition entry to examine the `FsFlag` field. For partitions marked with flag `0x07` (indicating exFAT/NTFS/HPFS), Ventoy performs secondary boot sector inspection:

- **exFAT**: Identified by the "FAT32   " signature in the boot sector
- **NTFS**: Detected via the "NTFS" string in the boot sector  
- **FAT32**: Distinguished by boot sector type `0x0C`

For Linux-native filesystems, Ventoy reads magic values from the superblock directly through GRUB's filesystem modules.

### Filesystem Detection Reference

| Filesystem | Detection Method | Internal Enum | GRUB Driver |
|------------|------------------|---------------|-------------|
| **exFAT** | Boot sector "FAT32" signature | `ventoy_fs_exfat` (0) | [`fs/fat.c`](https://github.com/ventoy/Ventoy/blob/main/fs/fat.c) |
| **NTFS** | Boot sector "NTFS" string | `ventoy_fs_ntfs` (1) | [`fs/ntfs.c`](https://github.com/ventoy/Ventoy/blob/main/fs/ntfs.c) |
| **Ext2/3/4** | Superblock magic | `ventoy_fs_ext` (2) | [`fs/ext2.c`](https://github.com/ventoy/Ventoy/blob/main/fs/ext2.c) |
| **XFS** | Superblock "XFSB" magic | `ventoy_fs_xfs` (3) | [`fs/xfs.c`](https://github.com/ventoy/Ventoy/blob/main/fs/xfs.c) |
| **UDF** | GPT label or UDF structures | `ventoy_fs_udf` (4) | [`fs/udf.c`](https://github.com/ventoy/Ventoy/blob/main/fs/udf.c) |
| **FAT32** | Boot sector type `0x0C` | `ventoy_fs_fat` (5) | [`fs/fat.c`](https://github.com/ventoy/Ventoy/blob/main/fs/fat.c) |
| **Btrfs** | Btrfs superblock | `ventoy_fs_btrfs` (6) | [`fs/btrfs.c`](https://github.com/ventoy/Ventoy/blob/main/fs/btrfs.c) |

## The Unified Filesystem Type System

To standardize detection results across components, Ventoy maintains a central enumeration used by both the GRUB layer and the tool utilities.

### Core Enum Definition

The `ventoy_fs_type` enumeration lives in [`VtoyTool/vtoytool.h`](https://github.com/ventoy/Ventoy/blob/main/VtoyTool/vtoytool.h) and is mirrored in [`GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h):

```c
typedef enum ventoy_fs_type {
    ventoy_fs_exfat = 0,
    ventoy_fs_ntfs,
    ventoy_fs_ext,
    ventoy_fs_xfs,
    ventoy_fs_udf,
    ventoy_fs_fat,
    ventoy_fs_btrfs,
    ventoy_fs_max
} ventoy_fs_type;

```

### String-to-Enum Mapping

In [`GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c), the `ventoy_get_fs_type()` function converts filesystem name strings to enum values:

```c
int ventoy_get_fs_type(const char *fs)
{
    if (grub_strncmp(fs, "exfat", 5) == 0) return ventoy_fs_exfat;
    if (grub_strncmp(fs, "ntfs", 4) == 0)  return ventoy_fs_ntfs;
    if (grub_strncmp(fs, "ext", 3) == 0)   return ventoy_fs_ext;
    if (grub_strncmp(fs, "xfs", 3) == 0)    return ventoy_fs_xfs;
    if (grub_strncmp(fs, "udf", 3) == 0)    return ventoy_fs_udf;
    if (grub_strncmp(fs, "fat", 3) == 0)    return ventoy_fs_fat;
    if (grub_strncmp(fs, "btrfs", 5) == 0)  return ventoy_fs_btrfs;
    return ventoy_fs_max;
}

```

## GRUB2 Driver Integration

Ventoy ships with a custom-compiled GRUB2 binary that includes read-only filesystem drivers. This architecture ensures the USB drive remains unmodified during boot operations.

### Module Compilation

The supported filesystems are handled by upstream GRUB modules compiled into the Ventoy EFI binary:

- **exFAT/FAT**: [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/fat.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/fat.c)
- **NTFS**: [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/ntfs.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/ntfs.c)
- **Ext2/3/4**: [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/ext2.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/ext2.c)
- **XFS**: [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/xfs.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/xfs.c)
- **Btrfs**: [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/btrfs.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/btrfs.c)
- **UDF**: [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/udf.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/udf.c)

These modules are linked during the build process defined in [`GRUB2/buildgrub.sh`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/buildgrub.sh) and invoked through the `ventoy_cmd` helper interface.

### OS Parameter Block Storage

When a file is opened, Ventoy caches the detected filesystem type in the `ventoy_os_param` structure:

```c
param->vtoy_disk_part_type = ventoy_get_fs_type(file->fs->name);

```

This storage mechanism allows later boot stages and Ventoy utilities to reference the filesystem type via the `vtoy_disk_part_type` field without re-probing the disk.

## Partition Flag Management

The Ventoy2Disk utility sets appropriate partition type flags during USB preparation to ensure BIOS/UEFI firmware recognizes the volume correctly.

### MBR/GPT Flag Assignment

In [`Ventoy2Disk/Utility.c`](https://github.com/ventoy/Ventoy/blob/main/Ventoy2Disk/Utility.c), the `VentoyFillMBR()` function assigns the `FsFlag` field based on the target filesystem:

```c
// 0x07 = exFAT/NTFS/HPFS, 0x0C = FAT32, 0xEE = Ventoy boot marker
pMBR->PartTbl[0].FsFlag = FsFlag;

```

Flag `0x07` indicates an exFAT, NTFS, or HPFS partition, while `0x0C` designates FAT32. This metadata ensures proper handoff between the firmware bootloader and Ventoy's GRUB environment.

## Practical Code Examples

### Detecting Filesystem in GRUB Scripts

Ventoy exposes filesystem detection to GRUB configuration scripts:

```text
insmod ventoy
set fs_type = ${ventoy_fs_probe}
if [ "$fs_type" = "ntfs" ]; then
    echo "NTFS partition detected – loading Windows bootloader"
fi

```

### Querying Filesystem via C API

Applications using the Ventoy tool API can query partition types through the `ventoy_os_param` structure:

```c
#include "vtoytool.h"

void show_fs_type(const char *dev)
{
    ventoy_os_param param;
    if (vtoy_find_disk_by_guid(&param, (char *)dev) == 0) {
        const char *names[] = {"exFAT","NTFS","EXT","XFS","UDF","FAT","BTRFS"};
        printf("Partition %s is %s\n",
               dev,
               names[param.vtoy_disk_part_type]);
    }
}

```

### Initializing Partition Flags

When formatting a new Ventoy disk, utilities set the filesystem flag before writing the MBR:

```c
UINT8 FsFlag = 0x07;  // exFAT/NTFS/HPFS compatible
VentoyFillMBR(diskSize, &MBR, partStyle, FsFlag);

```

## Summary

Ventoy's multi-filesystem architecture rests on three foundational mechanisms:

- **Unified enumeration**: The `ventoy_fs_type` enum in [`VtoyTool/vtoytool.h`](https://github.com/ventoy/Ventoy/blob/main/VtoyTool/vtoytool.h) standardizes type identification across the GRUB and utility layers
- **Boot-time probing**: Partition tables and superblocks are analyzed at startup to select appropriate drivers without user configuration
- **Read-only GRUB modules**: Filesystem drivers from upstream GRUB are compiled into the EFI binary with write support disabled, preserving USB data integrity

This design enables Ventoy to boot operating systems from exFAT, NTFS, UDF, XFS, Btrfs, and Ext partitions while maintaining cross-platform compatibility.

## Frequently Asked Questions

### How does Ventoy distinguish between exFAT and NTFS when both use partition flag 0x07?

Ventoy performs secondary boot sector inspection beyond the partition table entry. For exFAT, it validates the "FAT32   " signature in the boot sector, while NTFS partitions contain the "NTFS" string at offset 3. This differentiation occurs before the `ventoy_fs_type` enum is assigned in the detection phase.

### Can Ventoy modify files on the USB drive during boot?

No. According to the source code in `GRUB2/MOD_SRC/grub-2.04/grub-core/fs/`, all filesystem modules are compiled with read-only support exclusively. The drivers can mount partitions to load ISO or IMG files, but they lack write operations to ensure the USB drive remains unchanged during the boot process.

### Why does Ventoy cache the filesystem type in the OS parameter block?

The `vtoy_disk_part_type` field stores the detection result so that later boot stages and Ventoy's VTOY2DISK installer can reference the filesystem type without re-reading the partition superblock. This optimization reduces boot latency and ensures consistent identification across the boot chain.

### Which source files implement Btrfs and XFS support?

Btrfs support is implemented in [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/btrfs.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/btrfs.c), while XFS support resides in [`GRUB2/MOD_SRC/grub-2.04/grub-core/fs/xfs.c`](https://github.com/ventoy/Ventoy/blob/main/GRUB2/MOD_SRC/grub-2.04/grub-core/fs/xfs.c). Both are upstream GRUB modules compiled into Ventoy's custom EFI binary during the build process, providing native read access without requiring additional kernel modules.