RonR-RPi-image-utils icon indicating copy to clipboard operation
RonR-RPi-image-utils copied to clipboard

Write failed on `/tmp/..`: No space left on device

Open zigmd opened this issue 1 year ago • 1 comments

I installed Ubuntu on a 256GB microSD card using RPi Imager. I'm trying to port this image to an SSD. I have a USB drive /dev/sdb1 mounted on /mnt/usbdrive (with sudo mount /dev/sdb1 /mnt/usbdrive) so that I can create a backup of the microSD card.

When I run sudo image-backup, I a no space left on device error. These are the complete details:

root@containerberry:~# 
root@containerberry:~# sudo image-backup

Image file to create? /mnt/usbdrive/pibackup/20240217_Pi4B_imagebackup.img

Initial image file ROOT filesystem size (MB) [3245]? 

Added space for incremental updates after shrinking (MB) [0]? 

Create /mnt/usbdrive/pibackup/20240217_Pi4B_imagebackup.img (y/n)? y


Starting full backup (for incremental backups, run: /usr/local/sbin/image-backup /mnt/usbdrive/pibackup/20240217_Pi4B_imagebackup.img)

rsync: [receiver] write failed on "/tmp/img-backup-mnt/usr/lib/firmware/qed/qed_init_values-8.40.33.0.bin": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(380) [receiver=3.2.7]
rsync: [sender] write error: Broken pipe (32)

Unable to create backup

root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           781M  3.1M  778M   1% /run
/dev/mmcblk0p2  235G  3.3G  222G   2% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/mmcblk0p1  253M  143M  110M  57% /boot/firmware
tmpfs           781M  4.0K  781M   1% /run/user/1000
/dev/sdb1       121G   12G  110G  10% /mnt/usbdrive
root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# lsblk --fs
NAME        FSTYPE   FSVER LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0       squashfs 4.0                                                          0   100% /snap/core20/2186
loop1       squashfs 4.0                                                          0   100% /snap/lxd/24326
loop2       squashfs 4.0                                                          0   100% /snap/core20/1977
loop3       squashfs 4.0                                                          0   100% /snap/lxd/27038
loop4       squashfs 4.0                                                          0   100% /snap/snapd/19459
loop5       squashfs 4.0                                                          0   100% /snap/snapd/20674
sda                                                                                        
sdb                                                                                        
└─sdb1      exfat    1.0   STRONTIUM12 EE1D-5C11                             109.2G     9% /mnt/usbdrive
mmcblk0                                                                                    
├─mmcblk0p1 vfat     FAT32 system-boot F04B-5543                             109.6M    57% /boot/firmware
└─mmcblk0p2 ext4     1.0   writable    877a65cf-888e-47c6-b4e0-ec5c52c54be8  221.9G     1% /
root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# 
root@containerberry:~# cd /mnt/usbdrive/pibackup/
root@containerberry:/mnt/usbdrive/pibackup# 
root@containerberry:/mnt/usbdrive/pibackup# ll
total 3847424
drwxr-xr-x 2 root root     131072 Feb 17 01:19 ./
drwxr-xr-x 8 root root     131072 Feb 17 01:05 ../
-rwxr-xr-x 1 root root 3939500032 Feb 17 01:45 20240217_Pi4B_imagebackup.img*
root@containerberry:/mnt/usbdrive/pibackup# 
root@containerberry:/mnt/usbdrive/pibackup# 
root@containerberry:/mnt/usbdrive/pibackup# 

I dont understand why there's no space.

zigmd avatar Feb 17 '24 09:02 zigmd

Disclaimer: I’m not part of this project at all, just happened to see this and from using it I noticed that if you’re making an image of a device that is actively in use it sometimes runs out of space if you don’t add some padding to the image.

The issue isn’t the USB drive running out of space, it’s the image you’re creating running out of space since its size is defined before writing to it (so for your example it’s creating an image with an initial size of 3245MB with 0MB padding for incremental update and when it’s writing it it ends up being bigger than 3245MB because of some file change that happens in the background).

I normally just add a little bit (a few hundred MBs works for me) to the initial size to make sure that it has enough space for changes and then if you want to save that space again afterwards you can use the img-shrink script which will remove any extra free space from the image.

Hope that helps :)

wolffshots avatar Feb 19 '24 07:02 wolffshots

@wolffshots : Thanks for that!

seamusdemora avatar Jun 07 '24 06:06 seamusdemora

@saurabh-sm :

Please read the first paragraph of the README file:

Please take up any issues or questions in the Image File Utilities thread of the Raspberry Pi Forums site. IOW: This is a file repository only; no support is available here.

seamusdemora avatar Jun 07 '24 06:06 seamusdemora