Cloning automation controller storage: Compact Flash, SSD, and CFast cards
Why use Linux for cloning
Standard Linux utilities such as dd, wipefs, fdisk, and lsblk give you direct, bit-level control over storage media without extra software. Linux also recognises industrial media reliably out of the box, including Compact Flash (CF) cards used in automation PCs and controllers like the Schneider PacDrive 600.
Check that dd is available before starting:
which dd
If it returns a path (for example /usr/bin/dd), you are good to go.
Supported storage media
The same block-level dd workflow works across different industrial storage types.
Compact Flash cards
This guide uses a Compact Flash card from a PacDrive 600 controller as the reference example.
CFast cards
CFast cards are faster SATA-based versions of Compact Flash, connected either directly to a SATA port or through a USB-to-SATA adapter. Because Linux still exposes them as standard block devices, lsblk, wipefs, fdisk, and dd work identically — just faster.
SSDs
The exact same steps apply to industrial SSDs inside automation PCs, using the appropriate device path (for example /dev/sda instead of a card reader). Keep two SSD-specific points in mind:
- Wear levelling: SSD firmware distributes writes internally, which does not change how
ddclones the drive. - TRIM support: If the replacement SSD supports TRIM and sees heavy write workloads, consider running
fstrimafter restoring if the filesystem supports it.
Verify source and target devices
Double-check your source and target device names before running wipefs or dd. Mixing them up will overwrite the original controller card permanently.
List all connected disks and partitions:
lsblk
Confirm which device is your source card (in these examples, /dev/sdb) and which is your target card (/dev/sdc).
You can inspect the source card's partition layout in more detail with fdisk:
sudo fdisk -l /dev/sdb
Prepare the target card
Before writing an image, clear any old partition signatures from the target card (/dev/sdc). Using --force avoids "device busy" errors on mounted or previously partitioned cards:
sudo wipefs --all --force /dev/sdc
Optionally, zero out the first 10 MB of the target card to guarantee a clean start:
sudo dd if=/dev/zero of=/dev/sdc bs=1M count=10
sync
Wait for sync to return to the prompt before unplugging the card.
Create an image backup of the source card
Creating a .img file gives you an archive you can keep safely and restore onto new cards later. Optionally, create a folder for your backups first:
mkdir -p ~/backups
cd ~/backups
Read the full source card (/dev/sdb) into clone.img:
sudo dd if=/dev/sdb of=~/clone.img bs=4M status=progress
if=/dev/sdb: input device (source card)of=~/clone.img: output image filebs=4M: 4 MB block size for faster transfersstatus=progress: live transfer progress
Write the image or clone directly
Make sure the target card is at least as large as the source card (for example, restoring a 128 MB source onto a 512 MB card).
Write the saved backup image onto the target card (/dev/sdc):
sudo dd if=~/clone.img of=/dev/sdc bs=4M status=progress
Alternatively, if both cards are connected at once, clone directly from source (/dev/sdb) to target (/dev/sdc) without saving an intermediate file:
sudo dd if=/dev/sdb of=/dev/sdc bs=4M status=progress
Verify the clone
After cloning finishes, verify that both the raw data and partition tables match.
Compare raw bytes with cmp
sudo cmp /dev/sdb ~/clone.img
No output means the source card and image are byte-for-byte identical. Any mismatch prints the exact byte offset where they differ.
Compare partition tables with fdisk
sudo fdisk -l /dev/sdb
sudo fdisk -l /dev/sdc
Or inspect the saved image directly:
sudo fdisk -l ~/clone.img
Confirm that the partition layout, sizes, and partition types match.
Compare block layout with lsblk
lsblk /dev/sdb
lsblk /dev/sdc
Once the partitions and byte comparisons match, the cloned card is ready to test in the controller.