I need a block device in RAM. I built a 3.x kernel and added the RAM block device driver. The number of RAM block device drive is 16 (by default) but when the kernel boots there is no ramx in /sys/block nor /dev. What's going on?

  • 1
    Please do not answer if you want to suggest ramfs or tmpfs.
    – user62916
    Commented Sep 25, 2014 at 1:37
  • Also tmpfs + losetup can simulate a block device.also this way provide /dev/loop* and /sys/block/loop*.Also tmpfs + losetup can simulate a block device.also this way provide /dev/loop* and /sys/block/loop*.also tmpfs is take some advantage than ram block device and ramfs kernel.org/doc/Documentation/filesystems/…
    – illiterate
    Commented Aug 26, 2018 at 4:31

1 Answer 1


I think you mean something like this:

Load the block ramdisk module, set the desired size in blocks using the rd_size=... parameter.

# modprobe brd rd_size=123456

...after this step /dev/ram0 exists.

You now can put a filesystem on it.

# mkfs /dev/ram0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
30976 inodes, 123456 blocks
6172 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
16 block groups
8192 blocks per group, 8192 fragments per group
1936 inodes per group
Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount it and check the space used and free...

# mount /dev/ram0 /mnt 
# df /mnt 
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/ram0               119539      1550    111817   2% /mnt
  • You are right. but what does the modprobe exactly do? Commented Sep 24, 2014 at 10:30
  • The rd_size parameter could be supplied to the kernel when booting if brd is compiled-in. The convenience of having brd as a module is that you can load and unload the module and supply different parameters (with modprobe like in this answer) on each initialization.
    – MattBianco
    Commented Sep 24, 2014 at 10:51
  • "what does the modprobe exactly do?"... modprobe loads the 'ramdisk driver', 'ramdisk support' or however you want to call it and is able to pass parameters to it, e.g. the ramdisk size in blocks...
    – user62916
    Commented Sep 24, 2014 at 11:36
  • Ok, modprobe handles loaded module and forces the brd to load. then the brd module loads some ram disk block device. Commented Sep 26, 2014 at 9:49
  • Hello, I was wondering if it is possible to use -o dax with mount. When I try it, after following the previous steps, I get wrong fs type, bad option, bad superblock on /dev/ram1, missing codepage or helper program, or other error. Commented Jun 9, 2022 at 13:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .