VirtualBox Shared Folder has Insufficient inodes

3

I'm trying to use Vagrant + VirtualBox to build a Yocto based project. The build process is aborting before it starts compiling because it does a sanity check for disk space and inode. It appears that vboxfs mounts only show as having 1k free inodes (which is Yocto's PANIC threshold)

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ df -ih
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/sda1        2.5M   88K  2.5M    4% /
none             975K     2  975K    1% /sys/fs/cgroup
udev             974K   401  973K    1% /dev
tmpfs            975K   322  975K    1% /run
none             975K     1  975K    1% /run/lock
none             975K     1  975K    1% /run/shm
none             975K     2  975K    1% /run/user
vagrant          1000     0  1000    0% /vagrant

I can rsync the shared directory into the VM or checkout the code, but that sort of negates the benefits of Vagrant. Is it possible to tweak the vboxfs mount settings to make it have more inodes?

Edit

Modifying the config file to change the panic thresholds seems to have worked. There are actually two levels of checking. A "STOP" level and an "ABORT" level. By default "STOP" is set to 100,000 inodes. Changing both STOP and ABORT to 999 inodes allows the build to proceed, but I'm not sure if it will cause other problems down the road.

kyork

Posted 2015-11-12T22:22:34.047

Reputation: 221

1...what about to set the Yocto's PANIC threshold to 999? is it possible? – Hastur – 2015-11-12T22:50:34.990

1Hmm, that's worth trying. I'll give it a go in the morning and update. – kyork – 2015-11-13T02:35:18.453

1@Hastur see the edit above. – kyork – 2015-11-13T14:58:12.123

If that solution works down the road it's possible to post as an answer too. If not is possible to try to follow the same reverse logic, if you are not on a Windows host, Is it unrealisable to set up some NFS folders and compile on those? I read speed-up-your-vagrant and this suggestion too

– Hastur – 2015-11-13T16:32:17.620

Answers

4

Unfortunately, there’s no easy solution. The value is hardcoded at src/VBox/Additions/linux/sharedfolders/utils.c:

int sf_get_volume_info(struct super_block *sb, STRUCT_STATFS *stat)
{
    struct sf_glob_info *sf_g;
    SHFLVOLINFO SHFLVolumeInfo;
    uint32_t cbBuffer;
    int rc;

    sf_g = GET_GLOB_INFO(sb);
    cbBuffer = sizeof(SHFLVolumeInfo);
    rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME,
                        &cbBuffer, (PSHFLDIRINFO)&SHFLVolumeInfo);
    if (RT_FAILURE(rc))
        return -RTErrConvertToErrno(rc);

    stat->f_type        = NFS_SUPER_MAGIC; /* XXX vboxsf type? */
    stat->f_bsize       = SHFLVolumeInfo.ulBytesPerAllocationUnit;
    stat->f_blocks      = SHFLVolumeInfo.ullTotalAllocationBytes
                        / SHFLVolumeInfo.ulBytesPerAllocationUnit;
    stat->f_bfree       = SHFLVolumeInfo.ullAvailableAllocationBytes
                        / SHFLVolumeInfo.ulBytesPerAllocationUnit;
    stat->f_bavail      = SHFLVolumeInfo.ullAvailableAllocationBytes
                        / SHFLVolumeInfo.ulBytesPerAllocationUnit;
    stat->f_files       = 1000;
    stat->f_ffree       = 1000; /* don't return 0 here since the guest may think
                                 * that it is not possible to create any more files */
    stat->f_fsid.val[0] = 0;
    stat->f_fsid.val[1] = 0;
    stat->f_namelen     = 255;
    return 0;
}

Of course, if you’re willing to compile the Shared Folders kernel module yourself (should be very easy), you can easily change these values to something higher.

To build the kernel modules, download the appropriate VirtualBox source tree and run the following commands in its root:

./configure --only-additions

After getting it to succeed (indicating that all dependencies are installed), you should be able to follow the on-screen instructions. Unfortunately, I’ve run into a GCC bug, I’ll investigate more tomorrow.

Daniel B

Posted 2015-11-12T22:22:34.047

Reputation: 40 502

This would be a better work around than editing the config file, but how would I get the custom-built kernel modules loaded in the VM when Vagrant is setup? – kyork – 2015-11-13T14:59:21.433

You need to modify the base image (I'm not really familiar with Vagrant). The Guest Additions are already present, otherwise Shared Folders wouldn't work at all. – Daniel B – 2015-11-13T17:21:43.710

a). copy the install file from the mount place like /media/cdrom to some location and extract it by "sh VBoxLinuxAdditions.run --target <dir>” b). cd <dir>/src/vboxguest-5.1.6 && make && make install (or not make install, just copy the vboxsf.so) c). do "find / -name vboxsf.ko 2>/dev/null | xargs -n1 ls -l" and make sure the version in current guest kernel release be updated d) reboot and “df -hi” to check if the inodes capacity is reset as expected – gpanda – 2016-12-01T03:03:52.477