Losetup of an image located on Google Drive fails with I/O error

What is the problem you are having with rclone?

I am using a tool called raspiBackup on Raspberry Pi 5 (Linux rpi 6.6.31+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux). It performs a backup of the boot partition to a google Drive Folder mounted via
rclone mount --daemon --allow-root --allow-other gdrive:/ /home/pi/bin/GoogleDrive/Root
the tool basically does this:

dd if=/dev/nvme0n1p1 of="/home/pi/bin/GoogleDrive/Root/Backups/rpi/raspiBackup/rpi/rpi-tar-backup-20240727-132459/rpi-backup.img" bs=1M

then it tries to verify the backup by doing

losetup -v /dev/loop0 /home/pi/bin/GoogleDrive/Root/Backups/rpi/raspiBackup/rpi/rpi-tar-backup-20240727-132459/rpi-backup.img

This is where it fails (extract from kern.log):

2024-07-27T14:15:39.780878+01:00 rpi kernel: [ 2912.763483] I/O error, dev loop0, sector 1048448 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 2
2024-07-27T14:15:39.780893+01:00 rpi kernel: [ 2912.763564] I/O error, dev loop0, sector 1048448 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
2024-07-27T14:15:39.780894+01:00 rpi kernel: [ 2912.763567] Buffer I/O error on dev loop0, logical block 32764, async page read

If I simply copy the file above from the Google Drive folder to /tmp and repeat the losetup, it works properly. So something about the fact that the image is located on the mounted gdrive folder that breaks it. The permissions of the file are the same

root@rpi:/home/pi# ls -alt /home/pi/bin/GoogleDrive/Root/Backups/rpi/raspiBackup/rpi/rpi-tar-backup-20240727-132459/rpi-backup.img
-rw-r--r-- 1 pi pi 536870912 Jul 27 13:25 /home/pi/bin/GoogleDrive/Root/Backups/rpi/raspiBackup/rpi/rpi-tar-backup-20240727-132459/rpi-backup.img
root@rpi:/home/pi# ls -alt /tmp/rpi-backup.img 
-rw-r--r-- 1 root root 536870912 Jul 27 13:40 /tmp/rpi-backup.img

Run the command 'rclone version' and share the full output of the command.

pi@rpi:~ $ rclone version
rclone v1.68.0-beta.8125.f26d2c6ba
- os/version: raspbian 12.6 (64 bit)
- os/kernel: 6.6.31+rpt-rpi-2712 (aarch64)
- os/type: linux
- os/arch: arm64 (ARMv8 compatible)
- go/version: go1.23rc2
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

See above.

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

**pi@rpi**:**~ $** rclone config redacted
[gdrive]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
token = XXX
team_drive =

A log from the command that you were trying to run with the -vv flag

pi@rpi:~ $ rclone mount -vv --daemon --allow-root --allow-other gdrive:/ /home/pi/bin/GoogleDrive/Root
2024/07/27 14:27:54 DEBUG : rclone: Version "v1.68.0-beta.8125.f26d2c6ba" starting with parameters ["rclone" "mount" "-vv" "--daemon" "--allow-root" "--allow-other" "gdrive:/" "/home/pi/bin/GoogleDrive/Root"]
2024/07/27 14:27:54 DEBUG : Creating backend with remote "gdrive:/"
2024/07/27 14:27:54 DEBUG : Using config file from "/home/pi/.config/rclone/rclone.conf"
2024/07/27 14:27:55 DEBUG : Google drive root '': 'root_folder_id = 0AHOWZZUJzVDDUk9PVA' - save this in the config to speed up startup
2024/07/27 14:27:55 DEBUG : fs cache: renaming cache item "gdrive:/" to be canonical "gdrive:"
2024/07/27 14:27:55 DEBUG : rclone: Version "v1.68.0-beta.8125.f26d2c6ba" finishing with parameters ["/usr/bin/rclone" "mount" "-vv" "--daemon" "--allow-root" "--allow-other" "gdrive:/" "/home/pi/bin/GoogleDrive/Root"]

Try rclone mount with full VFS cache mode: --vfs-cache-mode=full

Yes this worked, thanks! Read about this mode after writing this, this is the mode where the mount is backed by the proper filesystem. Should have guessed...

Except, unfortunately, none of the caching modes are suitable, as the backup is creating a single huge file that is an image of the whole partition. Writing it to cache first (and on the same partition!) is not going to work. I will check with the backup utility author to check if that small boot partition image verification can be made an optional operation.

Thanks for your help!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.