redice # mkfs.ext2 /dev/ram0
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
2048 inodes, 8192 blocks
409 blocks (4.99%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
redice # mount /dev/ram0 /mnt/rd
redice # ls /mnt/rd
lost+found
redice # mount
/dev/hda2 on / type ext3
proc on /proc type proc (rw)
/dev/ram0 on /tmp/xxx type ext2 (rw)
当然,Ramdisk与硬盘分区有其不同的地方,例如RAM disk不适合作为长期保存文件的介质,掉电后Ramdisk的内容会随内存内容的消失而消失。Ramdisk的其中一个优势是它的读写速度高,可以被用作需要高速读写的文件。但在2.6版本后,Ramdisk的这一作用开始被tmpfs(Virtual memory file system support)取代。