<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

    主站蜘蛛池模板: 亚洲啪啪AV无码片| 在线观看亚洲成人| 亚洲国产成人无码AV在线| 一个人免费观看视频www| 亚洲AV色吊丝无码| 青春禁区视频在线观看直播免费| 亚洲大尺码专区影院| 免费毛片a在线观看67194| 亚洲 日韩经典 中文字幕| 在线免费观看a级片| 亚洲1区2区3区精华液| 亚洲国产成人久久综合区| 一级午夜免费视频| 亚洲综合av一区二区三区| 久久久久国产精品免费免费搜索| 亚洲综合av一区二区三区不卡| 日韩一级视频免费观看| 黄网站色视频免费看无下截| 亚洲精品tv久久久久| 免费毛片在线看不用播放器| 日韩高清在线免费观看| 免费无毒a网站在线观看| 亚洲色欲色欲www在线丝| 精品无码人妻一区二区免费蜜桃 | 亚洲人成影院午夜网站| 日本一道一区二区免费看| 黄色视屏在线免费播放| 亚洲精品国产啊女成拍色拍| 日本一道高清不卡免费| 中国极品美軳免费观看| 91亚洲精品麻豆| 久久久久亚洲AV成人网| 国产92成人精品视频免费| 色吊丝免费观看网站| 亚洲国产人成网站在线电影动漫| 毛片a级三毛片免费播放| 九九免费精品视频在这里| 亚洲欧洲春色校园另类小说| 免费人成年轻人电影| 久久久久久国产精品免费免费男同 | 一边摸一边爽一边叫床免费视频|