I compile the ramdisk as a module in the kernel.Then I want use the cmd :insmod brd rd_size = 10000 to set the capacity of the ramdisk.But it says I give the wrong parameters. Then I go to see the source code of this module. static int __init brd_init(void).There is no parameters list. If I want to set the capacity of the ramdisk,What can I do?
Asked
Active
Viewed 5,515 times
1 Answers
6
Try modprobe brd rd_nr=1 rd_size=1048576 max_part=0
That should give you one 1G partition at /dev/ram0
.

Tyler Jandreau
- 4,245
- 1
- 22
- 47

Justin B.
- 61
- 1
- 2
-
1More info: `rd_nr` is the number of RAM disks it creates; by default, it creates ram0 through ram15, but specifying 1 just creates ram0. `rd_size` is the size of the disk in **kilobytes** (1024 bytes per kilobyte). Parameter documentation can be found in the source code: https://github.com/torvalds/linux/blob/master/drivers/block/brd.c#L330 – Joey Adams Jan 01 '19 at 15:23