What copying a partition means and why you'd do it

Copying a partition from one hard drive to another on a Raspberry Pi means taking an exact duplicate of your storage — the operating system, all your files, and all your settings — and moving it to a new drive. You do this when you want to back up your Pi before something goes wrong, when you're upgrading to a larger drive, or when you need to run the same setup on multiple Pis without starting from scratch each time.

The process creates what's called an image — a complete snapshot of everything on your current drive. You then write that image to the new drive. This is different from copying files one at a time, because it preserves the exact structure and permissions your Pi needs to boot and run.

You can do this work on the Raspberry Pi itself if you have two drives connected, or on a separate computer (Windows, Mac, or Linux) if that's easier. The method you choose depends on what hardware you have available and how comfortable you are with command-line tools.

Key Takeaways

  • You can copy a partition using dd (a command-line tool) on the Pi itself, or using graphical tools like Balena Etcher or Win32DiskImager on another computer.
  • Before you start, connect both drives to your Pi or computer, identify which drive is which using lsblk or Disk Management, and back up anything important on the destination drive.
  • The dd method is fastest but requires careful typing — one wrong letter will overwrite the wrong drive permanently.
  • Graphical tools are slower but safer because you select drives by clicking rather than typing device names.
  • After copying, you may need to resize the partition on the new drive if it's larger than the original, using raspi-config or GParted.

Preparing your drives and identifying them correctly

Before you copy anything, you need to know which drive is which. Connecting two drives and then typing the wrong name into a copy command will destroy data on the wrong drive — there is no undo. Take this step seriously.

On the Raspberry Pi itself, open a terminal and type lsblk. This shows every storage device connected to your Pi. You'll see entries like /dev/sda (your source drive) and /dev/sdb (your destination drive). Look at the SIZE column to confirm which is which. Write down the exact names.

If you're working on a Windows computer, open Disk Management (right-click the Start button, select Disk Management). You'll see your drives listed with their sizes. On a Mac, open Disk Utility from Applications > Utilities. On Linux, open a terminal and run lsblk just like on the Pi. In all cases, unplug any USB drives or external storage you don't need — fewer devices means fewer chances to pick the wrong one.

Make sure the destination drive has no files you need to keep. Copying will overwrite everything on it. If it does have files, copy them somewhere else first.

Copying using dd on the Raspberry Pi

The dd command is built into every Raspberry Pi and is the fastest way to copy a partition. It reads every byte from the source drive and writes it to the destination. The downside is that dd has no safety warnings — if you type the wrong drive name, it will silently destroy that drive.

First, shut down any services that might be writing to the source drive. If you're copying the drive your Pi is currently running on, you'll need to boot from a different drive (like a USB stick with Raspberry Pi OS) or do the copy from another computer. If you're copying a drive that's not in use, you can work directly on the Pi.

Open a terminal and type this command, replacing sdX with your source drive and sdY with your destination:

sudo dd if=/dev/sdX of=/dev/sdY bs=4M status=progress

Break this down: if= is the input file (your source), of= is the output file (your destination), bs=4M tells dd to work in 4-megabyte chunks (faster than byte-by-byte), and status=progress shows you how far along the copy is. Press Enter and wait. Copying a 64GB drive takes roughly 15 to 30 minutes depending on your Pi model and drive speed. Do not interrupt it.

When it finishes, you'll see a summary showing how many bytes were copied. The new drive is now an exact duplicate of the old one.

Copying using Balena Etcher on Windows or Mac

Balena Etcher is a graphical tool that makes copying safer because you click to select drives instead of typing names. Download it from balena.io/etcher — it's free and works on Windows, Mac, and Linux.

Connect both your source and destination drives to your computer using USB adapters if needed. Open Balena Etcher. Click "Flash from file" and navigate to your Raspberry Pi drive (if you've already created an image file) or click "Flash from drive" to copy directly from a connected drive. Select your source drive from the list — Etcher shows the size so you can confirm you're picking the right one.

Next, click "Select target" and choose your destination drive. Etcher will warn you if the destination is smaller than the source. Click "Flash" and enter your computer's password when prompted. Etcher will copy the drive and verify the copy when it's done. This takes longer than dd (usually 30 to 60 minutes for a 64GB drive) but the visual confirmation makes mistakes much less likely.

Copying using Win32DiskImager on Windows

If you prefer a lightweight tool on Windows, Win32DiskImager is simpler than Balena Etcher and works the same way. Download it from sourceforge.net/projects/win32diskimager/.

Connect both drives to your Windows computer. Open Win32DiskImager. Click the folder icon next to "Image File" and choose where to save the image, or if you're copying directly, leave this blank. Click the blue folder icon next to the drive dropdown and select your source drive. In the dropdown below, select your destination drive. Double-check the drive letter — this is your last chance to confirm you have them the right way around.

Click "Read" to copy from source to destination. The progress bar will fill as the copy runs. When it's done, safely eject both drives and test the destination drive by connecting it to your Raspberry Pi and powering on.

Resizing the partition if your new drive is larger

If your new drive is bigger than your old one, the copied partition will still be the same size as the original. You'll have unused space on the new drive. To use that space, you need to expand the partition.

The easiest way is to boot your Pi from the new drive and run sudo raspi-config in a terminal. Go to Advanced Options > Expand Filesystem. This automatically resizes the partition to fill the entire drive. Reboot when it's done.

If you're working on a computer instead of the Pi, you can use GParted (a graphical partition tool available on Linux and Windows via live USB). Connect the new drive, open GParted, right-click the partition, and select "Resize/Move". Drag the edge to fill the available space and click Resize. This takes a few minutes depending on drive size.

On Windows, you can also use the built-in Disk Management tool. Right-click the partition, select "Extend Volume", and follow the wizard. This is simpler than GParted but less flexible.

Testing the copied drive and troubleshooting common problems

After copying, connect the new drive to your Raspberry Pi and power on. The Pi should boot normally and all your files should be there. If it doesn't boot, the most common causes are a bad copy, a drive that needs to be reformatted first, or a compatibility issue between the Pi model and the drive.

If the Pi doesn't recognize the new drive at all, try connecting it to a computer and checking whether the drive appears in Disk Management or Disk Utility. If it doesn't show up there either, the drive may be faulty or need to be initialized. On Windows, right-click the drive in Disk Management and select "Initialize Disk". On Mac, open Disk Utility, select the drive, and click "Erase".

If the copy completed but the Pi won't boot, try copying again but this time use a fresh Raspberry Pi OS image as your source instead of copying an existing installation. Sometimes old configurations or corrupted files prevent a copied drive from booting. You can create a fresh image using the Raspberry Pi Imager tool, then copy that instead.

If the new drive works but runs slowly, check whether the drive is USB 2.0 or USB 3.0. Older Pis (models before the Pi 4) don't support USB 3.0 speeds, so they'll run at USB 2.0 speeds regardless. Upgrading to a Pi 4 or newer will let you use faster drives.

Frequently Asked Questions

Can I copy just one partition instead of the whole drive?

Yes. Use dd if=/dev/sdX1 of=/dev/sdY1 (note the "1" at the end) to copy just the first partition. Make sure the destination partition is at least as large as the source. This is useful if you have multiple partitions and only want to copy one.

What if my source drive is still plugged into the Pi while I'm copying?

If the Pi is running from the source drive, the copy will include temporary files and running processes, which wastes space and can cause problems. Boot from a different drive (like a USB stick) or do the copy on another computer. If you must copy while the Pi is running, shut down all services first and accept that the copy may not be perfect.

How long does copying take?

A 64GB drive typically takes 15 to 30 minutes with dd on a Raspberry Pi 4, or 30 to 60 minutes with graphical tools on a computer. Older Pi models and slower drives take longer. USB 2.0 connections are much slower than USB 3.0.

Can I copy to a smaller drive?

Only if the destination drive is at least as large as the data currently on the source drive. If your source is 64GB but only 40GB is used, you can copy to a 50GB drive. Most copy tools will warn you if the destination is too small.

Do I need to format the destination drive before copying?

No. The copy process overwrites the entire drive, so any existing format is replaced. Formatting first doesn't help and wastes time.