As i found out when I recently tried to move the OS from my Debian desktop to a different hard drive it involves a whole bunch of faffing with live CDs and cloning utils with multiple attempts to get it right followed by endless faffing with grub and bootloaders to get it working properly.
So when it came round to swapping my micro SD card in my Raspberry Pi 3 to a USB M.2 SATA SSD I was hoping it was going to be a little smoother. I'd used the 'dd' command in the past without success but was pleased to see with a bit of googling that Raspian does now come with a bespoke SD card copier. rouble is is that it's a GUI tool. This is quite annoying as you'd expect that most Raspberry Pi users attempting a memory card swap would probably be using a headless system.
Fortunately the code for piclone is available so it's just a case of downloading it and building it. First off we'll need a bunch of libraries installed, the docs say you need all of these:
sudo apt-get install debhelper dh-autoreconf libglib2.0-dev libgtk-3-dev parted dosfstools e2fsprogs coreutils mount uuid zenity dbus-x11 libgtk-3-0
but I also need these as well:
sudo apt-get install libtool automake autoconf nasm pkgconf Now we can download the code from github and unzip it:
wget https://github.com/raspberrypi-ui/piclone/archive/refs/heads/master.zip -O piclone.zip unzip piclone.zip cd piclone-master
and then go on to build it:
sudo ./autogen.sh sudo ./configure sudo make install
there's a bunch output but in then end you should see an entry in your desktop's start menu of "SD Card Copier" or you can just go ahead and launch it from the command line
piclone