Giter VIP home page Giter VIP logo

raspibackup's People

Contributors

dependabot[bot] avatar desertrider avatar docyester avatar framps avatar franjo-g avatar googlebeevil avatar hofei90 avatar kmbach avatar mgrafr avatar p1r473 avatar seaniedan avatar simssj avatar springjunky avatar tytouc avatar vsc55 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspibackup's Issues

raspiBackupRestore2Image.sh fails RC112

From the log:

20171026-162244: DBG << calcSumSizeFromSFDISK 64013265920
20171026-162244: DBG -- sourceSDSize: 64013265920 - targetSDSize: 64012419072
20171026-162244: DBG -- sourceBlockSize: 124932096 - adjusted targetBlockSize: 124930442
20171026-162244: MSG !!! RBK0004W: Zweite Partition wird von 59.57 GiB auf 59.57 GiB angepasst.
20171026-162244: DBG >> resizeRootFS
20171026-162244: DBG -- RESTORE_DEVICE: /dev/loop0
20171026-162244: DBG -- ROOT_PARTITION: /dev/loop0p2
20171026-162244: DBG -- partitionLayout of /dev/loop0
20171026-162244: DBG -- Disk /dev/loop0: 59,6 GiB, 64012419072 bytes, 125024256 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
Disklabel type: dos
Disk identifier: 0x19aa3ab1

Device Boot Start End Sectors Size Id Type
/dev/loop0p1 8192 93813 85622 41,8M c W95 FAT32 (LBA)
/dev/loop0p2 94208 125026303 124932096 59,6G 83 Linux
20171026-162245: DBG -- PartitionStart:
20171026-162245: MSG ??? RBK0111E: Fehler beim Erstellen der Partitionen.RC
.
20171026-162245: DBG >> exitError 112
20171026-162245: DBG << exitError 112
20171026-162245: DBG >> cleanup
20171026-162245: DBG >> cleanupRestore
20171026-162245: DBG -- Got trap EXIT
20171026-162245: DBG -- rc: 112
20171026-162245: DBG >> isMounted /tmp/raspiBackup
20171026-162245: DBG -- /dev/root
20171026-162245: DBG << isMounted 1
20171026-162245: DBG -- Deleting dir /tmp/raspiBackup
20171026-162245: MSG ??? RBK0077E: Restore wurde fehlerhaft mit RC 112 beendet. Siehe vorhergehende Fehlermeldungen.
20171026-162245: DBG << cleanupRestore - exit with 112
20171026-162245: DBG >> cleanupTempFiles
20171026-162245: DBG -- Removing mailfile /root/script/raspiBackup.maillog
20171026-162245: DBG << cleanupTempFiles
20171026-162245: DBG -- Terminate now with rc 112

After restore raspberry pi to a new micro card, It can not connect to internet.

I restored the 'tgz' format file to my new micro sdcard, when finished . put the new micro sdcard into raspberry pi3 . After it power on , the screen show : "failed to start dhcpcd on all interfaces". raspberry can't connect internet , and then I execute command "sudo systemctl disable dhcpcd.service" ,reboot . the raspberry can't connect internet too.
I think if there are some stuff caused inconsistent backup. Everything is ok before backup.
If there should be do any initialization after restore to a new sdcard? It looks like some configurations of network card had changed after backup. such as eth0 ,eth1.

Language C not supported.

Hi i get the error Message ??? RBK0096E: Language C not supported.
How could i fix this ?
Many thanks.

Backup failed.

--- RBK0085I: Backup of type tar started. Please be patient.

??? RBK0021E: Backupprogram for type tar failed with RC 2.
--- RBK0007I: Starting services: 'service nfs-common start %1%1 service cron start'.
--- RBK0026I: Saving logfile in /root/raspberrypi-raspiBackup.log.
--- RBK0043I: Removing incomplete backup in /backup/raspberrypi/raspberrypi-tar-backup-20180318-195037. This will take some time. Please be patient.
--- RBK0105I: Deleting new backup directory /backup/raspberrypi/raspberrypi-tar-backup-20180318-195037.
??? RBK0005E: Backup failed. Check previous error messages for details.

RBK0142E: Unable to detect boot device

Hi,

I'm trying to use raspiBackup but I get this error:

lpuerto@opl-cubox:~$ sudo raspiBackup.sh -a : -o : -m detailed
--- RBK0009I: opl-cubox: raspiBackup.sh V0.6.3.2a (1d77d56) started at Tue Apr 24 13:39:54 EEST 2018.
--- RBK0128I: Using logfile /backup/opl-cubox/opl-cubox-rsync-backup-20180424-133954/opl-cubox-backup.log.
--- RBK0116I: Using config file /usr/local/etc/raspiBackup.conf.
??? RBK0142E: Unable to detect boot device.
--- RBK0026I: Saving logfile in /home/lpuerto/opl-cubox-raspiBackup.log.
--- RBK0105I: Deleting new backup directory /backup/opl-cubox/opl-cubox-rsync-backup-20180424-133954.
??? RBK0005E: Backup failed. Check previous error messages for details.

Instead of using a USB as backup device I'm using a folder in an already mounted hard drive, so:

# path to store the backupfile
DEFAULT_BACKUPPATH="/srv/dev-disk-by-label-OpL1TB/Backups"

Do you know what could be the problem here?

I'm not using it on raspbian, but in armbian.

Permissions after restore

Hi @framps

I have used your code to backup and restore a raspbian created with NOOBS. It was a dd backup and it has been restore with sudo ./raspiBackup.sh -Z -d DEVICE BACKUP

It looks it's working but the permissions of the filesystem are wrong (root is not the owner anymore):

image

And I get errors like sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set.

Any idea how can I fix it?

Thank you!

raspiBackup requires perl

Please check if perl installed. If perl is not installed, then you get empty lines with no information. There is no error message. You only see blank lines. I think of testing for perl in the begining of the script like the check for BASH. Tested on VoidLinux for Raspberry Pi.

Can't Create File to USB disk

sudo mount -o rw /dev/sda1 /backup
raspiBackup.sh

error message:

raspiBackup.sh V0.6.3.2 (81d74e1) started at Sun 18 Mar 19:41:59 HKT 2018.
mkdir: cannot create directory ‘/backup/raspberrypi/raspberrypi-tar-backup-20180318-194159’: Operation not permitted
??? RBK0172E: Unable to create directory /backup/raspberrypi/raspberrypi-tar-backup-20180318-194159.

rsync error

Thanks for your great tool!

I have a problem with my installation.

I get this error message and do not know how to fix this.

… 20180102-113322: DBG -- mountpoint /boot: 179:1 mountpoint /: 179:2 20180102-113322: DBG -- part: /dev/mmcblk0p1 20180102-113322: DBG -- BOOT_DEVICE: mmcblk0 20180102-113322: DBG -- BOOT_DEVICENAME: /dev/mmcblk0 20180102-113322: DBG >> getPartitionPrefix: mmcblk0 20180102-113322: DBG << getPartitionPrefix: mmcblk0p 20180102-113322: DBG -- BOOT_PARTITION_PREFIX: mmcblk0p 20180102-113322: DBG << inspect4Backup 20180102-113322: DBG >> commonChecks 20180102-113322: DBG << commonChecks 20180102-113322: DBG >> getFsType: /media/nas-backup 20180102-113322: DBG << getFsType: 20180102-113322: DBG -- Found partitions on /dev/mmcblk0: 2 20180102-113322: DBG >> isPathMounted: /media/nas-backup 20180102-113322: DBG -- Path: /media/nas-backup 20180102-113322: DBG << isPathMounted: 0 20180102-113322: DBG >> supportsHardlinks: /media/nas-backup 20180102-113322: DBG -- Links: 2 20180102-113322: DBG << supportsHardlinks: 0 20180102-113322: DBG >> supportsSymlinks: /media/nas-backup 20180102-113322: DBG -- Links: 1 20180102-113322: DBG << supportsSymlinks: 20180102-113322: DBG -- rsync version: 3.1.2 20180102-113322: MSG ??? RBK0019E: Option -a und -o nicht angegeben. 20180102-113322: DBG >> exitError 107 20180102-113322: DBG << exitError 107 20180102-113322: DBG >> cleanup 20180102-113322: DBG >> cleanupBackup 20180102-113322: DBG -- Got trap EXIT 20180102-113322: DBG -- rc: 107 …

I hope you could help me.

Best,
Jan

Add option which returns the current version

raspiBackup has a lot of options but there is no way to retrieve the current version. -v is already used to enable verbose mode.
The option parser should be enhanced to accept option --version to return the current version of raspiBackup.

Installation: line 248: !msgVar: unbound variable

Hi,

I am running OSMC on a Rasp Pi 3. I just typed : curl -s -L -O https://www.linux-tips-and-tricks.de/raspiBackupInstall.sh && sudo bash raspiBackupInstall.sh
I received the fellowing error: Installation: line 248: !msgVar: unbound variable
It is a clean install, I have just install transmission client and amba via the app store, mysql via apt-get and syncthing.

Did I miss something or is it a bug?

Add timestamps to logs being output by raspibackup

in essence

  1. add a timestamp to each log line generated
  2. remove timestamping information inside the log itself

format of timestamp, I suggest a simple, easy to parse if needed
date +'%m-%d-%Y %T'

example instead of this
--- RBK0009I: jeedom-cugy: raspiBackup.sh V0.6.3.1 (590ae9c) started at Fri Mar 9 05:00:01 CET 2018.
--- RBK0128I: Using logfile /mnt/usblogs/jeedom-cugy/jeedom-cugy-rsync-backup-20180309-050001/jeedom-cugy-backup.log.
--- RBK0116I: Using config file /usr/local/etc/raspiBackup.conf.
--- RBK0031I: Checking whether new version is available.
--- RBK0159I: Checking for beta version.

generate this
03-09-2018 08:13:21 - RBK0009I: jeedom-cugy: raspiBackup.sh V0.6.3.1 (590ae9c) started
03-09-2018 08:13:21 - RBK0128I: Using logfile /mnt/usblogs/jeedom-cugy/jeedom-cugy-rsync-backup-20180309-050001/jeedom-cugy-backup.log.
03-09-2018 08:13:22 - RBK0116I: Using config file /usr/local/etc/raspiBackup.conf.
03-09-2018 08:13:22 - RBK0031I: Checking whether new version is available.
03-09-2018 08:13:22 - RBK0159I: Checking for beta version.

Dash (-) in -a or -o parameter string leads to "option required"

Example commandline:
sudo /usr/local/bin/raspiBackup.sh -F -o "service avahi-daemon stop" -a ":" -k 3 -t ddz -L current -l debug -m detailed -v /backup
leads to the error
??? RBK0090E: Option -o requires a parameter.

This is caused by the dash (-) in the avahi-daemon string.
The same command with service cron stop works as expected.
The issue also regards to the -a parameter.

This is version
Version: 0.6.3.2 CommitSHA: 81d74e1 CommitDate: 2018-03-11 CommitTime: 08:35:59

lg, Christian

Use a more granular option parsing

Right now options can be turned on or toggled via command line options. There is no way to turn an option off via command if it's turned on in a config file.

When using fake mode an empty backup directory is created

20171006-194136: MSG  --- RBK0128I: Using logfile /home/pi/raspberry-backups/raspberrypi/raspberrypi-dd-backup-20171006-194134/raspberrypi-backup.log.
20171006-194136: MSG  --- RBK0116I: Using config file /usr/local/etc/raspiBackup.conf.
20171006-194136: MSG     !!! RBK0124W: Fake mode on.
20171006-194136: MSG        --- RBK0141I: Saving space of defined partitions only.
20171006-194136: MSG        --- RBK0151I: Using backuppath /home/pi/raspberry-backups.
20171006-194136: MSG              --- RBK0008I: Stopping services: 'service cron stop'.
20171006-194137: MSG           --- RBK0081I: Creating backup of type dd in /home/pi/raspberry-backups/raspberrypi/raspberrypi-dd-backup-20171006-194134.
sfdisk: Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
20171006-194138: MSG              --- RBK0003I: Backup size will be truncated from 29.72 GiB to 14.87 GiB.
20171006-194138: MSG              --- RBK0085I: Backup of type dd started. Please be patient.
20171006-194138: MSG              --- RBK0007I: Starting services: 'service cron start'.
20171006-194139: MSG           --- RBK0010I: raspberrypi: raspiBackup.sh V0.6.3 (d19c32d) stopped at Fri  6 Oct 19:41:39 CEST 2017.
20171006-194139: MSG        --- RBK0017I: Backup finished successfully.

Testing in VM

Before using the script on my precious pi projects I wanted to try it on a dummy VM first. It seems that it requires a /dev/sd to be present. Is the script really only applicable on pi?

Restore process hangs on security question (user confirmation)

I wanted to test a simple restore (.img file to device) but the script seems to be hanging when the user should confirm the restore:

--- RBK0009I: beemon: raspiBackup.sh V0.6.3.1 (590ae9c) started at Thu 14 Dec 12:48:07 CET 2017.
--- RBK0128I: Using logfile /raspiBackup.log.
--- RBK0116I: Using config file /usr/local/etc/raspiBackup.conf.
--- RBK0138I: Using bootbackup /backups/dd-backup-20171213-190402.img.
--- RBK0068I: Using bootpartition backup files starting with backup from directory /backups/dd-backup-20171213-190402.img.
!!! RBK0065W: Device /dev/sda will be repartitioned and all data will be lost.

I have to ctrl+c the script. I also noticed that the bash does not show any inputs anymore after stopping the script. Only reset revolves this issue. Seems to me that there could be some issues with reading from tty. Maybe I will find some time later to go deeper and find the root cause.

Or is there a known workaround?

Backup /etc/fstab as extra file

Hello framp!

For simplification of a restore, I'd like to request that every backup type should copy the /etc/fstab file as an extra file into the backup directory as plain text file.

I've noticed that especially "Windows" guys (that also involves me) have troubles to recover the mounts to re-access the backup volume in case of a restore (or at least it is time consuming to figure out the settings).
With a plain copy of the fstab it is a copy/paste job to re-enable the backup mount to further process the restore operation.

Regards, Christian

no backup on systems with only "one" partition

on a beaglebone black you can install your linux on "one" partiton. Specialy to the on-board EMMC storage. You get the error ??? RBK0142E: Unable to detect boot device. The /boot is on the / file system and there is no seperate mountpoint for /boot. This beaglebone is running Parabola Linux.
onefilesystem.txt

Multiple processes are started

When I start a backup via cron or manually, it runns smoothly for quite some time.

--- RBK0009I: orangepipc: raspiBackup.sh V0.6.1.3b um Sun Feb 5 20:48:25 CET 2017 gestartet
--- RBK0128I: Logdatei ist /mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-204823/orangepipc-backup.log
--- RBK0116I: Konfigurationsdatei /usr/local/etc/raspiBackup.conf wird benutzt
--- RBK0008I: Services werden gestoppt: '/etc/init.d/samba stop'
--- RBK0081I: Backup vom Typ tgz wird in /mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-204823 erstellt
--- RBK0085I: Backuperstellung vom Typ tgz läuft. Bitte etwas Geduld
--- RBK0036I: Partitionslayout wird gesichert
--- RBK0044I: Backup der Bootpartition wird in /mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-204823/orangepipc-backup.img erstellt
--- RBK0044I: Backup des Partitionlayouts wird in /mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-204823/orangepipc-backup.sfdisk erstellt
--- RBK0046I: Backup des Masterbootrecords wird in /mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-204823/orangepipc-backup.mbr erstellt

After a while, a new backup is started every minute.
This is an extract from ps -ef:

root 16412 1 0 22:02 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 16528 16412 0 22:02 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 16529 16412 0 22:02 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 16530 16528 0 22:02 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 16532 16529 0 22:02 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 16752 16412 1 22:02 ? 00:00:04 dd if=/dev/mmcblk0p1 of=/mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-220202/orangepipc-backup.img bs=1M
root 16815 1 0 22:03 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 16915 16815 0 22:03 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 16916 16815 0 22:03 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 16917 16915 0 22:03 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 16918 16916 0 22:03 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 17128 16815 0 22:03 ? 00:00:03 dd if=/dev/mmcblk0p1 of=/mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-220302/orangepipc-backup.img bs=1M
root 17207 1 0 22:04 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 17323 17207 0 22:04 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 17324 17207 0 22:04 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 17325 17323 0 22:04 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 17327 17324 0 22:04 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 17547 17207 0 22:04 ? 00:00:02 dd if=/dev/mmcblk0p1 of=/mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-220401/orangepipc-backup.img bs=1M
root 17622 1 0 22:05 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 17713 17622 0 22:05 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 17714 17713 0 22:05 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 17715 17622 0 22:05 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 17717 17715 0 22:05 ? 00:00:00 tee -a /home//orangepipc-raspiBackup.log
root 17937 17622 0 22:05 ? 00:00:02 dd if=/dev/mmcblk0p1 of=/mnt/BackupNas/orangepipc/orangepipc-tgz-backup-20170205-220501/orangepipc-backup.img bs=1M
root 18026 1 0 22:06 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 18168 18026 0 22:06 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas
root 18169 18026 0 22:06 ? 00:00:00 /bin/bash /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas

This is the command executed: /usr/local/bin/raspiBackup.sh -t tar -e [email protected] -k 30 -z -n /mnt/BackupNas &> /dev/null
I am running an OrangePi PC with Armbian.

Unable to boot a restored backup when using Jessie

Root cause is that Jessie uses partuuid instead of partition names now. Therefore a dumb restore of the backup doesn't work any more and some postprocessing of /boot/cmdline.txt and /etc/fstab is required when the backup was restored.

Possible to see the Status running on commandline

Hello Framp

Is it possible to integrate an program like pv to see the Status from the raspibackup when your are starting the program from the commandline ?

for ex. : dd if=/dev/sdX | pv | dd of=/pfad/zur/datei

btw. i tried to create an message on your Website but i cannot see any Picture for captcha verification ..

regards John

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.