<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Chan Chen Coding...

    Install and Setup Ramdisk under Linux (CentOS, RHEL, Fedora)

    Ramdisk is very good to have if you want something to stay in memory.   Files in memory makes it so you can access them with out having to access hard drive all the time.  Perfect candidates would be things which do not change eg. web images or downloadable files, etc.  If you have Linux Kernel 2.4 or later, you already have support of ramdisk built in.  You can check if ramdisk is setup by doing: 

    # dmesg | grep RAMDISK
    RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize

    You should get above output on CentOS and RHEL.  Other linux flavors will have similar output as well.  If you would like to see how they are named and what you would need to refer to, do the following:

    # ls -l /dev/ram*
    lrwxrwxrwx 1 root root 4 Apr 24 12:05 /dev/ram -> ram1
    brw-rw---- 1 root disk 1, 0 Apr 24 12:05 /dev/ram0
    brw-rw---- 1 root disk 1, 1 Apr 24 12:05 /dev/ram1
    brw-rw---- 1 root disk 1, 10 Apr 24 12:05 /dev/ram10
    brw-rw---- 1 root disk 1, 11 Apr 24 12:05 /dev/ram11
    brw-rw---- 1 root disk 1, 12 Apr 24 12:05 /dev/ram12
    brw-rw---- 1 root disk 1, 13 Apr 24 12:05 /dev/ram13
    brw-rw---- 1 root disk 1, 14 Apr 24 12:05 /dev/ram14
    brw-rw---- 1 root disk 1, 15 Apr 24 12:05 /dev/ram15
    brw-rw---- 1 root disk 1, 2 Apr 24 12:05 /dev/ram2
    brw-rw---- 1 root disk 1, 3 Apr 24 12:05 /dev/ram3
    brw-rw---- 1 root disk 1, 4 Apr 24 12:05 /dev/ram4
    brw-rw---- 1 root disk 1, 5 Apr 24 12:05 /dev/ram5
    brw-rw---- 1 root disk 1, 6 Apr 24 12:05 /dev/ram6
    brw-rw---- 1 root disk 1, 7 Apr 24 12:05 /dev/ram7
    brw-rw---- 1 root disk 1, 8 Apr 24 12:05 /dev/ram8
    brw-rw---- 1 root disk 1, 9 Apr 24 12:05 /dev/ram9
    lrwxrwxrwx 1 root root 4 Apr 24 12:05 /dev/ramdisk -> ram0

    All those ramdisks listed have same size.  In above example, they are all 16MB.  Let us change that so we have more space allowed.  Note that I say allowed and not allocated.  We allocate space in one of the later steps by formatting one of the drives above.   Let us set it up so we have 128 MB.  Since this has to be in multiples of 1024, we will setup Ramdisk to have 131072K. 

    vi /etc/grub.conf

    Find first line which looks similar to following:

    kernel /vmlinuz-2.6.9-42.0.10.EL ro root=/dev/VolGroup00/LogVol00

    add ramdisk_size=131072 to the end of the line.  Now your line should look like:

    kernel /vmlinuz-2.6.9-42.0.10.EL ro root=/dev/VolGroup00/LogVol00ramdisk_size=131072Save and exit grub.conf.  At this point you have it configured to have ramdisk with new size but it does not take effect until you reboot your system.  Once you have rebooted your system, we can start doing rest of configurations.

    mke2fs -m 0 /dev/ram0

    This will format the ram0 ramdrive for us to use. At this point, kernel will allocate space for you.  Let us setup Ramdisk mount point so we can use it.  We will also have it be owned by user “sunny” so that user can read/write to that mount.

    mkdir /home/ramdisk
    mount /dev/ram0 /home/ramdisk
    chown sunny.sunny /home/ramdisk

    At this point you should be able to type:  mount and see your new Ramdisk drive mounted on /home/ramdisk

    Remember that everything you put on this drive will be gone if you reboot your server.  If you unmounted the Ramdisk drive and remounted it, your files will still be there.  It is because your system has that much ram set aside for your Ramdisk and will not use it for anything else.   If you would like to setup Ramdisk the same next time you boot up, add these lines to your /etc/rc.local files.

    mke2fs -m 0 /dev/ram0
    mount /dev/ram0 /home/ramdisk
    chown sunny.sunny /home/ramdisk

    ————————————-
    DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.



    Read more: http://crazytoon.com/2007/06/01/ramdisk-how-do-you-install-and-set-up-ramdisk-under-linux-centos-rhel-fedora/#ixzz1t2VAAY00
     

    -----------------------------------------------------
    Silence, the way to avoid many problems;
    Smile, the way to solve many problems;

    posted on 2012-04-25 16:35 Chan Chen 閱讀(1189) 評論(0)  編輯  收藏 所屬分類: Linux

    主站蜘蛛池模板: 免费精品国产自产拍观看| 最近中文字幕完整免费视频ww | 亚洲13又紧又嫩又水多| 久久青草91免费观看| 亚洲精品二区国产综合野狼| 一个人看的www在线免费视频| 亚洲日本中文字幕天堂网| 国产精品无码永久免费888| 久久久久亚洲AV成人网| 男女一边桶一边摸一边脱视频免费| 亚洲男人第一无码aⅴ网站| 两个人看的www视频免费完整版| 亚洲一区二区女搞男| 日本免费人成网ww555在线| 亚洲欧洲日产国码无码网站| 国产免费拔擦拔擦8X高清在线人| 亚洲精品免费在线观看| av无码久久久久不卡免费网站| 亚洲人成电影网站色www| 高清在线亚洲精品国产二区| 国产精品一区二区三区免费| 亚洲av鲁丝一区二区三区| 1000部免费啪啪十八未年禁止观看 | 亚洲免费二区三区| 亚洲综合成人婷婷五月网址| 国产一级做a爱免费视频| 国产免费久久精品丫丫| 337p日本欧洲亚洲大胆艺术| 国产成人免费高清激情视频 | 任你躁在线精品免费| 亚洲福利视频网址| 国产麻豆免费观看91| 男女拍拍拍免费视频网站| 亚洲国产精品专区| 免费观看四虎精品国产永久| 免费看一区二区三区四区| 亚洲午夜国产精品| 国产精品亚洲综合专区片高清久久久| 国产成人免费AV在线播放| 亚洲砖码砖专无区2023| 国产亚洲精久久久久久无码|