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 ...
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/...
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 ...
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 ...
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 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.
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 ...
You can move the installation of the Raspberry Pi OS to a LVM volume.
But what does it help me?
You can take snapshots from your running system.
You can install software and if you don't like it you can revert to the snapshot.
If you like installed software you can commit the snapshot, in fact delete the snapshot.
It is very easy to make backups on the ...
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 "...
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 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 [ $...
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.
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 ...
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 ...
you may use "--warning=no-timestamp" to skip the timestamp check and allow full extraction of your archive (see http://www.gnu.org/software/tar/manual/html_section/warnings.html for details).
however, that kind of error usually happens with corrupt archives, you'd better double check if all MD5/SHA checksums are correct and if your /boot folder really has ...
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
You can pipe dd backups into gzip, as the blocks are 0 when unused they are highly compressible.
ssh firstname.lastname@example.org sudo dd bs=4M if=/dev/mmcblk0 | gzip -c > raspberry_dd_4M.img.gz
or from a linux card reader
dd if=/dev/sdc bs=4M | gzip > rasppi_4M.img.gz
and the obligatory recovery command
gunzip -dc /home/user/raspberry_dd_4M.img.gz | dd bs=4M ...
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....
Journalling is not a panacea for all possible forms of corruption. Based on reports here, the pi seems to be much more prone to corrupting its primary storage than a normal computer. My only speculation is it has something to do with the power shorting/surging and the SD card reader; while cutting the power suddenly is not a good idea or a habit to get ...
Fortunately the Raspberry Pi can create a backup of itself which is independent of the primary OS used to access the Raspberry (Windows, Linux, Mac).
dd, tar and rsync are different tools to create backups on Linux. All these types of backups can be created by the running Pi provided it's stopping all busy tasks as mysql, smb, dlna, owncloud, seafile, ...
I would guess problem lies in once used sectors that still have dirt in them. Once file is deleted, only metadata is removed from filesystem, not the data itself, thus leaving some random one-zeros instead of easy to compress zero-only blocks.
Easy solution, but requires rewriting all free space on the card. Remember that SD card lifespawn is limited by ...
There is no magic in the image file. It's simply a bit-for-bit copy of a chunk of the sd card. What you want to do is figure out exactly where the second partition ends, and copy from the device file representing the whole card (in this case: /dev/sdb.
Now, look at how your partitions are laid out: in your case, it's partition 1 followed by partition 2. ...
https://www.raspberrypi.org/documentation/linux/filesystem/backup.md explains backup and restoration.
You don't indicate what OS you are using but it is simple on any 'NIX system.
I use the following on macOS
# script to backup Pi SD card
# 2018-11-29 optional name
# DSK='disk4' # manual set disk
# Find disk ...
Already answered here dd-on-entire-disk-but-do-not-want-empty-portion
Assuming you want to save /dev/sdXN to /tgtfs/image.raw and you are root:
mkdir /srcfs && mount /dev/sdXN /srcfs
Use zerofill or just:
dd if=/dev/zero of=/srcfs/tmpzero.txt
To fill unused blocks with zero (wait for it to fill the file system completely then
Best option is a complete clone of your SDCard as a bootable backup.
There's a tool in Raspbian to do that, all you need is a USB reader and a second SDCard that's the same size or bigger than your current SDCard.
You will (sooner or later) run into problems with the approach you're taking. Running dd to back up a running system (or even a mounted drive) is rolling the dice. It's been said of one who follows this practice: "If you're lucky, the filesystem corruption will be detected as soon as you try to mount the copy. If you're unlucky, it won't be detected ...
Short answer -- use 2GB SD card.
Long answer, dd has no idea where the "good" data ends, you have to tell it somehow.
There are two ways, easiest is to use 2GB SD card, that will automatically stop copying beyond 2GB and will result in 500MB compressed file as you desire.
The other way, more complicated an involved one, is to calculate the correct data ...
I faced a similar issue and therefore wrote a tool just for my private use. I decided to call it raspiBackup and made it open source when I thought it may be valuable for the community also. It took me a serious amount of time to make it robust, add parameter checking and error handling so it's usable by the community. Feel free to report issues or create ...