I created a ramdisk using tmpfs as follows:
sudo mount -t tmpfs -o size=1024m tmpfs /myramdisk
I was looking into cgroup blkio subsystem bandwidth limits "read_bps_device" and "write_bps_device" but they seem to require the major and minor number of your block device that you want to throttle access to.
Is there any way to achieve a similar bandwidth limit to the in-memory tmpfs ramdisk?
UPDATE: I found a roundabout hacky way of accomplishing this. I first nfs export the ramdisk mount. Then nfs mount it over loopback on the same machine. I then use linux network traffic shaping to set bandwidth limits. This seems to provide what I need. I'm in the process of performing some measurements to see the penalty this hideous layering entails. I'll update info on that in a few days.
Best Answer
stat
or/proc/[PID]/mountinfo
should still tell you what the device numbers are:Both outputs show
0:25
and0:24
as the device numbers in question. The "0" device number is used for "unnamed" mounts (such as tmpfs, sysfs, nfs, procfs, etc). For example, here is an NFS mount:The NFS mounts above are
0:23
and0:26
respectively.