Skip to main content

Command Palette

Search for a command to run...

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

Updated
6 min readView as Markdown
How to Back Up a Retro Gaming Handheld SD Card on macOS and Linux
H
I work with Linux in the day, ballroom dancing at night. I use Arch, btw.

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:

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:

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:

diskutil list

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

For example:

/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:

/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:

diskutil unmountDisk /dev/disk4

Replace disk4 with your actual device.

You should see:

Unmount of all volumes on disk4 was successful

3. Install Zstandard

If you use Homebrew:

brew install zstd

Verify the installation:

zstd --version

4. Create the Compressed Image

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

For example:

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:

~/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:

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

You should get:

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

Then create a SHA-256 checksum:

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

Your backup now consists of:

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:

diskutil list

Suppose the replacement card is:

/dev/disk5

Double-check this before proceeding.

Unmount it:

diskutil unmountDisk /dev/disk5

Verify the backup:

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

You want:

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

Then restore:

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

Afterward:

sync

Then eject the card:

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:

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

For example:

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:

/dev/sdb

Use the whole disk, not an individual partition.

2. Unmount the SD Card

Unmount all partitions belonging to the SD card:

sudo umount /dev/sdb1
sudo umount /dev/sdb2

If there are additional partitions, unmount those as well.

Verify:

lsblk

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

3. Install Zstandard

On Arch Linux:

sudo pacman -S zstd

On Debian/Ubuntu:

sudo apt install zstd

Verify:

zstd --version

4. Create the Compressed Image

Run:

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:

status=progress

so you should see the amount of data being copied.

The resulting file will be:

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

5. Verify the Image

First test the Zstandard archive:

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

Then create a checksum:

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

Your backup now contains:

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

Restoring on Linux

Insert the replacement SD card.

Identify it:

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

Suppose it is:

/dev/sdc

Unmount its partitions:

sudo umount /dev/sdc1
sudo umount /dev/sdc2

Verify the backup:

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

You should get:

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

Restore the image:

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

Then:

sync

Remove the SD card:

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:

Handheld-2026-09-09.txt

For example:

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:

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:

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

Important Considerations

Use the Whole Disk

Back up:

/dev/sdb

not:

/dev/sdb1
/dev/sdb2

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

On macOS, similarly use:

/dev/rdisk4

rather than:

/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:

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.