Clone Raspberry Pi Sdcard while online
There are some people asking how to clone Raspberry Pi card while it is on and naturally I am researching on the solution that make it possible. I stumble across rpi-clone project in github and decided to give this a try. So here are some instruction on how I manage to clone my RaspPi Sdcard while online.
Step 1. Terminal service to your Raspberry Pi
Use ssh terminal service to your raspberry pi
Step 2. Download the rpi-clone repository
Use the following command to download the repsitory
$ git clone https://github.com/billw2/rpi-clone.git
$ cd rpi-clone
$ sudo cp rpi-clone rpi-clone-setup /usr/local/sbin
Step 3. Test run
Use the following command to trial run
$ sudo rpi-clone-setup -t testhostname
If all goes well, you can check that the file under /tmp/clone-test that it had been edited correctly
Step 4. Insert your new SDcard (preferably the same size)
Insert your new SDCard into the USB card ready and plug it into the USB slot on the raspberry Pi. Then use the following command to see how it was recognised
$ vi /proc/partitions
You should see a list of all the memory devices, as shown below.
In the picture above you can see that my sdcard is recognised as sda
Step 5. Clone the SDCard
To clone the sdcard you can simply run the following command.
$ sudo rpi-clone sda
For details you can watch the following video, there are some additional steps in the video that might not be necessary but good to have to check that everything went well. In the video you might see the first attempt failed as I am using a bigger size SDCard 128 GB. So instead I swap the disk and use the one that is of the same size, which is 32 GB.
I hope you like this post and thanks for watching.