Setup rpi-clone

Install rpi-clone: Instructions about how to Install and configure rpi-clone.

rpi-clone Instructions: Use these command prompt commands carefully as they can introduce drastic changes to your Linux operating system.

If you follow this Install Proceedure carefully, you should get a good Install of rpi-clone.
HTML Templates

Welcome to the Setup rpi-clone Page

***************** Install and Use rpi-clone: *****************

Cloning the microSD Card while Rpi is Running with rpi-clone

If you want to clone your existing installation to another microSD card,
then RPI-Clone will do the task.

First, ssh into the Rpi and login with the Username and Password.

Next, issue the following command to the Rpi prompt to
set the file system to Read/Write.


NOTICE: Place the SD Card into an SD Card to USB Adapter. Then,
Insert the Adapter into one of the USB Ports on the Raspberry pi.
The SD Card and the Adapter must be inserted before running any of
the following commands. The SD Card must be present to insure success
of the cloning process.

If you have an internal USB to TTL converter make sure
the USB port you plug into is not the one that the internal
converter is connected to on the pi. On many hotspots this
is the top right USB port and it cannot be used as an external
USB port once the internal USB to TTL converter is installed.

Run the following three commands from the Rpi prompt to install rpi-clone:

git clone
cd rpi-clone
sudo cp rpi-clone rpi-clone-setup /usr/local/sbin

Next, Run a quick test with:

sudo rpi-clone-setup -t testhostname

This will appear on the Rpi after issuing the above command.

        testhostname      -target    hostname
Testing setup:   copying files to   /tmp/clone-test
    cp   /etc/hostname   /tmp/clone-test/etc/hostname
    cp   /etc/hosts   /tmp/clone-test/etc/hosts
This test run will modify those files.
/tmp/clone-test/etc/hostname   -   set   newhostname   "testhostname" in lines:         testhostname

It is best to repeat all 4 of the above commands on each subsequent run
of rpi-clone. This will insure that all of the sub-directories are intact, and
that the file system is ready to run rpi-clone.

Next, issue this command to the Rpi prompt.

sudo rpi-clone sda

The following in the black box should be seen in the ssh session
after running the sudo rpi-clone sda command. It will stop a few times
waiting for input. Just press Enter and it will continue. This output
will be similar but different depending on the size of the source disk,
the size of the destination disk, and the data on the source disk.

pi-star@pi-star-03(rw):~$ sudo rpi-clone sda

Booted disk: mmcblk0 31.9GB          Destination disk: sda 31.0GB
Part     Size       FS    Label                   Part        Size           FS         Label
1 /boot     66.0MB      fat16     --                         1               31.0GB    fat32     --
2 root       31.8GB        ext4      --
== Initialize: IMAGE mmcblk0 partition table to sda - FS types mismatch ==
1 /boot                         (24.1MB used)     :    IMAGE to sda1 FSCK
2 root                           (1.8GB used)        :    RESIZE (31.0GB) MKFS SYNC to sda2
Run setup script : no
Verbose mode : no
** WARNING ** : All destination disk sda data will be overwritten!
                                : The partition structure will be imaged from mmcblk0.

Initialize and clone to the destination disk sda? (yes/no): y
Optional destination ext type file system label (16 chars max):

    Imaging past the start of /boot partition 2.
    => dd if=/dev/mmcblk0 of=/dev/sda bs=1M count=71 ...
    Resizing last partition to end of disk ...
    Resize success.
    Changing destination Disk ID ...
    Delaying so partprobe can update /dev entries ...
    => fsck -p /dev/sda1 ...
    => mkfs -t ext4 /dev/sda2 ...
Syncing file systems (can take a long time)
Syncing mounted partitions:
    Mounting /dev/sda2 on /mnt/clone
    => rsync // /mnt/clone with-root-excludes ...
    Mounting /dev/sda1 on /mnt/clone/boot
    => rsync /boot/ /mnt/clone/boot ...

Done with clone to /dev/sda
    Start - 20:46:10 End - 20:49:09 Elapsed Time - 2:59

Cloned partitions are mounted on /mnt/clone for inspection or customizing.

Hit Enter when ready to unmount the /dev/sda partitions ...
    unmounting /mnt/clone/boot
sudo rpi-clone sda     unmounting /mnt/clone

This clone operation should require between 1 and 5 minutes depending on the size
of the SD Card and the size of the image to be cloned.

Notice that the above clone took 2 Minutes and 59 Seconds.

Remove the USB Adapter from the Rpi and remove the new cloned SD Card from the USB
Adapter. The SD Card is an exact copy of the SD Card still running in the Rpi.

If desired, power down the Pi and place the cloned SD Card into the Rpi and then power
up the Rpi, which will boot with the cloned installation.
Rpi should run normal just as it did with the original.

If an error occurs, The below in the black box will be presented.

Cannot find 'sda' in the partition table. The partition table is:
major   minor   #blocks   name
  1     0   4096    ram0
  1     1    4096    ram1
  1     2    4096    ram2
  1     3    4096    ram3
  1     4    4096    ram4
  1     5    4096    ram5
  1     6    4096    ram6
  1     7    4096    ram7
  1     8    4096    ram8
  1     9    4096    ram9
  1     10   4096    ram10
  1     11   4096    ram11
  1     12   4096    ram12
  1     13   4096    ram13
  1     14   4096    ram14
  1     15   4096    ram15
  179    0    15544320    mmcblk0
  179    1    43925    mmcblk0p1
  179    2    15495168    mmcblk0p2
pi@raspberrypi:/data/www $