RonR
Posts: 1199
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: 41
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: 178
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: 1265
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?
Ever wished you could "open" a RaspiOS .img file? Well now you can! I've developed Pi-Power-Tools, the only RaspiOS img editor on the planet.
https://github.com/Botspot/Pi-Power-Tools
Want to try it out?

Code: Select all

wget -O - https://raw.githubusercontent.com/Botspot/Pi-Power-Tools/master/update | bash

fbe
Posts: 642
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: 1265
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.
Ever wished you could "open" a RaspiOS .img file? Well now you can! I've developed Pi-Power-Tools, the only RaspiOS img editor on the planet.
https://github.com/Botspot/Pi-Power-Tools
Want to try it out?

Code: Select all

wget -O - https://raw.githubusercontent.com/Botspot/Pi-Power-Tools/master/update | bash

fbe
Posts: 642
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: 1265
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.
Ever wished you could "open" a RaspiOS .img file? Well now you can! I've developed Pi-Power-Tools, the only RaspiOS img editor on the planet.
https://github.com/Botspot/Pi-Power-Tools
Want to try it out?

Code: Select all

wget -O - https://raw.githubusercontent.com/Botspot/Pi-Power-Tools/master/update | bash

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: 1199
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: 5382
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: 1199
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: 1199
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: 1199
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

Return to “Advanced users”