Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Kindly tell me the difference between ramdisk and ramfs.

share|improve this question

migrated from stackoverflow.com Nov 15 '10 at 16:33

This question came from our site for professional and enthusiast programmers.

2 Answers 2

A RAM disk implements a virtual disk in volatile memory. A RAM filesystem implements a virtual filesystem in volatile memory.

In other words: the difference between a RAM disk and a RAM filesystem is the difference between a disk and a filesystem.

share|improve this answer
    
So what then is the difference between a disk and a filesystem? To me it sounds like a box and a crate -- different word, same thing. Please elaborate. Danke! –  Torben Gundtofte-Bruun Dec 1 '10 at 18:35
    
@torbengb: a disk is a physical device, i.e. hardware that stores unstructured 0s and 1s, without meaning. A filesystem is a data structure, i.e. software (very much like a database, actually -- in fact, a filesystem arguably is a database) that stores structured directories and files (and file metadata such as permissions, ownership, creation date etc.) which have actual meaning. –  Jörg W Mittag Dec 1 '10 at 19:17

"RAM disk" is a device driver that merely creates block devices that store their data in memory (fixed max size, allocated gradually by need), which you can use for any purpose, e.g. create ext2 filesystem on it and then mount to some location in filesystem. Many Linux distributions are by default configured to automatically create and present these devices as /dev/ram0, /dev/ram1, ...

"ramfs" is a filesystem driver. To utilize it, you use "mount" command, just specify filesystem type (ramfs) and target directory; device is not required (e.g. "none" can be used): mount -t ramfs none /path/to/location

Regarding usage, the major difference between two is that "ramfs" reuses existing kernel caching mechanisms to store its data. In other words, when you write to "ram disk" your data is saved to memory allocated by that ram disk, plus that data is saved in RAM by kernel caching mechanism, so we get duplication here. When using ramfs, no duplication happens, as ramfs directly uses those caching mechanisms as its own (ramfs) implementation.

See also: https://www.kernel.org/doc/Documentation/blockdev/ramdisk.txt https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.