Home Lab Article Series - How to migrate Raspberry Pi system to a larger SD card?

This article was last updated on: February 7, 2024 pm


In fact, I wanted to write this topic for a long, long time, but I kept it out for various reasons.

… (The hard years are omitted here)…
My wife and I eventually bought a house together in a second-tier city around a first-tier city.
After that, together for the renovation, she was responsible for the non-electricity related and I was responsible for the electricity related decoration.
Family networking, home laboratory is formed step by step with the formation of the family:

  1. Home wired and wireless networking
  2. Smart home
  3. NAS
  4. Public IP and IPv6
  5. Wake Online (WOL)
  6. Home network security (😂 look at the firewall logs to know how often they can be hacked)
  7. Play with the Raspberry Pi
  8. Form a Full Mesh network
  9. Mobile phone PAD remote control computer

With the so-called “home lab”, my own professional skills have more opportunities for experimentation and testing ground, and my understanding of new technologies is no longer superficial;
With the so-called “home laboratory”, even if you are traveling between places, you can see every bit of our experience and the child’s experience through the mobile phone, and happiness lingers in our hearts.

It is rare for a polytechnic man to be so pretentious, this is the preface…

Introduction to the Raspberry Pi

📝 Reference:

  • It can be your small, dual-display flat, desktop computer
  • It can also be robot brain, smart home center, media center, network artificial intelligence core, factory controller and so on.

Essentially a hardware-based arm64 CPU, software OS Linux-based PC/board/device…
With rich interfaces:

  • USB-C
  • HDMI
  • Wired network card

and good ecology:

  • As an edge device (IoT) gateway, etc
  • As a soft route
  • As a NAS multimedia center

It has a high level of playability and customization capabilities.


Familiar with Linux pairs and Raspberry Pi is easy to use.

Change the SD card background

The default storage of the Raspberry Pi is a micro SD (TF) card, and at the beginning I used a 32G TF card, and the performance was also average.

Just on Double 11, the price of digital 3C equipment was reduced, and I wanted to buy a fast/large capacity TF card to replace.

After looking around, I took a fancy to this one and placed an order:

SanDisk TF 卡至尊极速 256GB

What you fancy is its speed:

  • Read speeds up to 190MB/s
  • Write speeds up to 130MB/s

Place an order!

How do I migrate a Raspberry Pi system to a larger SD card?

Once received, start drying!



  • Linux computer (MAC is also OK, Linux computer for this demonstration; Windows computers, you can choose to use Aomei’s Easy Backup)
  • Raspberry Pi
  • Old TF card
  • New TF cards and card readers


  • Linux is a file-based operating system: Linux manages the data and hardware resources in the computer in the form of files, that is, everything is a file, which is reflected in the Linux file type: ordinary files, directory files (that is, folders), device files, link files, pipe files, socket files (data communication interfaces) and so on.
  • Direct utilization dd command to migrate files in full
    • First migrate to an intermediate device, the file name of the full system is called: ‘’
    • Then migrate from the intermediate device to the new TF card
  • Reuse the Raspberry Pi’s raspi-config Complete the expansion

Detailed steps

Back up old data

Shut down the Raspberry Pi, remove the TF card, insert it into your Linux computer, and view the path to the device:


The results are as follows:

旧的 TF 卡 lsblk 结果

Here the device corresponding to the TF card is named:sdb, the corresponding path is:/dev/sdb

execute dd Back up the data to the non-Linux host sdb Under the directory:

sudo dd if=/dev/sdb bs=1M of=backup-sd-card-1.img

The results are as follows:

should backup-sd-card-1.img Files are the entire Raspberry Pi system, including all ordinary files, directory files (that is, folders), device files, link files, pipe files, socket files (data communication interfaces) and so on.

Migrate to a new device

Remove the TF card from your Linux computer, insert the new TF card, and view the path to the device:


The results are as follows:

新的 TF 卡 lsblk 结果

Here the device name corresponding to the new TF card is still as follows:sdb, the corresponding path is still:/dev/sdb

execute dd To perform a data migration, will backup-sd-card-1.img Migrate to a new TF card:

sudo dd if=backup-sd-card-1.img bs=1M of=/dev/sdb

树莓派系统迁移到新 TF 卡上

As shown above, the migration is complete and ready to boot. (There is an ominous premonition when I see the speed of the last line here,46.2MB/s – It seems that the write speed may not be as high 😟 as claimed)

Insert a new TF card into the Raspberry Pi and start capacity expansion

Insert the new TF card into the Raspberry Pi and boot, if executed at this time df -h If you look at the file system size, you will see that it is still only 32G. We need to scale up logically:


sudo raspi-config

The details are as follows:

选择 6: Advanced Options

选择 A1: Expand Filesystem


背后执行的是 fdisk 命令


After restarting, check again df -h The space has been expanded:

casey in raspberrypi in ~
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 189G 11G 171G 7% /
devtmpfs 763M 0 763M 0% /dev
tmpfs 925M 172K 925M 1% /dev/shm
tmpfs 370M 860K 370M 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 31M 222M 13% /boot

Check the services on your Raspberry Pi system, such as:k3s pi-hole etc. also operate normally.

Did it achieve the desired effect?

The capacity has definitely been reached. But what about read and write speed?

Let’s measure it, use it hdparm and fio Test random read and random write separately (this is more in line with the usage scenario of the OS system disk):

hdparm Test

casey in raspberrypi in ~ took 5s
❯ lsblk
mmcblk0 179:0 0 238.3G 0 disk
|-mmcblk0p1 179:1 0 256M 0 part /boot
`-mmcblk0p2 179:2 0 238G 0 part /
hdparm -tT /dev/mmcblk0

The results are as follows:

hdparm 结果

  • Buffer disk read: 43.23 MB/s


cd ~
fio -filename=randw-singlethread -fallocate=none -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=libaio -bs=32k -size=1000M -runtime=30s -numjobs=1 -name=hdparm-randwsinglethread

The results are as follows:

fio 结果

  • IOPS: 448
  • Write speed only: 14MB/s


This article is a chapter in the Home Lab series - Playing with the Raspberry Pi.
Raspberry Pi to replace the system disk, which is much easier than Windows, direct use dd command to complete.
However, after the test, the author does not recommend that you use the TF card as the Raspberry Pi system disk, because the speed is really not up.
The read and write speed of TF is far worse than that of SSD, which is a physical injury. It is recommended that you play Raspberry Pi in the future and use the SSD directly as a system disk (additional power supply may be required).


Home Lab Article Series - How to migrate Raspberry Pi system to a larger SD card?
Posted on
November 19, 2022
Licensed under