标签:linux disk mount ramdisk mke2fs
1,kernel 配置,设置ramdisk 大小
[root@localhost ~]# cat /etc/grub.conf # 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/vda6 # initrd /initrd-[generic-]version.img #boot=/dev/vda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=5f60bd8c-5991-4101-a1f4-a08f3ef88832 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet ramdisk_size=102400 initrd /initramfs-2.6.32-358.el6.x86_64.img
2, 格式化RAM 分区
mke2fs /dev/ram0
3, 创建挂载目录
mkdir /ramdisk
4,挂载ramdisk 目录
mount /dev/ram0 /ramdisk
5,验证ramdisk 文件系统
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda6 24G 601M 22G 3% / tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/vda1 504M 43M 436M 9% /boot /dev/vda3 30G 3.2G 25G 12% /usr /dev/vda2 50G 618M 47G 2% /var /dev/vdb1 50G 690M 47G 2% /opt /dev/ram0 97M 1.6M 91M 2% /ramdisk
[root@localhost ramdisk]# ls lost+found [root@localhost ramdisk]# dd if=/dev/zero of=./a.img count=88 bs=1M 88+0 records in 88+0 records out 92274688 bytes (92 MB) copied, 0.116734 s, 790 MB/s
[root@localhost ramdisk]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda6 24G 601M 22G 3% / tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/vda1 504M 43M 436M 9% /boot /dev/vda3 30G 3.2G 25G 12% /usr /dev/vda2 50G 618M 47G 2% /var /dev/vdb1 50G 690M 47G 2% /opt /dev/ram0 97M 90M 2.0M 98% /ramdisk
6,配置完成!
本文出自 “欢迎评论,欢迎点赞” 博客,转载请与作者联系!
标签:linux disk mount ramdisk mke2fs
原文地址:http://swq499809608.blog.51cto.com/797714/1617578