I learned that I can do modprobe brd rd_nr=1 rd_size=4585760 max_part=1
if I want to create a ram block device at /dev/ram0
but lets say I want to flush the device (to free the ram), then delete it and create another. How would I do this running modprobe brd rd_nr=1 rd_size=4585760 max_part=1
again doesn't seem to create another ram device in /dev
Recreate steps:
1) create disk: modprobe brd rd_nr=1 rd_size=4585760 max_part=1
2) use the ram disk for some arbitrary task: ex: dd if=/dev/zero of=/dev/ram0 count=1000
3) free up the memory blockdev --flushbufs /dev/ram0
4) delete device file: rm /dev/ram0
5) try to create another one: modprobe brd rd_nr=1 rd_size=4585760 max_part=1
6) ls /dev/ram*
gives me an error
I know that I can change the rd_nr
to be whatever number I desire but I want to be able to create these on the fly.
Edit: I don't want to create a tmpfs, my use case requires a block device