# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/hda5 # initrd /initrd-version.img #boot=/dev/hda default=0 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux (2.4.20-20.9) root (hd0,0) kernel /vmlinuz-2.4.20-20.9 ro root=LABEL=/ hdc=ide-scsi ramdisk_size=16000 initrd /initrd-2.4.20-20.9.img
将文件保存后,你需要重启系统。重启后,通过查看dmesg的输出来确认修改已经生效:
[root]# dmesg | grep RAMDISK RAMDISK driver initialized: 16 RAM disks of 16000K size 1024 blocksize RAMDISK: Compressed image found at block 0
3. 格式化RamDisk
无需将RamDisk格式化为日志文件系统,我们将使用EXT2文件系统。我只想使用一个RamDisk,所以我只格式化ram0。
[root]# mke2fs -m 0 /dev/ram0 mke2fs 1.32 (09-Nov-2002) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 4000 inodes, 16000 blocks 0 blocks (0.00%) reserved for the super user First data block=1 2 block groups 8192 blocks per group, 8192 fragments per group 2000 inodes per group Superblock backups stored on blocks: 8193 Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 22 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
-m 0选项指定了文件系统上root用户保留区块的比例为0,这是默认的特性。我希望普通用户可以使用所有的RamDisk空间。