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-specific notes
Section titled “Controller-specific notes”| 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.
Prerequisites
Section titled “Prerequisites”- SD card (see Card selection notes below)
- USB SD card reader or built-in reader on host machine
dosfstoolsandpartedinstalled:
sudo apt install dosfstools partedProcedure
Section titled “Procedure”1. Identify the SD card device
Section titled “1. Identify the SD card device”Insert the card into the reader, then list block devices:
lsblkThe 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:
sudo dmesg | tail -20Run this immediately after insertion to confirm the device node assignment.
Throughout the rest of this guide, replace
sdXwith the actual device identifier (e.g.sdb).
2. Unmount any auto-mounted partitions
Section titled “2. Unmount any auto-mounted partitions”Ubuntu auto-mounts removable media. Unmount all partitions on the target device before modifying it:
sudo umount /dev/sdX*The wildcard catches sdX1, sdX2, etc. “Not mounted” errors are safe to ignore.
3. Wipe existing partition table (optional but recommended)
Section titled “3. Wipe existing partition table (optional but recommended)”Clears stale filesystem signatures for an unambiguous result:
sudo wipefs -a /dev/sdX4. Create partition table and partition
Section titled “4. Create partition table and partition”sudo parted /dev/sdX --script mklabel msdossudo parted /dev/sdX --script mkpart primary fat32 1MiB 100%sudo parted /dev/sdX --script set 1 lba onThis creates:
- An MBR (msdos) partition table
- A single primary FAT32 partition spanning the card
- The LBA flag, which PX4’s FAT driver expects
5. Format as FAT32
Section titled “5. Format as FAT32”For cards ≤ 32 GB:
sudo mkfs.vfat -F 32 -n "PX4" /dev/sdX1For cards > 32 GB (64 GB, 128 GB, etc.):
sudo mkfs.vfat -F 32 -s 64 -n "PX4" /dev/sdX1The -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.
6. Verify the result
Section titled “6. Verify the result”sudo fsck.vfat -v /dev/sdX1sudo parted /dev/sdX printExpected output: a single FAT32 partition labelled PX4 with the lba flag set.
7. Eject and install
Section titled “7. Eject and install”sudo eject /dev/sdXInsert 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.
Card selection notes
Section titled “Card selection notes”| 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.
Operational notes
Section titled “Operational notes”- 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.
Troubleshooting
Section titled “Troubleshooting”| 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