Hot answers tagged

23

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) fdisk -l then I use dd to make a diskimage (...


18

Unix dd 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) Open Terminal 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 ...


14

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 ...


14

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 ...


13

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.


12

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 ...


11

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 ...


10

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 ...


10

If you are using sudo i.e. running with root permission you DO NOT have ~ as shortcut for your home directory. Use FULL PATHS or cd to the target directory.


9

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 "...


9

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.


9

I use the following script to backup SD cards on OS X:- #!/bin/bash # script to backup Pi SD card # 2017-06-05 # 2018-11-29 optional name # DSK='disk4' # manual set disk OUTDIR=~/temp/Pi # 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 [ $...


8

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.


8

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 ...


7

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 ...


6

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


6

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 ...


6

You can pipe dd backups into gzip, as the blocks are 0 when unused they are highly compressible. ssh pi@192.168.1.38 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 ...


6

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....


5

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, ...


5

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 ...


5

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. ...


5

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 #!/bin/bash # script to backup Pi SD card # 2017-06-05 # 2018-11-29 optional name # DSK='disk4' # manual set disk OUTDIR=~/temp/Pi # Find disk ...


5

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 rm /srcfs/tmpzero....


5

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.


5

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 ...


4

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 ...


4

From my linux machine I run ssh pi@192.168.1.38 sudo dd bs=4M if=/dev/mmcblk0 | gzip -c > raspberry_dd_4M.img.gz and I just make a point of not doing too much with the pi while its running. 192.168.1.38 is the ip of the Pi


4

If you are using OS X with the dd command, use /dev/rdiskX instead of /dev/diskX and also bs=16m instead of bs=1m it should speed things up a lot.


4

You can use dd to backup the drive. The trick is to use the device as the input, not its partitions. Taking an example from the RPi forum, you can backup and even auto compress the information in one action. To backup the device: sudo dd bs=4M if=/dev/rdisk2 | gzip > /Users/`whoami`/image`date +%d%m%y`.gz To restore the device: sudo bash -c 'gzip -dc /...


Only top voted, non community-wiki answers of a minimum length are eligible