# How to Back Up a Retro Gaming Handheld SD Card on macOS and Linux

Many retro gaming handhelds store their operating system, game ROMs, save files, BIOS files, and configuration on an SD card. A simple file copy is useful, but it does **not** preserve everything required to reproduce the entire card.

For reliable disaster recovery, create a **full raw SD-card image** and compress it with **Zstandard (**`zstd`**)**.

The resulting backup looks like this:

```text
Handheld-2026-09-09.img.zst
Handheld-2026-09-09.img.zst.sha256
```

The `.img.zst` file contains the complete SD card, including its partition table, boot information, operating system, ROMs, saves, BIOS files, and other data.

> **Warning:** `dd` can overwrite an entire disk instantly if the wrong device is specified. Always verify the SD-card device before running any `dd` command.

## Why Use an `.img.zst` Backup?

An ISO is primarily intended for optical media. For an SD card, a raw disk image is more appropriate.

The process is:

```text
SD card
   │
   ▼
raw .img
   │
   ▼
Zstandard
   │
   ▼
.img.zst
```

This provides several advantages:

*   Preserves the complete SD card
    
*   Preserves the partition table
    
*   Preserves boot sectors and boot partitions
    
*   Includes ROMs and save files
    
*   Compresses unused space efficiently
    
*   Produces a single portable backup file
    
*   Can be restored to another SD card later
    

# macOS

## 1\. Insert the SD Card

Insert the handheld's SD card into your Mac.

Open Terminal and run:

```bash
diskutil list
```

Look for an external physical disk corresponding to the SD card.

For example:

```text
/dev/disk4 (external, physical):
   #:                       TYPE NAME              SIZE
   0:     FDisk_partition_scheme                    128.0 GB
   1:                 DOS_FAT_32 BOOT                ...
   2:                      Linux                     ...
```

In this example, the SD card is:

```text
/dev/disk4
```

**Your disk number will probably be different.**

Verify the capacity and make sure it is actually the handheld's SD card.

## 2\. Unmount the SD Card

Unmount the entire disk:

```bash
diskutil unmountDisk /dev/disk4
```

Replace `disk4` with your actual device.

You should see:

```text
Unmount of all volumes on disk4 was successful
```

## 3\. Install Zstandard

If you use Homebrew:

```bash
brew install zstd
```

Verify the installation:

```bash
zstd --version
```

## 4\. Create the Compressed Image

On macOS, use the `rdisk` device for faster raw access.

For example:

```bash
sudo dd if=/dev/rdisk4 bs=4m | zstd -T0 -10 -o ~/Handheld-2026-09-09.img.zst
```

Replace `rdisk4` with your actual disk.

The backup will be created in your home directory:

```text
~/Handheld-2026-09-09.img.zst
```

The process can take some time depending on the SD-card capacity and reader speed.

## 5\. Verify the Backup

Test the Zstandard archive:

```bash
zstd -t ~/Handheld-2026-09-09.img.zst
```

You should get:

```text
Handheld-2026-09-09.img.zst : OK
```

Then create a SHA-256 checksum:

```bash
shasum -a 256 ~/Handheld-2026-09-09.img.zst > ~/Handheld-2026-09-09.img.zst.sha256
```

Your backup now consists of:

```text
Handheld-2026-09-09.img.zst
Handheld-2026-09-09.img.zst.sha256
```

Keep both files together.

## 6\. Restore the SD Card on macOS

Insert the replacement SD card.

Identify it:

```bash
diskutil list
```

Suppose the replacement card is:

```text
/dev/disk5
```

**Double-check this before proceeding.**

Unmount it:

```bash
diskutil unmountDisk /dev/disk5
```

Verify the backup:

```bash
shasum -a 256 -c ~/Handheld-2026-09-09.img.zst.sha256
```

You want:

```text
Handheld-2026-09-09.img.zst: OK
```

Then restore:

```bash
zstd -dc ~/Handheld-2026-09-09.img.zst | sudo dd of=/dev/rdisk5 bs=4m
```

Afterward:

```bash
sync
```

Then eject the card:

```bash
diskutil eject /dev/disk5
```

The replacement card should now be a complete copy of the original.

# Linux

## 1\. Insert the SD Card

Insert the handheld's SD card.

Identify the device:

```bash
lsblk -o NAME,SIZE,MODEL,FSTYPE,MOUNTPOINTS
```

For example:

```text
NAME        SIZE MODEL
sda       931.5G Samsung SSD
├─sda1      512M
└─sda2    931.0G

sdb       119.1G SD Card
├─sdb1      256M
└─sdb2    118.8G
```

In this example, the SD card is:

```text
/dev/sdb
```

**Use the whole disk, not an individual partition.**

## 2\. Unmount the SD Card

Unmount all partitions belonging to the SD card:

```bash
sudo umount /dev/sdb1
sudo umount /dev/sdb2
```

If there are additional partitions, unmount those as well.

Verify:

```bash
lsblk
```

The SD-card partitions should no longer show mount points.

## 3\. Install Zstandard

On Arch Linux:

```bash
sudo pacman -S zstd
```

On Debian/Ubuntu:

```bash
sudo apt install zstd
```

Verify:

```bash
zstd --version
```

## 4\. Create the Compressed Image

Run:

```bash
sudo dd if=/dev/sdb bs=4M status=progress | zstd -T0 -10 -o ~/Handheld-2026-09-09.img.zst
```

Replace `/dev/sdb` with your actual SD-card device.

Linux `dd` normally supports:

```text
status=progress
```

so you should see the amount of data being copied.

The resulting file will be:

```text
~/Handheld-2026-09-09.img.zst
```

## 5\. Verify the Image

First test the Zstandard archive:

```bash
zstd -t ~/Handheld-2026-09-09.img.zst
```

Then create a checksum:

```bash
sha256sum ~/Handheld-2026-09-09.img.zst > ~/Handheld-2026-09-09.img.zst.sha256
```

Your backup now contains:

```text
Handheld-2026-09-09.img.zst
Handheld-2026-09-09.img.zst.sha256
```

# Restoring on Linux

Insert the replacement SD card.

Identify it:

```bash
lsblk -o NAME,SIZE,MODEL,FSTYPE,MOUNTPOINTS
```

Suppose it is:

```text
/dev/sdc
```

Unmount its partitions:

```bash
sudo umount /dev/sdc1
sudo umount /dev/sdc2
```

Verify the backup:

```bash
sha256sum -c ~/Handheld-2026-09-09.img.zst.sha256
```

You should get:

```text
/home/user/Handheld-2026-09-09.img.zst: OK
```

Restore the image:

```bash
zstd -dc ~/Handheld-2026-09-09.img.zst | sudo dd of=/dev/sdc bs=4M status=progress conv=fsync
```

Then:

```bash
sync
```

Remove the SD card:

```bash
sudo eject /dev/sdc
```

The replacement card should now contain the complete handheld installation.

# Keep a Backup Manifest

For long-term archival, it is useful to keep a small text file alongside the image:

```text
Handheld-2026-09-09.txt
```

For example:

```text
Device: Retro gaming handheld
SD Card: 128 GB
Backup type: Full raw disk image
Compression: Zstandard
Created: 2026-09-09

Image:
Handheld-2026-09-09.img.zst

Checksum:
Handheld-2026-09-09.img.zst.sha256

Restore:
zstd -dc Handheld-2026-09-09.img.zst | sudo dd of=/dev/sdX bs=4M status=progress conv=fsync
```

This makes the backup understandable even years later.

# Recommended Backup Structure

Keep the files together:

```text
Handheld/
├── Handheld-2026-09-09.img.zst
├── Handheld-2026-09-09.img.zst.sha256
└── Handheld-2026-09-09.txt
```

For additional protection, keep the backup on **at least two independent storage locations**.

For example:

```text
SD card
   │
   ├──> Computer / backup drive
   │
   └──> Second backup / NAS / cloud storage
```

# Important Considerations

## Use the Whole Disk

Back up:

```text
/dev/sdb
```

not:

```text
/dev/sdb1
/dev/sdb2
```

The complete-disk image preserves the partition table and all partitions.

On macOS, similarly use:

```text
/dev/rdisk4
```

rather than:

```text
/dev/disk4s1
```

## Use an Equal or Larger Replacement Card

The replacement SD card should ideally be the **same capacity or larger** than the original.

Two SD cards both sold as "128 GB" can have slightly different usable capacities. A card that is technically smaller can prevent a complete image from being restored.

## Don't Modify the Original Card Before Backing It Up

The full image should be your first-line disaster-recovery backup. Once you have verified the image and checksum, you can safely experiment with the original card knowing that you have a recovery point.

## Full Image vs. File Backup

A full image and a normal file backup serve different purposes:

```text
Full image
    ↓
Complete disaster recovery
    ↓
Restores the entire SD card


File backup
    ↓
Individual ROM/save recovery
    ↓
Restores selected files
```

For a retro gaming handheld, having **both** is ideal.
