Skip to content

SD Card Formatting

Purpose: Prepare an SD card for use with PX4 flight controllers in the RFD fleet. Host OS: Ubuntu 24.04 LTS Filesystem target: FAT32 (MBR partition table, LBA flag set)


Controller SD slot Card type Notes
Holybro Pixhawk 6C Mini External slot microSD Removable without opening the case
CubePilot Cube Orange+ Internal slot Full-size SD Card sits inside the carrier board; open the case to access

The formatting procedure below is identical for both controllers.


  • SD card (see Card selection notes below)
  • USB SD card reader or built-in reader on host machine
  • dosfstools and parted installed:
Terminal window
sudo apt install dosfstools parted

Insert the card into the reader, then list block devices:

Terminal window
lsblk

The card will typically appear as /dev/sdb or /dev/mmcblk0. Verify the reported size matches the card before proceeding — operating on the wrong device will destroy data on that drive.

Optional cross-check via kernel log:

Terminal window
sudo dmesg | tail -20

Run this immediately after insertion to confirm the device node assignment.

Throughout the rest of this guide, replace sdX with the actual device identifier (e.g. sdb).

Ubuntu auto-mounts removable media. Unmount all partitions on the target device before modifying it:

Terminal window
sudo umount /dev/sdX*

The wildcard catches sdX1, sdX2, etc. “Not mounted” errors are safe to ignore.

Section titled “3. Wipe existing partition table (optional but recommended)”

Clears stale filesystem signatures for an unambiguous result:

Terminal window
sudo wipefs -a /dev/sdX
Terminal window
sudo parted /dev/sdX --script mklabel msdos
sudo parted /dev/sdX --script mkpart primary fat32 1MiB 100%
sudo parted /dev/sdX --script set 1 lba on

This creates:

  • An MBR (msdos) partition table
  • A single primary FAT32 partition spanning the card
  • The LBA flag, which PX4’s FAT driver expects

For cards ≤ 32 GB:

Terminal window
sudo mkfs.vfat -F 32 -n "PX4" /dev/sdX1

For cards > 32 GB (64 GB, 128 GB, etc.):

Terminal window
sudo mkfs.vfat -F 32 -s 64 -n "PX4" /dev/sdX1

The -s 64 flag sets a 32 KB cluster size (64 sectors × 512 B), which gives better sustained log-write throughput on large cards. PX4 logs heavily, and small clusters thrash the FAT.

Terminal window
sudo fsck.vfat -v /dev/sdX1
sudo parted /dev/sdX print

Expected output: a single FAT32 partition labelled PX4 with the lba flag set.

Terminal window
sudo eject /dev/sdX

Insert the card into the controller’s SD slot (external microSD slot on the Pixhawk 6C Mini, or internal full-size slot on the Cube Orange+ — open the carrier case for access). On next boot, PX4 will create the /log/, /etc/, and other working directories automatically. Confirm logging is active via QGroundControl (Vehicle Setup → Logging) or by inspecting the LOG_* parameters.


Attribute Recommendation Rationale
Form factor microSD for Pixhawk 6C Mini; full-size SD for Cube Orange+ Match the controller’s slot type
Speed class UHS-I U3 / A1 or A2 Sustained write rate handles ulog without dropped messages
Capacity 32 GB Sweet spot — ample log space, no large-card formatting friction
Endurance High-endurance models (e.g. Samsung Pro Endurance, SanDisk High Endurance) Daily-flying airframes accumulate write cycles fast
Filesystem FAT32 only PX4’s FAT driver does not support exFAT; will fail to mount

Recommended models: SanDisk Extreme, Samsung Pro Endurance.


  • Standardise across the fleet. Use one card model per controller family across all airframes. Makes log retrieval procedures repeatable and pre-formatted spares interchangeable.
  • Pre-format a batch of spares to identical spec and store them with the airframes. Reduces field-swap time.
  • Do not use exFAT. Cards over 32 GB formatted by Windows or default GUI tools often default to exFAT — PX4 will fail to mount the card on boot.
  • Cheap consumer cards drop messages. Symptoms include gaps in flight review traces and intermittent log corruption. Card quality is not a place to save money on a development airframe.
  • Cube Orange+ card access. The SD slot is internal to the carrier board. To swap cards, unclip the carrier case, remove the existing SD card, insert the freshly formatted card, and reassemble. Verify the card is fully seated before closing the case.

Symptom Likely cause Action
Card not detected on boot Wrong filesystem (likely exFAT) or partition table corruption Reformat per this procedure
Log files missing or truncated Slow or worn card Replace with UHS-I U3 / high-endurance card
mkfs.vfat refuses card > 32 GB Tool defaults to a smaller filesystem Use explicit -F 32 flag as shown in Step 5
Permission denied on format commands Not running as root Prepend sudo
Cube Orange+ won’t power on after reassembly SD card not fully seated; jammed case Open case, re-Seat card, close carefully

Last reviewed: May 2026