Can’t create ramdisks of different size with module brd. (Linux)

ramdisk

I'm creating ram block devices on a linux machine for a project we're working on.
I don't want to use tmpfs.

When I use module brd to create a ramdisk I run the command

modprobe brd rd_size=1048576

This creates 16 devices -> /dev/ram[0-15] (all of size 1 GB)

But now I want to create two ramdisks of different sizes, say 1Gb and 2Gb.

I also understand I might be able to use lvm to "merge" two devices together and create a new 2GB device from two 1GB devices.

But I want the module to create ramdisks of different sizes without having to do the merging.

I've looked around for a method to do this, but it just seems that there is no way.

Does anyone know if there is a way to do this?

Best Answer

I'd been looking for similar information on RAM disks (in my case, planned RAM disk as part of RAID 1 array). For a partial answer, as I'm not sure how to create RAM disks of differing sizes:

Try: modprobe brd rd_nr=1 rd_size=1048576 max_part=0

Which should create one, 1GB RAM disk. Perhaps tailor rd_nr=1 to rd_nr=3? That should give three 1G RAM disks, leaving assembling them to 2GB perhaps to LVM?

Referenced solution, and pardon the necro-post answer (there remains very lacking documentation on this subject): http://forums.debian.net/viewtopic.php?f=5&t=114458

Related Topic