首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Linux内核3.x如何将ramdisk作为块设备管理?

Linux内核3.x如何将ramdisk作为块设备管理?
EN

Unix & Linux用户
提问于 2014-09-23 12:05:51
回答 1查看 9.7K关注 0票数 5

我需要一个内存中的块设备。我构建了一个3.x内核并添加了RAM块设备驱动程序。RAM块设备驱动器的数目是16 (默认情况下),但是当内核引导时,/sys/block/dev中没有ramx。到底怎么回事?

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2014-09-23 13:57:53

我觉得你的意思是这样的:

加载块ramdisk模块,使用rd_size=...参数在块中设置所需的大小。

代码语言:javascript
复制
# modprobe brd rd_size=123456

...after此步骤/dev/ram0存在。

现在您可以在它上放置一个文件系统。

代码语言:javascript
复制
# 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.

安装并检查使用的空间和自由..。

代码语言:javascript
复制
# mount /dev/ram0 /mnt 
# df /mnt 
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/ram0               119539      1550    111817   2% /mnt
票数 8
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/157041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档