Linux – rsync : write failed – No space left on device (28)

linuxrsync

I want to rsync a folder from one server to another.

But rsync synchronization fails:

$ rsync -zr --compress-level=9 --delete /var/www/mywebsite/current/web/js login@192.168.1.4:/srv/data2_http
rsync: write failed on "/srv/data2_http/js/8814c77.js": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(322) [receiver=3.0.9]
rsync: connection unexpectedly closed (21747 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

But I have enough space !

$ du -h /var/www/mywebsite/current/web/js
2.4M    /var/www/mywebsite/current/web/js


df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          5.0G  3.0G  1.8G  64% /
/dev/root       5.0G  3.0G  1.8G  64% /
devtmpfs        2.0G     0  2.0G   0% /dev
tmpfs           395M  132K  395M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            24K   16K  8.0K  67% /var/gandi
tmpfs            24K   16K  8.0K  67% /var/gandi
tmpfs           789M     0  789M   0% /run/shm
/dev/xvdb       202G  168G   25G  88% /srv/data2_http

df -i
Filesystem       Inodes   IUsed    IFree IUse% Mounted on
rootfs           327680   67666   260014   21% /
/dev/root        327680   67666   260014   21% /
devtmpfs         504593     319   504274    1% /dev
tmpfs            504848     224   504624    1% /run
tmpfs            504848       2   504846    1% /run/lock
tmpfs            504848       5   504843    1% /var/gandi
tmpfs            504848       5   504843    1% /var/gandi
tmpfs            504848       2   504846    1% /run/shm
/dev/xvdb      13434880 2152940 11281940   17% /srv/data2_http

Best Answer

I had the same issue, the destination directory had enough space but I'd get "No space left on device". Turns out rsync copies the file to somewhere else first, then moves it to the destination directory. To change this behavior, use --inplace.

According to https://download.samba.org/pub/rsync/rsync.html "This option changes how rsync transfers a file when its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is complete, rsync instead writes the updated data directly to the destination file."

 rsync --inplace source destination