jeebo
Posts: 69
Joined: Tue Mar 28, 2017 3:55 pm

rpi-clone on Jessie

Thu May 25, 2017 8:34 am

Hi Guys,

I am trying to get rpi-clone working on Jessie to try and backup my SD Card whilst its actively running.

I have tried to clone the github repository, which failed, tried to download the rpi-clone with wget, which failed, and now I am just feeling a tad lost as to why its not working!

Any ideas? I expect I have missed the simple or obvious?

User avatar
B.Goode
Posts: 8842
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: rpi-clone on Jessie

Thu May 25, 2017 9:02 am

jeebo wrote:I have tried to clone the github repository, which failed, tried to download the rpi-clone with wget, which failed
I expect I have missed the simple or obvious?

One simple/obvious thing would be to explain exactly how the steps you attempted failed, preferably by posting the resulting error messages if any.

jeebo
Posts: 69
Joined: Tue Mar 28, 2017 3:55 pm

Re: rpi-clone on Jessie

Thu May 25, 2017 9:09 am

I can completely agree, however, I have none.

The failure is that I couldnt even get it to start...

I tried the following commands, all of which error saying they dont exist.

Code: Select all

wget https://github.com/billw2/rpi-clone (file downloaded)
ls (returned desktop,docs,downloads,etc and "rpi-clone"
$ unzip rpi-clone-master.zip
$ cd rpi-clone-master
$ cp rpi-clone /usr/local/sbin

Code: Select all

wget https://github.com/billw2/rpi-clone (file downloaded)
ls (returned desktop,docs,downloads,etc and "rpi-clone"
$ git clone https://github.com/billw2/rpi-clone.git 
$ cd rpi-clone
$ cp rpi-clone /usr/local/sbin
Perhaps I am following release notes rather than an idiot proof tutorial, I dont know, but I cannot even get the process to start.

The other method I am trying is this:

Code: Select all

sudo su
cat /etc/fstab
dd if=/dev/mmcblk0p2 of=/dev/sda
So far its working away, however I would have thought it needs to take both partitions, mmcblk0p1 and 0p2, and put them both into the same image, as I get the feeling, if I was to swap the sda SD Card after this completes, and replace it with the 0px card in the pi right now, it wont boot?

jeebo
Posts: 69
Joined: Tue Mar 28, 2017 3:55 pm

Re: rpi-clone on Jessie

Thu May 25, 2017 10:53 am

as I expected.

Code: Select all

sudo su
cat /etc/fstab
dd if=/dev/mmcblk0p2 of=/dev/sda
failed running it on its own, however I am not sure this can be ammended to move 0p1 to sda1, so will give that a try!

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: rpi-clone on Jessie

Thu May 25, 2017 12:16 pm

You're downloading the github location as html. You need to clone the repository. It gives instructions in the README.

Code: Select all

$ git clone https://github.com/billw2/rpi-clone.git 
$ cd rpi-clone
$ cp rpi-clone /usr/local/sbin
There are 10 types of people: those who understand binary and those who don't.

User avatar
B.Goode
Posts: 8842
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: rpi-clone on Jessie

Thu May 25, 2017 9:07 pm

Apart from a couple of places where use of root/superuser privilege is required, the documentation in the README at the https://github.com/billw2/rpi-clone repository appears to be correct for both of the alternative installation methods. Transcripts below.

Manual download and unzip:

Code: Select all

[email protected] ~/jeebo $ wget https://github.com/billw2/rpi-clone/archive/master.zip
--2017-05-25 21:43:01--  https://github.com/billw2/rpi-clone/archive/master.zip
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/billw2/rpi-clone/zip/master [following]
--2017-05-25 21:43:02--  https://codeload.github.com/billw2/rpi-clone/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.253.120, 192.30.253.121
Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘master.zip’

master.zip              [ <=>                  ]   6.92K  --.-KB/s   in 0.004s

2017-05-25 21:43:02 (1.78 MB/s) - ‘master.zip’ saved [7082]

[email protected] ~/jeebo $ unzip master.zip
Archive:  master.zip
f961aee3f9816d345c2df335aa96b3907ee68b09
   creating: rpi-clone-master/
  inflating: rpi-clone-master/README.md
  inflating: rpi-clone-master/rpi-clone
[email protected] ~/jeebo $ cd rpi-clone-master/
[email protected] ~/jeebo/rpi-clone-master $ cp rpi-clone /usr/local/sbin
cp: cannot create regular file ‘/usr/local/sbin/rpi-clone’: Permission denied
[email protected] ~/jeebo/rpi-clone-master $ sudo cp rpi-clone /usr/local/sbin

[email protected] ~/jeebo/rpi-clone-master $ rpi-clone
Error: Error opening /dev/mmcblk0: Permission denied
Error: Error opening /dev/mmcblk0: Permission denied
rpi-clone needs to be run as root.

[email protected] ~/jeebo/rpi-clone-master $ sudo rpi-clone

usage: rpi-clone sdN {-f|--force-initialize} {-v|--verbose} {-x}
    Example:  rpi-clone sda
    -v - list all files as they are copied.
    -f - force initialize the destination partitions
    -x - use set -x for very verbose bash shell script debugging

    Clone (rsync) a running Raspberry Pi file system to a destination
    SD card 'sdN' plugged into a Pi USB port (via a USB card reader).
    rpi-clone can clone the running system to a new SD card or can
    incrementally rsync to existing backup Raspberry Pi SD cards.

    If the destination SD card has an existing fat16 partition 1 and a
    ext4 partition 2, rpi-clone assumes (unless using the -f option)
    that the SD card is an existing backup with the partitions
    properly sized and set up for a Raspberry Pi.  All that is needed
    is to mount the partitions and rsync them to the running system.

    If these partitions are not found (or -f), then rpi-clone will ask
    if it is OK to initialize the destination SD card partitions.
    This is done by a partial 'dd' from the running booted device
    /dev/mmcblk0 to the destination SD card /dev/sdN followed by a
    fdisk resize and mkfs.ext4 of /dev/sdN partition 2.
    This creates a completed fat16 partition 1 containing all boot
    files and an empty but properly sized partition 2 rootfs.
    The SD card  partitions are then mounted and rsynced to the
    running system.

    The SD card destination partitions will be mounted on /mnt/clone.
    A log will be written to /var/log/rpi-clone.log.
    It's better to avoid running other disk writing programs
    when running rpi-clone.

    Version 1.5
[email protected] ~/jeebo/rpi-clone-master $
Clone github repository:

Code: Select all

[email protected] ~/jeebo $ git clone https://github.com/billw2/rpi-clone.git
Cloning into 'rpi-clone'...
remote: Counting objects: 58, done.
remote: Total 58 (delta 0), reused 0 (delta 0), pack-reused 58
Unpacking objects: 100% (58/58), done.
Checking connectivity... done.
[email protected] ~/jeebo $ cd rpi-clone/
[email protected] ~/jeebo/rpi-clone $ sudo cp rpi-clone /usr/local/sbin
[email protected] ~/jeebo/rpi-clone $ sudo rpi-clone

usage: rpi-clone sdN {-f|--force-initialize} {-v|--verbose} {-x}
    Example:  rpi-clone sda
    -v - list all files as they are copied.
    -f - force initialize the destination partitions
    -x - use set -x for very verbose bash shell script debugging

    Clone (rsync) a running Raspberry Pi file system to a destination
    SD card 'sdN' plugged into a Pi USB port (via a USB card reader).
    rpi-clone can clone the running system to a new SD card or can
    incrementally rsync to existing backup Raspberry Pi SD cards.

    If the destination SD card has an existing fat16 partition 1 and a
    ext4 partition 2, rpi-clone assumes (unless using the -f option)
    that the SD card is an existing backup with the partitions
    properly sized and set up for a Raspberry Pi.  All that is needed
    is to mount the partitions and rsync them to the running system.

    If these partitions are not found (or -f), then rpi-clone will ask
    if it is OK to initialize the destination SD card partitions.
    This is done by a partial 'dd' from the running booted device
    /dev/mmcblk0 to the destination SD card /dev/sdN followed by a
    fdisk resize and mkfs.ext4 of /dev/sdN partition 2.
    This creates a completed fat16 partition 1 containing all boot
    files and an empty but properly sized partition 2 rootfs.
    The SD card  partitions are then mounted and rsynced to the
    running system.

    The SD card destination partitions will be mounted on /mnt/clone.
    A log will be written to /var/log/rpi-clone.log.
    It's better to avoid running other disk writing programs
    when running rpi-clone.

    Version 1.5

If basic operations such as wget, ls, cd and cp do not work correctly on your system then it may be corrupted in such a way that using a tool such as rpi-clone may be inappropriate since it even if it can be made to work it may simply create another copy of that corrupted system.

jeebo
Posts: 69
Joined: Tue Mar 28, 2017 3:55 pm

Re: rpi-clone on Jessie

Thu Jun 08, 2017 12:16 pm

Thanks all, I have been distracted and away recently so I need to try and get this up and running some point soon.

I know human error is a factor there as well, I just have to learn to work around that part!

Return to “Advanced users”