• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

ramdisk Creation and its benefits

George K.

  • 4 min read
ramdisk Creation and its benefits

Generating audio, please wait...

Create ramdisk in Linux lets you directly store files in physical memory as if it was on your hard drive. RAM disks use the normal RAM in main memory as if it were a partition on a hard drive rather than actually accessing the data bus normally used for secondary storage such as hard disk

 See below 20GB of the RAM memory has been used for RAM memory.

Output of df -h and free memory usage/availability

 


[root@a1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 1016G 41G 925G 5% /
/dev/sda2 508M 37M 447M 8% /boot
/dev/sda5 5.0G 33M 5.0G 1% /tmp
/dev/sda6 1.8T 197M 1.7T 1% /home
/dev/ram0 20G 15G 3.7G 81% /opt/bglens/ramcache

 


[root@a1~]# free -g
total used free shared buffers cached
Mem: 62 51 10 0 0 29
-/+ buffers/cache: 21 41
Swap: 7 0 7

 

Advantages of saving files in a ramdisk, rather than in a HD is accessing memory is faster than accessing a HD. (HD = HardDrive).

Major disadvantage is, since RAM memory is volatile, you will lose the data, when you reboot the system.

Below are the steps to create ramdisk of 20G in the above server.

Please make sure that there is a minimum of 24 GB memory in the server to give 20G as ramdisk. Here in above situation server had 64G.

Commands to create RAMDisk

# mkfs -q -i 8192 /dev/ram0 20971520
# mount /dev/ram0 /opt/bglens/ramcache
# cp -rf /opt/bglens/data/posting.local/* /opt/bglens/ramcache

Here, there is a high chance that whenever you type the mkfs command as in above , you may get an output/error similar to below

Error for mkfs

mkfs.ext2: Filesystem larger than apparent device size
Proceed anyway? (y,n)
 

 If you give ‘n’, it will exit and you cant proceed with second step. But even if you say ‘y’, you won’t create it.

In such case, you would need to edit the boot loader configuration (usually grub.conf) and append the ‘ramdisk_size=20971520‘ to the kernel line. And reboot it. Here is a sample grub.conf

 
title CentOS (2.6.32-279.19.1.el6.x86_64)
root (hd0,1)
kernel /boot/vmlinuz-2.6.32-279.19.1.el6.x86_64 ro root=UUID=88244188-2787-468e-804a-b018c0d527eb rd_NO_LUKS rd_NO_DM nomodeset ramdisk_size=20971520
initrd /boot/initramfs-2.6.32-279.19.1.el6.x86_64.i
 
Reboot the server and you should have the script working then.

Extra information

Also, please note that if we unmount the ram disk, it will still reserve RAM and won’t release it for system’s normal use until you reboot the system. It will get flagged so that the Linux kernel will not try to reuse the memory again. If you remount the ramdisk, your data will still be there and that RAM space, cannot be used by other application/systems

To use memory as storage and still allow the kernel to reuse the memory, you can use ramfs or the newer tmpfs. This is another option to ramdisk. It allocate memory dynamically and by allowing less-used pages to be moved onto swap space.

Example of a tmpfs mounting a directory


mount -t tmpfs tmpfs /dir

if you don’t fill up the space in the tmpfs, the kernel gets to use the free RAM for buffers and cache. If you delete a file, the kernel will reclaim the ram, and if you umount the directory, all data is lost.

Get 24/7 expert server management

  • Howtos
  • Linux
ramdisk Creation and its benefits

.htaccess based mod_rewrite not working with Godaddy ?

.htaccess based mod_rewrite not working with Godaddy ?
  • Apache
  • General
  • Howtos
  • Linux
logo

/proc explained

/proc explained
  • Linux
logo

A story of Ubuntu – I am what I am because of who we all are :)

A story of Ubuntu – I am what I am because of who we all are :)
  • General
  • Training
logo

Account Creation: Sorry, a mysql user with the name x already exists.

Account Creation:  Sorry, a mysql user with the name x already exists.
  • MySQL
  • Troubleshooting
logo

Posts by George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.