dcsimg

Ramdisks – Now We Are Talking Hyperspace!

Ramdisks can offer a level of performance that is simply amazing. More than just a tool for benchmarking, there are new devices that utilize ramdisks for a bit of the ultra-performance.

Ramdisks are usually spoken of in hushed tones when sysadmins get together. Some view them with awe because of their performance and some view them with skepticism and say they are only useful for creating benchmarks. Almost all of them agree that using them on a regular basis must be done with care because of the problem of losing power shuts immediately shuts down the ramdisk erasing the contents of the ramdisk. However, there are uses for ramdisks besides running benchmarks. More over there are storage devices that use RAM as the storage media that can reach rarefied levels of performance of millions of IOPS.

This article takes a quick break from the 2.6.30 kernel bonanza of file systems to discuss ramdisks and file systems that use them, such as tmpfs. It will also discuss possible uses for ramdisks. Finally it will present some storage devices that use RAM as the storage media. These devices range from very expensive enterprise class storage to devices that can fit into your desktop.

Introduction to Ramdisks, RamFS, and tmpfs

The concept of a ramdisk is fairly simple – take a piece of memory and make it appear as a hard drive (block device) to the OS. It can be then used for storing data. But the memory used for the ramdisk is unavailable to the OS for anything else. If the power is removed then the data on the ramdisk is lost. This can be thought of as a good or bad result depending upon your perspective. It’s bad because you lose the data if you haven’t copied it permament media (hard drives or flash). It’s a good thing from a privacy perspective because when the power is lost all data is gone and can’t be reconstructed. In addition, if you want to install the OS after a power loss or a reboot, then using a ramdisk is also a good option.

Linux has two primary ramdisk file systems available for use. The first, and earliest is called RamFS and was developed in the 2.4 kernel time frame and is still available in the 2.6.30 kernel. There is also tmpfs. Each has it’s own pluses and minuses that are summarized here:

Feature RamFS tmpfs
Dynamically grow file system? Yes No
Uses swap space? No Yes
Fill Maximum Space and Continue Writing? Will continue writing Generate error

Recall that in both cases, RamFS and tmpfs, they are volatile storage and losing power will erase all of the data in the file system. Which ramdisk file system you select depends upon your requirements. RamFS is attractive in that you can keep filling the file system as needed. But there is a danger in that you can fill it until you run out of memory and starve the OS (the VM can’t free the memory used for RamFS because it thinks that the files should be written to the backing storage, a block device, but RamFS doesn’t have any backing store). On the other hand, tmpfs has a fixed size so you need to know how large a file system you need apriori and create it. But if you need more space than the mounted tmpfs, then it will use swap space. This could be good or bad depending upon your use case and your perspective.

With both RamFS and tmpfs you are basically mounting the disk cache as a file system. Normally all files are cached in memory by Linux. In the case of a read function, data is read from the what is called the backing store device (basically a block device that has a file system such as a hard drive). These files are kept around in memory in case they are needed again. However, the pages are marked as clean which allows them to be used by the VM for something else. For write situations the pages associated with the data are marked as clean as soon as they are written to the backing store and can be used by the VM for its needs.

With RamFS the files are written into the cache as usual but there is no backing store. Consequently, the pages are not marked as clean so the VM cannot reuse them. Unless the data is erased it will stay in the cache. More over, if you write to the file system the data will continue to use more memory. Since it’s definitely possible to run out of memory and lock the system it is recommended to only allow root to write to a RamFS file system.

Tmpfs was derived from RamFS but added size limits and the ability to write the data to swap space. With these limits, it is fairly safe to allow users to write to a tmpfs mount point (don’t forget the permissions!). Tmpfs lives in the page cache and on swap and all pages in memory will show up as cache. In addition, you can use some of the familiar *nix tools such as df and du to check on a tmpfs file system. You can’t do this with RamFS.

There is a good article that explains how to create a RamFS or tmpfs file system. It’s very easy to create a RamFS or tmpfs file system. You don’t really “make” a file system per say. Rather, the mount options creates it. There are really no options for a RamFS file system. A quick example for RamFS is below:

[root@test64 laytonjb]# mount -t ramfs -o size=20m ramfs /mnt/ramfs
[root@test64 laytonjb]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /home type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
ramfs on /mnt/ramfs type ramfs (rw,size=20m)

[root@test64 laytonjb]# umount /mnt/ramfs
[root@test64 laytonjb]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /home type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)

This simple example is for a 20 MB file system. You can’t use df to look at RamFS since the file system can be expanded so df doesn’t mean anything.

Tmpfs is more likely to be used be used by users since it has a size limit. But creating a file system with tmpfs is just as easy. It has only four options (from the man pages):


  • size=nbytes Override default maximum size of the filesystem. The size is given in bytes, and rounded down to entire pages. The default is half of the memory.

  • nr_blocks= Set number of blocks.

  • nr_inodes= Set number of inodes.

  • mode= Set initial permissions of the root directory.

Below is a simple example of creating a 20 MB tmpfs file system.

[root@test64 laytonjb]# mount -t tmpfs -o size=20m tmpfs /mnt/tmpfs
[root@test64 laytonjb]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      17330592  13649208   2786820  84% /
/dev/hda1                99043     48021     45908  52% /boot
tmpfs                  3957596         0   3957596   0% /dev/shm
/dev/sda1            153834852   1890064 144130372   2% /home
tmpfs                    20480         0     20480   0% /mnt/tmpfs
[root@test64 laytonjb]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /home type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
tmpfs on /mnt/tmpfs type tmpfs (rw,size=20m)

[root@test64 laytonjb]# umount /mnt/tmpfs
[root@test64 laytonjb]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      17330592  13649208   2786820  84% /
/dev/hda1                99043     48021     45908  52% /boot
tmpfs                  3957596         0   3957596   0% /dev/shm
/dev/sda1            153834852   1890064 144130372   2% /home
[root@test64 laytonjb]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /home type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)

Notice that once the file system is mounted you can use how large it is by using the df command.

To give you an idea of the speed of a ramdisk, a 1.1GB tmpfs file system was created on an AMD Phenom II X4 920 system (2.8 GHz) with 8GB of DDR2-1066 MHz memory. Then iozone version 3.2.1 was run on the file system. The command used was,

mount -t tmpfs -o size=1100m tmpfs /mnt/tmpfs

[laytonjb@test64 ~]$ df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      17330592  13649432   2786596  84% /
/dev/hda1                99043     48021     45908  52% /boot
tmpfs                  3957596         0   3957596   0% /dev/shm
/dev/sda1            153834852   1913512 144106924   2% /home
tmpfs                  1126400         0   1126400   0% /mnt/tmpfs

[root@test64 ~]# mkdir /mnt/tmpfs/laytonjb
[root@test64 ~]# chown laytonjb:laytonjb /mnt/tmpfs/laytonjb
[root@test64 ~]# su laytonjb
[laytonjb@test64 root]$ cd /mnt/tmpfs/laytonjb

./iozone -Rab /home/laytonjb/tmpfs.wks -i 0 -i 1 -g 1G

The results below are for a 16,384 byte record size for a 1GB file:


  • Write = 1.59 GB/s

  • Re-write = 1.95 GB/s

  • Read = 1.99 GB/s

  • Re-read = 2.01 GB/s

Contrast these with the throughput of a typical single hard drive that may be 100 MB/s with the same set or parameters. Now you know why people like ramdisks.

Next: Uses for Ramdisks

Comments on "Ramdisks – Now We Are Talking Hyperspace!"

I consider something truly interesting about your blog so I saved to favorites .

Very neat blog post.Really thank you! Will read on…

Im grateful for the blog post.Really thank you! Really Great.

It records all tҺe transactiօns tɑкіng ρⅼaϲе in a cοmⲣany ѕⲟ tҺɑt уοᥙ can ɑlաɑʏs һaѵе ɑ chеcк οn tҺе lоѕѕеs іf геգᥙігеⅾ аnd accօгⅾіng tо ցeneгallʏ
аϲceⲣtᥱԀ aссօuntіng ρгіncіρⅼеѕ,
tҺе ƅаsіс
fгаmеաoгқ ߋf ɑccоᥙntіng ѕһߋᥙlԁ aⅼwɑүѕ incⅼᥙԀе fіnancе аnd acϲоսnting rеϲߋгⅾѕ.

Ӎаny ρеоρlе аге maҝіng a ⅼоt օf mоney promоting CPA ߋffегѕ, Ƅut ɑѕ ᥙѕuɑⅼ,
tһеге іѕ а lοt ⲟf mіsіnfօгmatіߋn fⅼoating aгοᥙnd.
Ƭһіs mеtɦօd ρtѕ аrᥱ
cгսсiɑl іnsіԁе ᴡⲟгκing ѡіtһ ɑ Ԁеfіned tаⅼеnt mаnaǥеmеnt ѕtгаtеgу.

ᖴeel fгее tо ᴠіѕіt my
աeƅ ѕіtе – Ьοса
гɑtоn fіnancіаl aԀνіѕοг (Damien)

C?rporate Taxes: Al? b??iness structures p?y tax?? on the income mad? ?n that particular
business. When working under GAAP, revenues and gains have completely separate def?nitions.
Not su?e if the ?RS has a copy of a 1099 or W-2 wage st?t?ment.

my page … Ft. Lauderdale CPA

?ait 12 weeks betwe?n third and fourth rounds, 20 weeks between fou?th
and fifth rounds, and 6 months betwe?n fifth ?nd sixth.
The hormone can be inge?ted into our body system either via injections
or by using drops. I needed to lose w?ight now,
and I needed to lose w?ight fast. Human chorionic gonadotropin (?CG) is
the ?ormonal agent th?t manages the source of nourishment consumption of unborn kids so
that they will receive the nutritional they need in order
to become wholesome and strong. ?ontrary to p?pular belief however, the HC? used in the wei?ht loss treatment is a variation of the
FDA HCG form used for fertility treatments, and in a much smalle?
dose.

Also visit my page: Best hcg drops with hormones

BCL’? CPA in Bangalore Enable Effective Running of ? Business oppo?tunity Lender.

Jonathan Medows, CPA, MBA is the Managing Member oof MEDOWS CPA, PLLC, a boutiqu? New Y?rrk ?PA firm
serving tt?e needs oof individuals, freelancers, sef employed individuals &
mall b??inesses. Consider the Yaeger CP? Review Course – If you ar? looking for an affordable
review course,then you should undoubtedly think about making use of the Yaeger CPA review ?ourse.

Also visit my weblog … deerfield beach cpa

It is perfect time to make some plans for the long run and it’s time
to be happy. I have learn this post and if I may I wish
to recommend you few attention-grabbing things or tips.
Maybe you could write subsequent articles referring
to this article. I want to read more things approximately it!

Here is my webpage :: fast Weight loss tips

I blog quite often and I genuinely thank you for your information. This article has truly peaked my interest.

I am going to take a note of your site and keep checking for new information about once a week.
I subscribed to your Feed as well.

My weblog :: Hcg Distributor

Hmm it seems like your blog ate my first comment (it was extremely long) so I guess I’ll
just sum it up what I had written and say, I’m thoroughly enjoying your blog.
I too am an aspiring blog writer but I’m still new to everything.
Do you have any tips for beginner blog writers? I’d
definitely appreciate it.

Also visit my blog post – Hcg Diets

Howdy! This blog post could not be written much
better! Looking at this article reminds me of my previous roommate!
He constantly kept preaching about this. I most certainly will send this information to him.

Pretty sure he’s going to have a very good read.
Thanks for sharing!

Feel free to visit my site :: hcg weight loss drops walmart

I was curious if you ever considered changing the page layout of your site?
Its very well written; I love what youve got
to say. But maybe you could a little more in the way of content so people could connect with it
better. Youve got an awful lot of text for only having 1 or 2 images.
Maybe you could space it out better?

Also visit my web blog – http://acu.libsyn.com/show-one-party-classroom-david-horowitz-discusses-his-book-audio-mp3/comments?status=incorrect_captcha&incorrect_name=cdfba04e37d5c85744956c69b68a6f25a692d0a6dd74db32a8836ebb05931c78ac263b8dc8e79cda9117707d25e22601f2187cc25247d0d040d35d6b1794f3215fe4434e09fb13ebd38c0dc1de20e1bad7861f052f1605dbc4a1ececf47ee9a8a23ac1aabf8b138870a5d3c2521291751c953bc78c09bf081e9c08b91ab2a73f3b5baf272c51f4120ccbe2ebccaeb0a56ea8e8b31959e52345229dafd9e6d2ee914bb1bc906210b480668b81805e32e4517273fd75b543803e765249839ae08850a9dcdebdd6fa1f1fcb3646be8f7a747e33a63ec304d9f8057021013add70e6cdb35e9ab8f468991e1ada40d2e6290ce49a6d7c54e2f49ed7e005c2fb78a76be0519fcf01b3fc12fa5997c2e278deff7c940071c820d1d29a60c41f142b80093552e41e1532d03e7aafb35f9bc46d05&incorrect_email=cdfba04e37d5c85744956c69b68a6f25a692d0a6dd74db32a8836ebb05931c78ac263b8dc8e79cda9117707d25e22601f2187cc25247d0d040d35d6b1794f3215fe4434e09fb13ebadb11992ff208387fd99eeea8e194331043c8efcbc715ed3a8e84fd2a7fe35f0d61e409309859d839bfe4398678e1c0ba7304edfe6d70d884591af32a5b2fc2cb1aa7999ac69de0becdfc5d2f7d762bc4c504b608967b31329ec69879b38185a782ed9680ac60eb7ec336e1f451826467b691c60de9a5590757ecc8ebd42ba02b565970c7ba43a8889805b7b54df3cafb4b4ff8045b712f53b80457102733031e871661955e951ec61fc4ab6f3f21888c15026dc3b63cc732942ecc79ad5520eebe041fd588cb8d72a2a630705f8851e55d4eba9016c4b993cef06abb712cd5a4f765fcfa755082f566c3a9b9475a8b8bc05c0ff062511a4&incorrect_body=cdfba04e37d5c85744956c69b68a6f25a692d0a6dd74db32a8836ebb05931c78ac263b8dc8e79cda9117707d25e226017930006f2831374f85075a05dc81f1c286da44d1fc99f5e0111b6207388603bffd99eeea8e194331043c8efcbc715ed3a8e84fd2a7fe35f0d61e409309859d838ff07fc5641974b01c953bc78c09bf081e9c08b91ab2a73f3b5baf272c51f412ecdfc5d2f7d762bc4c504b608967b3133f0c0bef97f109e19dd19ba7c156827c7ce472ad24d9bb432cba99221c92ec0071540818a58a35252fb08170685728ac52a615fcb9f85fb0a41e1a238834143872fffafe335f26a70e38745db4f8bdc69e583454bfc55a169e583454bfc55a168b2747675e56331c60e8ab832b44d59057f50bde1b6a85f3c430a58f66443531075

Nice blog here! Additionally your website so much up very fast!
What web host are you using? Can I get your associate link to your host?

I wish my website loaded up as quickly as yours lol

Feel free to visit my weblog Pandacube.raidghost.com

I do not comment, but after reading a bunch of comments on this page Ramdisks – Now We Are Talking
Hyperspace! | Linux Magazine. I actually do have some questions for you if it’s okay.
Could it be only me or do some of these responses look like
they are written by brain dead visitors? :-P And, if you are writing
at additional online sites, I would like to follow everything new you have to post.
Would you list of the complete urls of your social networking pages like your linkedin profile, Facebook page or twitter feed?

my web site – Http://Www.Fakebeast.Com/

Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is important and everything.
Nevertheless just imagine if you added some great images or
videos to give your posts more, “pop”! Your content is excellent but with pics
and videos, this blog could certainly be one of
the very best in its field. Good blog!

Feel free to surf to my web page – best plastic surgeon in bergen county New Jersey

Management Fraud often involv?s a senior management. ?he financial reports may include profit-and-loss
statements and ?xpense r??orts. A CPA must complete a certain amount of
CPE (Continuing Profeessional Education) ?nits each year.

?heck out m? web blpog – accountant in boca raton fl

I have read so many articles or reviews concerning the blogger lovers except this piece of writing is genuinely a fastidious paragraph, keep it up.

Leave a Reply