My work around above (described in the section "code working around the issue") 
does not consistently work. I was probably just lucky a few times in a row.
I tried several times, with varying delays between creating the huge file and 
transferring the snapshot but most of them fail and there seem to be no 
correlation with the delay.

Actually, the same problem arises using rsync so it must not be
restricted to btrfs send/receive.

$ rsync -a --stats --one-file-system /mnt/btr_root_pool/@.20170212T1133/ 
/mnt/btr_root_bac/
rsync: rename 
"/mnt/btr_root_bac/lib/modules/4.8.0-22-generic/kernel/drivers/staging/comedi/drivers/.fl512.ko.2UT9JI"
 -> 
"lib/modules/4.8.0-22-generic/kernel/drivers/staging/comedi/drivers/fl512.ko": 
No space left on device (28)


Assuming that there may be a problem with btrfs not being able to grow the file 
system fast enough, I have also tried to limit the transfer rate by using pv:


for RATE in $(seq 2 2 40 | shuf); do
  echo -e "\n\n\n=================\n\nRATE=${RATE}"
  mountpoint -q /mnt/btr_root_bac && umount /mnt/btr_root_bac
  dd if=/dev/zero of=/dev/sda5 bs=8M count=10
  mkfs.btrfs /dev/sda5
  mount -o subvolid=0 /dev/sda5 /mnt/btr_root_bac
  btrfs fi df /mnt/btr_root_bac/
  btrfs send /mnt/btr_root_pool/@.20170212T1133/ | pv --rate-limit ${RATE}m | 
btrfs receive -vvvv /mnt/btr_root_bac/ 2>&1 | grep -e ERROR -e RECEIVED
  btrfs fi df /mnt/btr_root_bac/
done


The results seem to suggest that the disk operations have a higher chance of 
suceeding with slower transfer rates:


RATE=2 RECEIVED
RATE=4 RECEIVED
RATE=6 RECEIVED
RATE=8 RECEIVED
RATE=10 RECEIVED
RATE=12 RECEIVED
RATE=14 ERROR
RATE=16 ERROR
RATE=18 ERROR
RATE=20 ERROR
RATE=22 ERROR
RATE=24 ERROR
RATE=26 RECEIVED
RATE=28 ERROR
RATE=30 ERROR
RATE=32 RECEIVED
RATE=34 ERROR
RATE=36 ERROR
RATE=38 ERROR
RATE=40 ERROR


Mounting /dev/sda5 with enospc_debug does not seem to add any useful 
information to /var/log/syslog.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1664013

Title:
  "btrfs receive" throws "No space left on device" on empty and large
  enough fs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/btrfs-tools/+bug/1664013/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to