How do you create block RAM Disks on demand?

You should not delete /dev/ram0 yourself. It will be deleted when you do sudo rmmod brd, which frees the space and removes the module. You can then start again from modprobe.


I am not familiar with /dev/ram but you can do something similar with tmpfs and loop devices:

mkdir /ramdisks
mount -t tmpfs tmpfs /ramdisks
dd if=/dev/zero of=/ramdisks/disk0 bs=1M count=100
losetup /dev/loop0 /ramdisks/disk0
mke2fs /dev/loop0
...
losetup -d /dev/loop0
rm /ramdisks/disk0

Tags:

Linux

Ramdisk