redbeardbeer
Posts: 4
Joined: Sat Jul 02, 2016 1:19 am

Re: The Raspberry Pi Backup Thread

Sat Aug 27, 2016 2:57 pm

I restored it again - and it copied files to the mail boot partition and my pi now boots up.

But it doesn't contain any user preferences - or system preferences.
It appears to be a totally blank version of Raspbian.

The apps I installed aren't there (Kodi)
The pi user still exists (I deleted that)
And the new user I created to replace the pi user doesn't exist.

I thought this created an image copy of the config etc of the current install?

barty78
Posts: 1
Joined: Wed Jan 04, 2017 5:37 am

Re: The Raspberry Pi Backup Thread

Wed Jan 04, 2017 5:42 am

Sorry to dig up an old thread, but I'm working on using this script to backup a pi over a windows share (CIFS). I seem to be getting a "No space left on device" error from rsync even though I have sufficient space available on the share.. Seems the loopback device hits 100% part way through the sync. Any ideas?
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)
rsync: write failed on "/mnt/PeriPi-2017-01-04.img/usr/lib/pypy-upstream/bin/pypy": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(322) [receiver=3.0.9]
rsync: recv_generator: mkdir "/mnt/PeriPi-2017-01-04.img/usr/lib/pypy-upstream/lib-python/2.7/json/tests" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/PeriPi-2017-01-04.img/usr/lib/pypy-upstream/lib-python/2.7/lib-tk/test" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/PeriPi-2017-01-04.img/usr/lib/pypy-upstream/lib-python/2.7/lib2to3/fixes" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/PeriPi-2017-01-04.img/usr/lib/pypy-upstream/lib-python/2.7/lib2to3/pgen2" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/PeriPi-2017-01-04.img/usr/lib/pypy-upstream/lib-python/2.7/lib2to3/tests" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
rsync: connection unexpectedly closed (386429 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
[email protected]:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 30643136 3295084 26052628 12% /
/dev/root 30643136 3295084 26052628 12% /
devtmpfs 470416 0 470416 0% /dev
tmpfs 94944 240 94704 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 189880 0 189880 0% /run/shm
/dev/mmcblk0p1 57288 19424 37864 34% /boot
//Y700/PiBackups 976760828 640517320 336243508 66% /mnt/pi_backups
/dev/loop1p2 1777428 1750312 0 100% /mnt/PeriPi-2017-01-04.img
/dev/loop1p1 57214 19168 38046 34% /mnt/PeriPi-2017-01-04.img/boot

jcdauchy
Posts: 1
Joined: Mon Jan 09, 2017 7:51 pm

Re: The Raspberry Pi Backup Thread

Mon Jan 09, 2017 7:58 pm

Hello

I am hitting the same issue, the second partition seems to be limited to 3.5Gb.

I have spent one day trying to understand why we are hitting this issue but I can't find out as the partition layout seems to be fine.

I remove the copy process, here is the output of mount / umount :

Code: Select all

Starting SD Image backup process
Attaching /data/backup/raspercy/raspercy-2017-01-09.img to /dev/loop0
Mounting /dev/loop0p1 and /dev/loop0p2 to /mnt/raspercy-2017-01-09.img/
--- SPACE ---
Sys. fich.     Taille Util. Dispo Uti% Monté sur
/dev/root         59G  7,4G   49G  14% /
devtmpfs         459M     0  459M   0% /dev
tmpfs             93M  932K   92M   1% /run
tmpfs            5,0M  4,0K  5,0M   1% /run/lock
tmpfs            186M     0  186M   0% /run/shm
/dev/mmcblk0p1    56M   20M   37M  36% /boot
/dev/sda1        2,7T  2,4T  163G  94% /media/Mp3
/dev/sdb1        2,7T  2,5T   72G  98% /media/Photos
/dev/loop0p2     3,5G  7,2M  3,3G   1% /mnt/raspercy-2017-01-09.img
/dev/loop0p1      56M     0   56M   0% /mnt/raspercy-2017-01-09.img/boot
--- SPACE ---
--- FS ---
tune2fs 1.42.5 (29-Jul-2012)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          b28c2a61-8c07-4ca3-9408-151f9a274421
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         unsigned_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              233856
Block count:              934912
Reserved block count:     46745
Free blocks:              902007
Free inodes:              233844
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      228
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8064
Inode blocks per group:   504
Flex block group size:    16
Filesystem created:       Mon Jan  9 17:00:24 2017
Last mount time:          Mon Jan  9 20:57:40 2017
Last write time:          Mon Jan  9 20:57:40 2017
Mount count:              3
Maximum mount count:      -1
Last checked:             Mon Jan  9 17:00:24 2017
Check interval:           0 (<none>)
Lifetime writes:          65 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      9fb076ca-543b-46fd-a4b3-d3d326a88721
Journal backup:           inode blocks

Disk /dev/loop0: 64.0 GB, 64021856256 bytes
255 heads, 63 sectors/track, 7783 cylinders, total 125042688 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: 0x00098d89

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/loop0p2          122880   125042687    62459904   83  Linux
--- FS ---
Flushing to disk
Unmounting /dev/loop0p1 and /dev/loop0p2 from /mnt/raspercy-2017-01-09.img/
Detaching /data/backup/raspercy/raspercy-2017-01-09.img from /dev/loop0
SD Image backup process completed.
See rsync log in /data/backup/raspercy/raspercy-2017-01-09.img-20170109205740.log

dilithiumx
Posts: 1
Joined: Wed Feb 01, 2017 6:19 pm

Re: The Raspberry Pi Backup Thread

Wed Feb 01, 2017 6:36 pm

jinx wrote:I have now attempted to create a utility script which can be used to perform a standard backup (using rsync) with more error handling than before.
I have also added the possibility to optionally compress the image after backup, as well as abilities to mount and unmount the image (and in theory any Raspberry Pi dist image) so that data can be viewed, restored or edited, and a Ctrl-C interrupt trap, which should allow you to stop lengthy processes as rsync or gzip while still trying to exit gracefully.
I've added this script (copied from the attached file verbatim) to a github repository here (https://github.com/lzkelley/bkup_rpimage) to make it easier for people to quickly download, add improvements, and raise issues. I have no idea what I'm doing, so if people want to join-in / takeover management (especially the script creator: @jinx) that would be great. Hope this is helpful!

ejolson
Posts: 2166
Joined: Tue Mar 18, 2014 11:47 am

Re: The Raspberry Pi Backup Thread

Thu Feb 02, 2017 12:49 am

dilithiumx wrote:I've added this script (copied from the attached file verbatim) to a github repository here (https://github.com/lzkelley/bkup_rpimage) to make it easier for people to quickly download, add improvements, and raise issues. I have no idea what I'm doing, so if people want to join-in / takeover management (especially the script creator: @jinx) that would be great. Hope this is helpful!
Seems like a lot of scripting for 2 rsync commands. Still, the script is nicely written and may serve to remind people what rsync options are suitable.

tlc76
Posts: 2
Joined: Tue Mar 06, 2018 1:15 pm

Re: The Raspberry Pi Backup Thread

Tue Mar 06, 2018 1:40 pm

Thanks for the great script! I ran it on a 8GB sd card and I have some "enhancements" to propose to you:

- add verification to ensure the sdimage argument contains a file not a directory (I executed it first time with a dir name and the script totally went haywire)

- when gzip option is used, pipe dd output to gzip in order to save a lot of time and useless I/Os and/or network traffic (depending on the location of the outputted image) and perform both operations at the same time. For example, I use a nfs mount (exported from my NAS) to save the gzipped image and it took an extra 51 minutes just to execute the gzip command on a 8 GB image file (FYI all in/out traffic was made via a 100Mb wired network connection with peaks of 11 MB/sec, which is the maximum possible over the 100Mb pi's ethernet port).
In order to do this, the do_compress() function should be reworked to include the below command and also the main program logic should be changed (as the do_compress will do also the do_create part):

Code: Select all

dd if=/dev/zero bs=$(blockdev --getss $SDCARD) count=0 seek=$(blockdev --getsz $SDCARD) | gzip > ${IMAGE}.gz.tmp
Thanks for looking at these suggestions :)
Cristian

sviudes
Posts: 5
Joined: Tue Dec 24, 2013 4:16 pm

Re: The Raspberry Pi Backup Thread

Fri Nov 30, 2018 10:03 am

I'm getting this message when I run @jinx script:

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).


The img file is created. But... should I worry because of this message?

Return to “General discussion”