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

Re: Image File Utilities

Sat May 23, 2020 9:55 pm

max11 wrote:
Sat May 23, 2020 9:47 pm
pi@raspberrypi:~ $ sudo image-backup
sudo: image-backup: command not found

What is wrong?

Linux doesn't automatically consider the current directory as being in your execution PATH. Therefore, you have to execute things that are in your current directory with:

Code: Select all

sudo ./image-backup

max11
Posts: 56
Joined: Tue May 14, 2019 12:48 pm

Re: Image File Utilities

Sat May 23, 2020 10:29 pm

Yes, thanks, i just found that out too ...

Have a nice weekend - stay safe
Maxx11

User avatar
TerryC65
Posts: 202
Joined: Sat May 09, 2015 7:50 am
Location: Wimborne, Dorset, UK

Re: Image File Utilities

Mon Jun 15, 2020 11:23 am

I can strongly recommend this tool, see my posting at viewtopic.php?f=28&t=277218&p=1679441#p1679441.

User avatar
Botspot
Posts: 1536
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Image File Utilities

Tue Jun 23, 2020 3:47 pm

I'm trying to use image-backup.
Setup: 1TB HDD with an empty FAT32 partition filling the entire disk. This is the backup destination drive.
It's mounted to /media/pi/fs.
I'm trying to backup my root device - it's a hybrid boot, so it boots from the sd card, to a 250GB SSD that contains rootfs.
When attempting to run this command:

Code: Select all

sudo /home/pi/image-utils/image-backup --initial /media/pi/fs/backup.img
I get this error:

Code: Select all

truncate: failed to truncate '/media/pi/fs/backup.img' at 69252153344 bytes: File too large

Unable to create image file
Is this caused by having root and boot mounted to two separate devices like this? Am I doing something wrong here?
Want to run Minecraft Java on your RPi? Easiest way is with Pi-Apps - just click Install.
https://github.com/Botspot/pi-apps
Pi-Apps also includes Zoom, Visual Studio, Tor browser, Windows 10 theme, and 33 more.
Over 50,000 users!

fbe
Posts: 648
Joined: Thu Aug 17, 2017 9:08 pm

Re: Image File Utilities

Tue Jun 23, 2020 4:38 pm

Have you got a FAT32 filesystem on your HDD or exFAT?

User avatar
Botspot
Posts: 1536
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Image File Utilities

Tue Jun 23, 2020 4:41 pm

fbe wrote:
Tue Jun 23, 2020 4:38 pm
Have you got a FAT32 filesystem on your HDD or exFAT?
FAT32.
I see that running the command creates an empty zero byte file at the path.
Want to run Minecraft Java on your RPi? Easiest way is with Pi-Apps - just click Install.
https://github.com/Botspot/pi-apps
Pi-Apps also includes Zoom, Visual Studio, Tor browser, Windows 10 theme, and 33 more.
Over 50,000 users!

fbe
Posts: 648
Joined: Thu Aug 17, 2017 9:08 pm

Re: Image File Utilities

Tue Jun 23, 2020 4:45 pm

You can't create files with more than 4GB size on FAT32 filesystems.

User avatar
Botspot
Posts: 1536
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Image File Utilities

Tue Jun 23, 2020 4:48 pm

fbe wrote:
Tue Jun 23, 2020 4:45 pm
You can't create files with more than 4GB size on FAT32 filesystems.
🤦🏻‍♂️
Edit: Image-backup worked flawlessly on a EXT4 partition.
Want to run Minecraft Java on your RPi? Easiest way is with Pi-Apps - just click Install.
https://github.com/Botspot/pi-apps
Pi-Apps also includes Zoom, Visual Studio, Tor browser, Windows 10 theme, and 33 more.
Over 50,000 users!

jvbragt
Posts: 1
Joined: Sat Jul 04, 2020 10:12 am

Re: Image File Utilities

Sat Jul 04, 2020 10:17 am

Hi,

When I want to write a image to my Synology NAS I am getting the error that the disk is full. Starting full backup (for incremental backups, run: ./image-backup /mnt/image/rasp.img)
rsync: write failed on "/tmp/img-backup-mnt/home/pi/image/rasp.img": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(374) [receiver=3.1.3]

But when I write to an external USB disk it seems to work. I want to write to my NAS, is this possible?

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

Re: Image File Utilities

Sat Jul 04, 2020 6:38 pm

jvbragt wrote:
Sat Jul 04, 2020 10:17 am
When I want to write a image to my Synology NAS I am getting the error that the disk is full. Starting full backup (for incremental backups, run: ./image-backup /mnt/image/rasp.img)
rsync: write failed on "/tmp/img-backup-mnt/home/pi/image/rasp.img": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(374) [receiver=3.1.3]

But when I write to an external USB disk it seems to work. I want to write to my NAS, is this possible?

image-backup uses 'truncate', 'sfdsk', and 'mkfs' to create the backup image file on the destination device. I suspect your Synology NAS may not support one or more of these operations. Is the rasp.img file on the Synology NAS the size you requested? Does the error occur immediately after the "Starting full backup..." message?

BF69
Posts: 18
Joined: Sat May 13, 2017 9:44 am

Re: Image File Utilities

Tue Jul 21, 2020 3:22 pm

I've had image_utils running now for a bit to backup my RPi to a mounted drive on my Synology NAS. Works great, but now all of a sudden it throws an error. I have not changed anything to my RPi or NAS.

The error I get when doing an incremental backup is:

Code: Select all

mount: special device /dev/loop0p2 does not exist

Unable to mount image ROOT partition
What does this mean? The mounted drive is available when I just "cd" to it.

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

Re: Image File Utilities

Tue Jul 21, 2020 3:53 pm

BF69 wrote:
Tue Jul 21, 2020 3:22 pm
I've had image_utils running now for a bit to backup my RPi to a mounted drive on my Synology NAS. Works great, but now all of a sudden it throws an error. I have not changed anything to my RPi or NAS.

The error I get when doing an incremental backup is:

Code: Select all

mount: special device /dev/loop0p2 does not exist

Unable to mount image ROOT partition
What does this mean? The mounted drive is available when I just "cd" to it.
It might mean that loop0 is in use so loop1 was automatically used instead. What happens if you type

$ sudo losetup -D

and try again?

BF69
Posts: 18
Joined: Sat May 13, 2017 9:44 am

Re: Image File Utilities

Tue Jul 21, 2020 4:12 pm

ejolson wrote:
Tue Jul 21, 2020 3:53 pm
BF69 wrote:
Tue Jul 21, 2020 3:22 pm
I've had image_utils running now for a bit to backup my RPi to a mounted drive on my Synology NAS. Works great, but now all of a sudden it throws an error. I have not changed anything to my RPi or NAS.

The error I get when doing an incremental backup is:

Code: Select all

mount: special device /dev/loop0p2 does not exist

Unable to mount image ROOT partition
What does this mean? The mounted drive is available when I just "cd" to it.
It might mean that loop0 is in use so loop1 was automatically used instead. What happens if you type

$ sudo losetup -D

and try again?
No, I get the exact same error after trying that command.

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

Re: Image File Utilities

Tue Jul 21, 2020 5:44 pm

BF69 wrote:
Tue Jul 21, 2020 3:22 pm
I've had image_utils running now for a bit to backup my RPi to a mounted drive on my Synology NAS. Works great, but now all of a sudden it throws an error. I have not changed anything to my RPi or NAS.

The error I get when doing an incremental backup is:

Code: Select all

mount: special device /dev/loop0p2 does not exist

Unable to mount image ROOT partition
What does this mean? The mounted drive is available when I just "cd" to it.

Are you able to create a new full backup to your NAS? Can you then do an incremental backup to that new full backup? If so, my guess is the old image file that you can no longer do an incremental backup to has somehow gotten corrupted on the NAS.

BF69
Posts: 18
Joined: Sat May 13, 2017 9:44 am

Re: Image File Utilities

Tue Jul 21, 2020 6:49 pm

RonR wrote:
Tue Jul 21, 2020 5:44 pm
BF69 wrote:
Tue Jul 21, 2020 3:22 pm
I've had image_utils running now for a bit to backup my RPi to a mounted drive on my Synology NAS. Works great, but now all of a sudden it throws an error. I have not changed anything to my RPi or NAS.

The error I get when doing an incremental backup is:

Code: Select all

mount: special device /dev/loop0p2 does not exist

Unable to mount image ROOT partition
What does this mean? The mounted drive is available when I just "cd" to it.

Are you able to create a new full backup to your NAS? Can you then do an incremental backup to that new full backup? If so, my guess is the old image file that you can no longer do an incremental backup to has somehow gotten corrupted on the NAS.
Okay, so the new backup did work, and the update also (I think, it doesn't give me any output but ovbiously running the two commands right after each other there wasn't anything to update anyway).

Thanks for the fast answer!

bfish2
Posts: 2
Joined: Fri Jul 24, 2020 12:49 pm

Re: Image File Utilities

Fri Jul 24, 2020 12:54 pm

Hello all,

I'm hoping someone can point me in right direction. I can't seem to run the utilities. I have done the following:

1. Downloaded from first page of this posting
2. Unzipped to /home/pi/bin (yes, checked and it is in path)
3. Chmod them to execute
4. Tried to run, each time I get
a. if NOT using sudo - "backup must be run as a root user"
b. If using Sudo - "command not found"

I have reviewed all 11 pages of this thread (whew!) and everybody seems to be having great success.

Am I missing something simple? Thanks in advance!

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

Re: Image File Utilities

Fri Jul 24, 2020 5:36 pm

bfish2 wrote:
Fri Jul 24, 2020 12:54 pm
I'm hoping someone can point me in right direction. I can't seem to run the utilities. I have done the following:

1. Downloaded from first page of this posting
2. Unzipped to /home/pi/bin (yes, checked and it is in path)
3. Chmod them to execute
4. Tried to run, each time I get
a. if NOT using sudo - "backup must be run as a root user"
b. If using Sudo - "command not found"

I have reviewed all 11 pages of this thread (whew!) and everybody seems to be having great success.

Am I missing something simple? Thanks in advance!

sudo uses its own path which is specified in: /etc/sudoers

bfish2
Posts: 2
Joined: Fri Jul 24, 2020 12:49 pm

Re: Image File Utilities

Fri Jul 24, 2020 9:20 pm

sudo is in the path already... i've used it dozens of times for both learning and to get updates. Just for giggles, I just ran "sudo apt update" from /home/pi/bin and it was fine. Still baffled!

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

Re: Image File Utilities

Fri Jul 24, 2020 10:07 pm

bfish2 wrote:
Fri Jul 24, 2020 9:20 pm
sudo is in the path already... i've used it dozens of times for both learning and to get updates. Just for giggles, I just ran "sudo apt update" from /home/pi/bin and it was fine. Still baffled!

If you take a look at /etc/sudoers as I suggested, you'll be less baffled (take note of the 'secure_path'= line). Also see 'man sudoers'.

/etc/sudoers:

Code: Select all

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

sn2019
Posts: 16
Joined: Thu Nov 29, 2018 10:06 pm

Re: Image File Utilities

Sun Aug 09, 2020 4:56 am

I want to clone my 32GB SD card on my RPi4 to another 32GB SD. Even though they both are 32GB, the active SD card is slightly larger than the spare one (will be the "write to" card). From a couple of posts in this thread, seems like all I need to do is run image-backup and write the resulted image file to the "write to" card. Am I reading it right?

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

Re: Image File Utilities

Sun Aug 09, 2020 5:11 am

sn2019 wrote:
Sun Aug 09, 2020 4:56 am
I want to clone my 32GB SD card on my RPi4 to another 32GB SD. Even though they both are 32GB, the active SD card is slightly larger than the spare one (will be the "write to" card). From a couple of posts in this thread, seems like all I need to do is run image-backup and write the resulted image file to the "write to" card. Am I reading it right?

You are correct.

aBUGSworstnightmare
Posts: 2285
Joined: Tue Jun 30, 2015 1:35 pm

Re: Image File Utilities

Sun Aug 09, 2020 6:04 am

If your target card is smaller than your source card cloning will - most likely - not work (i.e. It depends how big the difference in size is).
Once cloned a 32GB to a 16GB - just for the fun of it - ... Used gparted to shrink the partition size of the 32GB and then cloned it. Took quite a while but worked.

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

Re: Image File Utilities

Sun Aug 09, 2020 6:08 am

aBUGSworstnightmare wrote:
Sun Aug 09, 2020 6:04 am
If your target card is smaller than your source card cloning will - most likely - not work (i.e. It depends how big the difference in size is).
Once cloned a 32GB to a 16GB - just for the fun of it - ... Used gparted to shrink the partition size of the 32GB and then cloned it. Took quite a while but worked.

image-backup will do the job.

User avatar
rpdom
Posts: 17703
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Image File Utilities

Sun Aug 09, 2020 7:18 am

RonR wrote:
Sun Aug 09, 2020 6:08 am
aBUGSworstnightmare wrote:
Sun Aug 09, 2020 6:04 am
If your target card is smaller than your source card cloning will - most likely - not work (i.e. It depends how big the difference in size is).
Once cloned a 32GB to a 16GB - just for the fun of it - ... Used gparted to shrink the partition size of the 32GB and then cloned it. Took quite a while but worked.

image-backup will do the job.
As long as there is sufficient space to store the contents of the larger card on the smaller one.

The same goes for the standard SD Card Copier in RaspiOS.
Unreadable squiggle

sn2019
Posts: 16
Joined: Thu Nov 29, 2018 10:06 pm

Re: Image File Utilities

Sun Aug 09, 2020 3:49 pm

aBUGSworstnightmare wrote:
Sun Aug 09, 2020 6:04 am
If your target card is smaller than your source card cloning will - most likely - not work (i.e. It depends how big the difference in size is).
Once cloned a 32GB to a 16GB - just for the fun of it - ... Used gparted to shrink the partition size of the 32GB and then cloned it. Took quite a while but worked.
I just used image-backup and is able to boot up with my cloned SD card. They both are 32GB but the cloned card is few MB smaller than the source card. Don't know if it makes any difference but the card is only about 10~15% used.


Update 8/10/2020: I did another image-backup and flashed the image file to a 16GB SD card. The 16GB boots up fine and runs as good as the original 32GB SD card.

Return to “Advanced users”