Reading free space on ramdisks

I’m having a problem running an application in a ramdisk-only busybox-based Linux domain (a BOINC client in a user domain on Xen, if you must know). The BOINC client, with the best of intentions I’m sure, tries to see how much free disk space is available so it doesn’t fill up the disks. Well, in this system there aren’t any disks. “df” prints only the column headings when you run it, and “mount” doesn’t seem to know where ‘/’ is mounted.

# df
Filesystem 1k-blocks Used Available Use% Mounted on
# mount
/proc on /proc type proc (rw,nodiratime)
none on /sys type sysfs (rw)

I decided to create a ramdisk image (which is stored inside the initrd for the user domain, pay attention now 😉 ) which I try to mount once the ramdisk domain is up and running. I used “dd” to create the image file in a normal (with-disk) Linux environment, and then I formatted it ext2. That didn’t work, as you can see here:

# mount -t ext2 -o loop rd.img ./mnt/
mount: Mounting /BOINC-runnable/ramdisk/rd.img on /BOINC-runnable/ramdisk/mnt failed: Block device required

I still haven’t solved this problem. I’ll post more when I solve it.

Advertisements

One thought on “Reading free space on ramdisks

  1. I bet your /etc/mtab file isn’t set up properly. You can try making /etc/mtab the symlink “../proc/mounts” to reference /proc/mounts, which is automatically maintained by the kernel. I’ve found that in some circumstances, /proc/mounts includes excess entries, but those shouldn’t matter for your setup

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s