guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Raspberry Pi Backup error.

Wed Jul 21, 2021 10:48 pm

Hello,

I'm using this tutorial to back up (clone) my raspberry pi: https://youtu.be/00ck25k_lgw at the 3:09 mark (https://youtu.be/00ck25k_lgw?t=188) is where I run into my issue. I go to create an image, after naming and selecting my folder I hit the "Start Creating..." button, I get the error:

Error unmounting filesystem - Error unmounting /dev/mmcblk0p2: target is busy (udisks-error-quark, 14)

what am I doing wrong? :?:

fivenote
Posts: 27
Joined: Sun Dec 06, 2020 3:52 pm

Re: Raspberry Pi Backup error.

Thu Jul 22, 2021 3:30 am

This works…

https://www.raspberrypi.org/documentati ... /backup.md

See section “SD Card Image”

I backup/restore/clone images all the time with this method.

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Thu Jul 22, 2021 7:04 am

fivenote wrote:
Thu Jul 22, 2021 3:30 am
This works…

https://www.raspberrypi.org/documentati ... /backup.md

See section “SD Card Image”

Just don't backup the system you're running on with dd. Sooner or later, you will end up with a backup image that has a corrupted filesystem.

image-backup will backup a running system without this problem. Only files will be backed up (not empty sectors), making the image file considerably smaller. Plus, you can incrementally update the image file (replacing only changed files), saving a lot time compared to repeatedly doing full backups.

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:12 pm

I downloaded the zip from viewtopic.php?f=29&t=247568 extracted it in my downloads folder. Went into my Terminal and cd to the Downloads folder. typed in "image-backup /Downloads/testBackup.img" and then I got "bash: image-backup: command not found". How do I get this to work?

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:17 pm

guruabyss wrote:
Sat Jul 31, 2021 10:12 pm
I downloaded the zip from viewtopic.php?f=29&t=247568 extracted it in my downloads folder. Went into my Terminal and cd to the Downloads folder. typed in "image-backup /Downloads/testBackup.img" and then I got "bash: image-backup: command not found". How do I get this to work?

Did you make it executable?:

Code: Select all

chmod +x image-backup

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:25 pm

I typed that command (in the folder that has the image-backup) and nothing happened.

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:29 pm

guruabyss wrote:
Sat Jul 31, 2021 10:25 pm
I typed that command (in the folder that has the image-backup) and nothing happened.

chmod doesn't say anything if it was successful setting the requested permission(s).

When in the folder that contains image-backup, what happens when you type?:

Code: Select all

sudo ./image-backup

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:34 pm

Perfect!! Thank you!!!

Do I want to add space for incremental updates after shrinkage? If so how much (I have a 32GB SD)?

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:37 pm

guruabyss wrote:
Sat Jul 31, 2021 10:34 pm
Perfect!! Thank you!!!

Do I want to add space for incremental updates after shrinkage? If so how much (I have a 32GB SD)?

That's up to you. Are you going to be doing incremental backups? If so, how much free space do you want to allocate to the image file to accommodate any future expansion? Only you can answer those questions.

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 10:46 pm

This image will be used to help bootstrap all the customizing I did. If one of my SD cards die I just want to re-image the new SD, load up and then I can do updates from terminal if I need to. With that said do I need to add space and if so what would you recommend?

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:01 pm

guruabyss wrote:
Sat Jul 31, 2021 10:46 pm
This image will be used to help bootstrap all the customizing I did. If one of my SD cards die I just want to re-image the new SD, load up and then I can do updates from terminal if I need to. With that said do I need to add space and if so what would you recommend?

Regardless of whether there is any free space in the image file, when you restore it and run it the first time, it will auto-expand to use all available space on the device.

Additional space in the image file for incremental backups is so you can update the image file later with any changes or additions that have occurred since the previous backup. This is easier and faster than making a completely new backup every time you want to backup. Only you can estimate how much additional space you will need. If you don't expect to add anything to an original backup, you can specify 0. If you think you're going to put 2.5 GB of new stuff on the SD card and would like to simply have image-backup be able to update the current image with the new stuff instead of doing a new/total backup, then 2.5 GB would be the number. An image file can't be expanded after it's first created. If you added additional free space when you created it, you can use that additional space during subsequent incremental updates. Once the image file has no more free space, you have to start over with a fresh/initial backup.

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:06 pm

When it's starting "Full backup" how long goes it take on an almost fresh install of Raspberry pi? It kind of looks like it's not doing anything so I don't want to close terminal or shut the pi off.

Thank you for your time and help!

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:15 pm

guruabyss wrote:
Sat Jul 31, 2021 11:06 pm
When it's starting "Full backup" how long goes it take on an almost fresh install of Raspberry pi? It kind of looks like it's not doing anything so I don't want to close terminal or shut the pi off.

The time it takes depends on the number and size of source files and how fast the source and destination media are.

image-backup is silent by default so it can be run from a cron job. If you would like rsync to report everything it's doing, add the following to the command line:

Code: Select all

--options --progress

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:19 pm

Awesome! The backup finished so I'll see how well it works. Quesiton the image is only 9 gigs, if I copy it to a 32GB card will it use the whole unallocated space or do I need to expand that once I copy the image to a new SD card?

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:25 pm

guruabyss wrote:
Sat Jul 31, 2021 11:19 pm
Will I know it finished when theres a .img in /media, or when finished terminal update to show the default pi@raspberrypi: ?

The command prompt will simply return when it's finished.

While it's OK to backup directly to /media or /mnt, backing up to the SD card you're running on will be much slower. Also, it's a bad choice because if your SD card croaks, you'll have lost your backup. Normally, you mount a storage device (USB flash drive, SSD, etc.) on /media or /mnt and use that as the destination of the backup.

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:27 pm

guruabyss wrote:
Sat Jul 31, 2021 11:19 pm
Quesiton the image is only 9 gigs, if I copy it to a 32GB card will it use the whole unallocated space or do I need to expand that once I copy the image to a new SD card?

The first time you run the device to which the image file was written, it will auto-expand to use the entire device.

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sat Jul 31, 2021 11:48 pm

While it's OK to backup directly to /media or /mnt, backing up to the SD card you're running on will be much slower. Also, it's a bad choice because if your SD card croaks, you'll have lost your backup. Normally, you mount a storage device (USB flash drive, SSD, etc.) on /media or /mnt and use that as the destination of the backup.
Oh.... well the SD didn't croak while backing it up on the same SD. Is that img ok to use or should I put an external drive hooked up and do the backup to that instead?

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sun Aug 01, 2021 12:00 am

guruabyss wrote:
Sat Jul 31, 2021 11:48 pm
Oh.... well the SD didn't croak while backing it up on the same SD. Is that img ok to use or should I put an external drive hooked up and do the backup to that instead?

The image file is fine. The SD card is just not a good place to create or store it. I would move it to an external drive for safe-keeping and do all future backups to an external drive.

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sun Aug 01, 2021 5:15 pm

Great! Thank you! When it comes to extracting the img to a new SD, looking over the notes you provided I need to"

image-mount

I've never done this before, is there a tutorial to see how this is done?

RonR
Posts: 2282
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspberry Pi Backup error.

Sun Aug 01, 2021 6:12 pm

guruabyss wrote:
Sun Aug 01, 2021 5:15 pm
When it comes to extracting the img to a new SD, looking over the notes you provided I need to"

image-mount

I've never done this before, is there a tutorial to see how this is done?

To restore a backup image file to a device (SD card or USB drive), you would simply write that backup image file to the device using image writing software such as Etcher. The procedure is identical to how you wrote the original Raspberry Pi OS image file to a device.

image-mount allows you to mount an image file as if it were a physical device. image-mount is normally used when you want to simply extract individual files from an image file, not to restore the entire image file to a device.

guruabyss
Posts: 68
Joined: Wed Sep 25, 2019 7:54 pm

Re: Raspberry Pi Backup error.

Sun Aug 01, 2021 7:02 pm

I want to thank RonR and fivenote for replying. It’s users like you guys that make this community awesome <3

Return to “Troubleshooting”