This is the simplest way to backup your pi.
(Photo by Markus Winkler on Unsplash)
Backing up your raspberry pi is fairly straightforward. Here's my quick and easy guide. Script by Mark at projektor.co.uk
Requirements
Raspberry pi
USB drive for backup
Instructions
Assuming you have no other drives connected to your pi.
Insert a USB pen drive into your raspberry pi.
Issue the following command:
wget -c https://raw.githubusercontent.com/markcity/pibackup/a2fd2b9697a61a6e3f8c8b60546ac7a54abe8041/makeimage.sh;bash ./makeimage.sh
When completed you will have an image of your pi on the USB stick.
You can safely remove the USB stick.
Want to restore the image?
Use Win32DiskImager - download link https://sourceforge.net/projects/win32diskimager/
For reference, the script contains the following lines.
#create a variable today using the current date in the format Year-Month-Date
today=$(date +"%Y-%m-%d")
#set up a folder to map to the usb drive
sudo mkdir /media/usb
#make the new folder owned / writeable by the user
sudo chown -R pi:pi /media/usb
#map / mount the usb stick at the folder /media/usb
sudo mount /dev/sda1 /media/usb -o uid=pi,gid=pi
#just in case, give the raspberry pi ability to write to NTFS file format
sudo apt-get install ntfs-3g
#use dd command to backup the 'mmc' - SD card to a file
sudo dd if=/dev/mmcblk0 of=/media/usb/pi_img_${today}.img bs=1M
#unmount the USB card so it can be
sudo umount /dev/sda1


![PHP: How to get todays date in ISO format compatible with MySQL [answered] PHP: How to get todays date in ISO format compatible with MySQL [answered]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5FazTkks6Poj85gfBcxELXDOtAKLIsa5mTpi_Fo6O3llHpi27Cnw_NWjfu_-gMMa8xfjzGruIlkoYmIlpz8TTT3OhqFrJet6vcJydEMuDtlTj3TRjTqCV0zICUrU-7YMGNYivtEd22Ag/w320-h320/phpsquare.png)