# How exFAT + FAT32 Partition Configuration Enables Large SD Cards on ATOMCam

> Discover how ATOMCam's exFAT + FAT32 partition setup supports large SD cards by bypassing the 2TB limit. Learn this clever filesystem configuration.

- Repository: [Mitsuru Nakada/atomcam_tools](https://github.com/mnakada/atomcam_tools)
- Tags: how-to-guide
- Published: 2026-03-07

---

**ATOMCam devices use a dual-partition scheme—FAT32 for the bootloader and exFAT for data—to bypass the 2 TB filesystem limit and support very large SD cards.**

The `atomcam_tools` project solves a critical hardware limitation in ATOMCam firmware: the boot ROM (u‑boot) can only read FATFS (FAT12/16/32) partitions. To support modern SD cards larger than 2 TB—where FAT32 is impossible—the tools implement an **exFAT + FAT32 partition configuration** that reserves a small FAT32 slice for boot files while using exFAT for the remaining capacity.

---

## Why ATOMCam Needs a Dual-Partition Layout

The camera’s bootloader is hardcoded to recognize only FATFS volumes. When the device powers on, u‑boot searches the SD card for factory boot images (e.g., `factory_t31_…`) and expects to find them on a FAT32-formatted partition.

However, FAT32 has a maximum volume size of **2 TB** (and practical limits near 16 TB with non-standard cluster sizes). Modern SD cards now exceed this threshold. The solution is to split the card into two partitions:

1.  A small **FAT32** partition for the bootloader.
2.  A large **exFAT** partition for the tools and data, leveraging exFAT’s theoretical limit of **128 PiB**.

---

## How the exFAT + FAT32 Partition Configuration Works

The `atomcam_tools` repository implements this layout through kernel patches and library overrides that ensure the camera boots correctly while accessing the full SD card capacity.

### The FAT32 Boot Partition

The first partition must be formatted as FAT32 and contain the factory boot files required by u‑boot. In [`libcallback/mmc_mount.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_mount.c), the tools override the SDK’s mount behavior to ensure this partition is presented as `/media/mmc`, the path the camera firmware expects.

The code intercepts `local_sdk_device_open` and related calls to prevent the firmware from remounting or reformatting the card, preserving the dual-partition layout.

### The exFAT Data Partition

The second partition holds the `atomcam_tools` runtime: `rootfs_hack.squashfs`, SSH keys (`authorized_keys`), hostname files, and user data. Because the Linux kernel in the buildroot environment includes the exFAT driver (added via `patches/kernel/linux-fs-exfat.patch`), the system mounts this partition natively.

This configuration removes the 2 TB ceiling. Users can insert 4 TB, 8 TB, or larger cards, with the only practical limit being the SD card hardware itself.

---

## Technical Implementation in atomcam_tools

The repository contains specific files that enforce the exFAT + FAT32 partition configuration and prevent the camera from breaking it.

### Kernel exFAT Support

The file `patches/kernel/linux-fs-exfat.patch` adds the exFAT filesystem driver to the buildroot kernel. Without this patch, the Linux runtime would not recognize the second partition, making the tools inaccessible.

### Mount Override Mechanisms

In [`libcallback/mmc_mount.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_mount.c), the project overrides `local_sdk_device_open` to redirect the SDK’s mount attempts. This ensures the FAT32 boot partition remains mounted at `/media/mmc` and the camera does not attempt to unmount or reformat it.

### Format Protection

The file [`libcallback/mmc_format.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_format.c) stubs out `local_sdk_device_mmc_format`. This prevents the camera’s stock firmware from reformatting the SD card into a single FAT32 partition, which would destroy the exFAT data partition and the tools installed there.

---

## Setting Up the Dual-Partition SD Card

To use the exFAT + FAT32 partition configuration, prepare the SD card on a Linux PC before inserting it into the camera.

### 1. Create the Partition Layout

Use `sfdisk` to create a GPT partition table with a small FAT32 boot partition and a large exFAT data partition:

```bash

# Replace /dev/sdX with your actual SD card device

sudo sfdisk /dev/sdX <<EOF
label: gpt
size=64M,type=ef00,name="BOOT"
size=,type=0700,name="TOOLS"
EOF

```

### 2. Format the Partitions

Format the first partition as FAT32 for the bootloader and the second as exFAT for the tools:

```bash

# Format boot partition as FAT32

sudo mkfs.vfat -F 32 /dev/sdX1

# Format data partition as exFAT (requires exfatprogs)

sudo mkfs.exfat /dev/sdX2

```

### 3. Install the Boot Files

Copy the factory boot images required by u‑boot to the FAT32 partition:

```bash
mkdir /tmp/boot
sudo mount /dev/sdX1 /tmp/boot
sudo cp factory_t31_* /tmp/boot/
sudo umount /tmp/boot

```

### 4. Install atomcam_tools

Extract the tools release package onto the exFAT partition:

```bash
mkdir /tmp/tools
sudo mount -t exfat /dev/sdX2 /tmp/tools
unzip atomcam_tools.zip -d /tmp/tools
sudo umount /tmp/tools

```

Insert the card into the ATOMCam. The device boots from the FAT32 partition and automatically accesses the exFAT partition for all tool operations, supporting SD cards well beyond 2 TB.

---

## Summary

- **Hardware limitation**: ATOMCam’s u‑boot bootloader only recognizes FATFS partitions, requiring a FAT32 boot slice.
- **Capacity solution**: The **exFAT + FAT32 partition configuration** uses a small FAT32 partition for boot files and a large exFAT partition for data, bypassing the 2 TB FAT32 limit.
- **Kernel support**: The `patches/kernel/linux-fs-exfat.patch` adds exFAT drivers to the buildroot kernel.
- **Protection mechanisms**: [`libcallback/mmc_mount.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_mount.c) and [`libcallback/mmc_format.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_format.c) override SDK functions to prevent the camera from reformatting or remounting the card incorrectly.
- **User setup**: Partitions must be created on a PC using tools like `sfdisk` and `mkfs.exfat` before the card is inserted into the camera.

---

## Frequently Asked Questions

### Can I use a single FAT32 partition for SD cards smaller than 32 GB?

Yes, for cards under 32 GB you can use a single FAT32 partition. However, the **exFAT + FAT32 partition configuration** is still recommended because it prevents the camera’s stock firmware from reformatting the card and deleting your tools. The override functions in [`libcallback/mmc_format.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_format.c) specifically protect against this behavior regardless of card size.

### Why doesn't the camera automatically format the exFAT partition?

The camera’s native SDK includes functions like `local_sdk_device_mmc_format` that would normally reformat the SD card into a single FAT32 volume. The `atomcam_tools` project intercepts these calls in [`libcallback/mmc_format.c`](https://github.com/mnakada/atomcam_tools/blob/main/libcallback/mmc_format.c) and stubs them out, returning success without performing any format operation. This preserves the dual-partition layout you created on your PC.

### What is the maximum SD card size supported with this configuration?

The **exFAT + FAT32 partition configuration** theoretically supports SD cards up to **128 PiB** (pebibytes), which is the architectural limit of the exFAT filesystem. In practice, the limit is determined by the SD card hardware and the Linux kernel’s block device handling. The system has been tested with multi-terabyte cards, far exceeding the 2 TB limit imposed by FAT32.

### Is the exFAT driver included in the stock ATOMCam firmware?

No, the stock firmware does not include exFAT support. The `atomcam_tools` project adds this capability by applying `patches/kernel/linux-fs-exfat.patch` to the buildroot kernel during compilation. This patch introduces the exFAT filesystem driver, allowing the Linux runtime to mount and read the second partition after the bootloader has handed control to the kernel.