I'm trying to create a btrfs file system with a single volume from a directory 'root', over mtd and nandsim.
With a few token files and directories in my root directory, and successfully created and mounted the filesystem:
sudo modprobe mtdblock
sudo flash_erase /dev/mtd0 0 0
sudo mkfs.btrfs -m single -s 2048 -r root /dev/mtdblock0
All is well in the world. Now, I add in the actual contents of my root directory: a few metadata files, and just under 128k binary files at 2k each. When I try the same approach again, mkfs.btrfs fails with "ERROR: unable to zero the output file".
In the source code, the offending method at line 407 fails if either call to pwrite64() fails. I can't see why this would fail, unless the system call has some limit on the overall size it will allow?
That said, my device is only 256MB, on a system with plenty of RAM and disk space -- it seems unlikely.
Could anyone please point me in the right direction? Have I missed some key step?
If it matters, I'm using btrfs-progs v4.15.1, on bionic 18.04 kernel 4.15.0-99-generic
--shrinka try ? From the description that could help :Shrink the filesystem to its minimal size, only works with --rootdir option. If the destination is a regular file, this option will also truncate the file to the minimal size. Otherwise it will reduce the filesystem available space. Extra space will not be usable unless the filesystem is mounted and resized using btrfs filesystem resize.pwritecall. There are twopwritecalls inzero_output_file. Exactly which one is it?