Raspberry Pi backup

Source: Internet
Author: User

Raspberry Pi backup

We strongly recommend that you regularly back up important files. Backup is usually not limited to user files, but also configuration files, databases, installed software, settings, and even system snapshots.


Here we will guide you through some backup technologies to back up your Raspberry Pi system.

Home folder (Home Directory)


A better method for backing up the Home directory is to useTarCommand to generate a directory snapshot compressed file, and then copy it to your PC or cloud storage. Run the following command to back up the home directory:

cd /home/tar czf pi_home.tar.gz pi

Here, a tar compressed file named pi_home.tar.gz is created under the/home/directory. You can copy the file to another device on a USB or network.


MYSQL

If you use the MySQL database on Raspberry Pi, it is also important to back up the database. Back up a single database, you can useMysqldumpCommand:

mysqldump recipes > recipes.sql

To restore a database from a backup file, you need to import the backup file in mysql and provide the certificate (if needed) and database name.

Note that the database must already exist, so create it first:

mysql -Bse "create database recipes"cat recipes.sql | mysql recipes

In addition, you can also use the pv command (not installed by default, you need to useApt-get install pvCommand installation) view the progress of MySQL's backup file processing. This is useful for large files:

pv recipes | mysql recipes

Sd card image (sd card image)

You may need to back up the entire SD card image so that you can recover to the new SD card when the original SD card is lost or damaged. You can back up the SD card by writing the image to the SD card, but in reverse order.


On Linux or Mac systems, for example:

sudo dd bs=4M if=/dev/sdb of=raspbian.img

An image file will be created on your PC. You can write the image file to another SD card to copy the same content and settings. Recover or copy to another SD card.DdCommand, but in turn:

sudo dd bs=4M if=raspbian.img of=/dev/sdb

For more information, see installing SD card imagers.

AUTOMATION)
You can write a Bash script to automate the execution of these backup operations, or even use cron to regularly execute these operations.

Address: http://www.raspberrypi.org/documentation/linux/filesystem/backup.md

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.