<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) 評(píng)論(0)  編輯  收藏 所屬分類: Linux

    主站蜘蛛池模板: 一二三四免费观看在线电影| 国产猛男猛女超爽免费视频| 成年女人午夜毛片免费看| 亚洲精品第五页中文字幕| 久久久久久一品道精品免费看| 亚洲中文字幕无码永久在线| 国产精品综合专区中文字幕免费播放| 亚洲AV无码一区二区三区国产| 男性gay黄免费网站| 亚洲中文无韩国r级电影| 三年片免费观看大全国语| 亚洲成av人影院| 最近2019中文字幕免费大全5| 亚洲欧洲自拍拍偷综合| 成年女人看片免费视频播放器| 亚洲熟妇AV一区二区三区浪潮| 免费高清在线影片一区| 成人精品综合免费视频| 国产成人亚洲精品狼色在线| 国产无遮挡无码视频免费软件| 精品亚洲成a人片在线观看少妇| 亚洲免费福利视频| 久久久亚洲精华液精华液精华液 | 亚洲国产精品嫩草影院| 国产一级淫片免费播放| 中文字幕免费不卡二区| 亚洲免费二区三区| 全亚洲最新黄色特级网站| 国产色无码精品视频免费| 亚洲日韩中文字幕天堂不卡| 免费观看的a级毛片的网站| 一区二区免费电影| 亚洲欧洲日本精品| 亚洲乱码中文字幕综合234| 99免费视频观看| 极品色天使在线婷婷天堂亚洲| 亚洲人成影院在线无码按摩店| 亚洲免费视频播放| 巨胸喷奶水视频www免费视频| 亚洲白色白色在线播放| 亚洲 自拍 另类小说综合图区|