<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

    主站蜘蛛池模板: 免费成人在线观看| 欧美男同gv免费网站观看| 亚洲日韩中文字幕日韩在线| 国产精品无码亚洲精品2021| 国产精品美女自在线观看免费| 亚洲国产精品成人午夜在线观看 | 亚洲日本在线免费观看| 一级毛片**不卡免费播| 亚洲日本va午夜中文字幕一区| 亚洲色成人中文字幕网站| 一边摸一边桶一边脱免费视频| 国产亚洲大尺度无码无码专线| 亚州免费一级毛片| 亚洲国产精品视频| 亚洲制服丝袜一区二区三区| 99re热免费精品视频观看| 亚洲精品无码av片| 亚洲高清视频一视频二视频三| 一区二区三区免费看| 久久精品亚洲综合| 无码中文字幕av免费放| 妇女自拍偷自拍亚洲精品| 国产精品亚洲视频| 一区二区在线免费视频| 亚洲国产精品无码久久久秋霞2| 3344免费播放观看视频| 亚洲s码欧洲m码吹潮| 亚洲性猛交XXXX| 中文字幕无码视频手机免费看| 久久久久亚洲国产AV麻豆| 成年轻人网站色免费看| 亚洲校园春色另类激情| 在线观着免费观看国产黄| 99精品视频在线观看免费| 亚洲一区二区三区亚瑟| 亚洲精品综合久久| 黄色网址免费观看| 久久国产美女免费观看精品| 亚洲av无码片区一区二区三区| 亚洲午夜AV无码专区在线播放 | 亚洲永久中文字幕在线|