acrobotic / Ai_Samples_RPi

Example code for using the Raspberry Pi 2 with various electronic and mechanical components.
10 stars 6 forks source link

Add backup/restore instructions #1

Open lucasrangit opened 9 years ago

lucasrangit commented 9 years ago

Astutely observed by Adam, the entire OS, configuration, and applications for the Raspberry Pi are stored on the removable SD card, so backing it up is as simple as copying the SD card.

Participants should perform a regular backup of their SD card as they would version their code. This is especially useful for having a backup in the demo gods are not happy come demo day.

lucasrangit commented 9 years ago

Testing using dd to read.

sudo dd bs=4M if=/dev/sdb | pv | gzip > rpi_backup-date +%Y%m%d.gz

Will also try ddrescue in case the flash media is starting to fail to read or write.

lucasrangit commented 9 years ago

http://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi has some recommendations. And http://sysmatt.blogspot.com/2014/08/backup-restore-customize-and-clone-your.html has a script but it may assume a two partition layout whereas my RPi 2 has the following partition table after installing Raspbian using NOOBS and adding an expanded data partition.

$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 7892 MB, 7892631552 bytes
4 heads, 16 sectors/track, 240864 cylinders, total 15415296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009fdca

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            8192     1673828      832818+   e  W95 FAT16 (LBA)
/dev/sdb2         1679360    15349759     6835200   85  Linux extended
/dev/sdb3        15349760    15415295       32768   83  Linux
/dev/sdb5         1687552     2736127      524288   83  Linux
/dev/sdb6         2744320     2867199       61440    c  W95 FAT32 (LBA)
/dev/sdb7         2875392    15349759     6237184   83  Linux