If you are running Linux then you can use the dd command to make a full backup of the image:
dd if=/dev/sdx of=/path/to/image
or for compression:
dd if=/dev/sdx | gzip > /path/to/image.gz
Where sdx is your SD card.
To restore the backup, you reverse the commands:
dd if=/path/to/image of=/dev/sdx
or when compressed:
gzip -dc /path/to/image.gz | dd ...
Here's an intro to using rsync for back-up on the Pi. Once the initial back-up is created, keeping it up to date this way is much much faster than constantly ripping the entire image. You can do this to a local hard drive or over a network.
You actually do not want a complete copy of a running system as a back-up, since some of the stuff ostensibly in the ...
On the Mac you don't want to be using /dev/diskn. You should use /dev/rdiskn instead, where n is the number the OS uses to identify your SD card. This decreases the time required to copy by a huge amount.
So for the optimal backup process on a Mac, I would recommend doing the following:
Run diskutil list, and find the disk corresponding to your Raspberry ...
Besides those block-level backups, there are two common approaches to deal with the sources: to archive it continuously (1), or to use the revision control system (2).
We are going to use the command-line (any local terminal or SSH connection to a Raspberry Pi machine), right?
tar czvf your-raspberry-project-top-level-dir-v1.0.tgz ...
You can run this command from your Linux PC with lots of space:
ssh root@raspberrypi gzip -c /dev/mmcblk0 > img.gz
As a prerequisite you'll need to have generated .ssh keys and copied the id_XXX.pub over to /root/.ssh/authorized_keys.
It's possible to have issues with the file system since it's a live backup, but if your Raspberry Pi isn't real busy it ...
A working script from the Raspberry Community made by a member there.
You can reuse and tweak the code how ever you like.It is well documented and self explanatory.
# Setting up directories
echo "Starting RaspberryPI backup process!"
# First check if pv package is installed, if not, install it ...
If you are using Windows:
Download Win32 Disk Imager.
Create the file path you wish to use to save your image. (I use C:\RasPi_Bkp)
Run Win32 Disk Imager
Browse to your backup file path spot, and type a file name.
Make sure the device shown in the drop down to the right of your file path is the one you want to back up.
You mention in a comment to RooTer that A) you have reduced the initial partition size with gparted, but dd still copies the whole card, and B) that you want to include both partitions in the image.
Issue "A" is easy to explain: you are still copying the whole card because that's what /dev/mmcblk0 refers to. The individual partitions are of course /dev/...
On Linux or OSX I use dd to make a backup from SD card. Reverse if and of (i.e. to where they point - source and destination) afterwards to restore, but be careful not to restore to a wrong disk. It will be destroyed without a warning!!!
First use fdisk to get the device id of you SD card (check the size)
then I use dd to make a diskimage (...
I'm boring and use the ancient dd command in OS X.
Plug your sdcard into your Mac
Open Disk Utility
Select your sdcard and take note of its Device name
(Mine is usually /dev/disk2)
Find out your username by typing whoami and pressing the Return key.
(REPLACE disk AND sjobs WITH THE CORRECT VALUES BEFORE RUNNING!!!)
(FAILURE TO SET ...
I have adapted @goldilocks answer on rsync for back-up on the pi.
I backup to an ext4 partition on a HDD mounted on the Pi.
If the HDD is not mounted, rsync would copy to the mount directory (until the SD Card is full).
If the HDD is not mounted in rw mode copious error messages are produced.
Neither of these is desirable, so I check that my partition is is ...
From http://www.raspberrypi-spy.co.uk/2012/06/overclocking-benchmarking-the-raspberry-pi/, I learned that the /boot directory actually resides in a specific partition that is readable directly from Windows (and probably many other OSes...).
So I just have to insert the card in my laptop, edit the file, et voilà...
So the best way I have found is to use GParted (you can either use a Linux-based OS, or boot from a GParted Live USB). It is simple enough to find detailed instructions on how to do each of these steps in detail, but here is the general method I have found to work:
Run GParted, find your SD card in the device list and shrink the main partition to as small ...
It indeed is possible, with rpi-clone by Bill Wilson. You will need an USB CF card reader to attach to your RPi. Obviously, the actual memory used on the original SD card must be smaller that the space on the target SD card.
The basic idea is to download rpi-clone and use it from a booted RPi to (prepare and) copy to the target SD card in the reader. One ...
Rsnapshot fulfills those criteria:1
Can be used locally or remotely.
Can be automated/scheduled.
Uses numbered incremental backups.
I don't have much personal experience with it beyond the fact that it's used on servers I work on, where it has saved the day occasionally, but there seems to be a nice introduction here, the Arch linux wiki, which tends to ...
I run Raspbian and use dd and cron to do automated backups of my SD card to my external USB drive.
It is a really simple solution. It runs once a week at 2 am on a Monday morning and makes an image of the SD card.
I wrote a script which shuts down services such as lighttpd and cron, to minimise the risk of the SD card being written to in the middle of ...
If your programs are all in the pi userid, there's really no reason to back up the entire filesystem, as is being suggested. what I do is to just back up the single id. I run the command:
tar -czf pi.tgz *
from pi's home directory, which creates the file pi.tgz, containing all the files and directories contained there (excluding hidden files). I then scp ...
If you have problems with SD-cards you should try (in order):
Use another (bigger) power supply.
Connect a powered hub in between the Raspberry and any USB peripheral you may have.
Use SD-cards of well known brands.
Use a bigger SD-card (for distributed wear leveling).
Set your rootfs to read-only and thus avoid writing to the SD-card.
Use a "...
I also think this is a good setup. I currently do run a Raspberry Pi, connected directly with a 3.5'' USB 2.0 hard disk (Western Digital, 1.5 TB) with external power, and it works like a charm: I get hourly backups when I'm home, and the Raspberry is also an excellent file/media server.
I get 23MB/s instead of 30MB/s on the hard disk, but that's still quite ...
I use the following script to backup SD cards on OS X:-
# script to backup Pi SD card
# 2018-11-29 optional name
# DSK='disk4' # manual set disk
# Find disk with Linux partition (works for Raspbian)
# Modified for PINN/NOOBS
export DSK=`diskutil list | grep "Linux" | sed 's/.*\(disk[0-9]\).*/\1/' | uniq`
if [ $...
Not quite. You would overwrite the partition tables when you re-image it and replace said tables with the ones from the image. After your imaging program is done, it would release the file handle to the image file, but since the partition where the file is stored technically doesn't exist anymore, your program can't read it again. In theory, it would work ...
The raspi-config tool, at least in recent Raspbian releases (September 19th, 2012), allows you to hold the Shift key during boot to return to a non-overclocked state. This worked for me when my device didn't finish booting at 1000MHz.
You can now choose from one of five overclock presets in raspi-config,
the highest of which runs the ARM at 1GHz. The ...
After reading all of this and many other opinions, I tried rpi-clone by Bill Wilson. It worked perfectly first try and was actually much easier than the instructions made it sound. Thanks myhd for recommending it.
The exists a nice tool called pishrink which reduces the size of a dd image as much as possible by shrinking the root partition. If you start up the restored image the first time the partition is expanded to it's maximum size again. If you run Windows just use your Linux on your Raspberry to shrink the image.
I recently had to make a backup image for my Raspberry Pi 3 Model B and found an incredibly helpful guide from Beebom.
The guide outlines the process for cloning and restoring a Pi SD image for all three operating systems. (Windows - Linux - MacOS). For this detailed and helpful guide visit:
How to Clone Raspberry Pi SD Card on Windows, Linux and macOS.
I have three Pis running in my local net and need to backup them on a regular base with cron when they are up and running. That's why I created a script which is able to create dd, tar and rsync backups and to restore them. I prefer to use rsync for my backups but other folks prefer dd or tar. It's used by a lot of people already. Hope it's useful for others ...
I've boxed one of my Raspberry with a micro USB hub and a 500GB HD to backup critical directories of my 2TB NAS via rsync. (Just the ones that I cannot afford to lose).
Both the Rpi and the hub are powered by a 5V-2A power adapter (7€). Everything works very well.
I'm so satisfied that I've bought a 2 slots USB HD dock like the one here. One of these days ...
You could do this if you have a Linux computer, but it is far from straightforward.
I suggest you backup your data and do a fresh install of Raspbian.
If you have data you want to preserve you could follow the suggestions in:- https://raspberrypi.stackexchange.com/a/5492/8697
There are at least two options to create bootable mSD clones, depending on whether you prefer a UI or the terminal:
pi clone which gets installed alongside with the Pixel desktop.
the rpi-clone script from https://github.com/billw2/rpi-clone, which does roughly the same job, but without any UI. Clone the GitHub repository, and chmod u+x rpic-clone/rpi-clone....