[CentOS] Odd Question... MAX Ram Disk Size

Thu Mar 31 18:10:39 UTC 2005
Aleksandar Milivojevic <amilivojevic at pbl.ca>

Craig White wrote:

> this is great info and I suppose I might find use for it someday but
> wouldn't a loop mount from an iso file (the disk image) be better for
> this purpose?

It depends on how mounted file system is used.

If you mount read-only (which is the only option with ISO image), than 
loop mount would work fine too, or even better.  If server has enough 
RAM to cache entire image (and keep it cached), than disk would be 
accessed only on first read, and subsequent reads would go from cache. 
Of course, when system needs memory for something else, cache is the 
first thing thrown out.  Same goes if you mount read/write with noatime 
option and majority of I/O is read with ocasional write.

If you want to write to that file system, and write often (for example, 
image contains ext3 or vfat file system), and you don't care information 
being lost after reboot (example would be using it for /tmp), than it is 
better to use tmpfs.  If you have enough free RAM, the information you 
don't care about will never be written to the disk.  In case of loop 
device, eventually it would.  So you save some disk I/O.

In both cases, system will use information from RAM whenever possible, 
and disk if you get low on free RAM.  In both cases, pages with data not 
accessed for a long time, will be first to go back to disk (or simply 
marked as free if not changed).

This is basically idea why on Solaris /tmp is mounted as tmpfs by 
default.  On Linux many people argue that files in /tmp "usually" live 
for short enough time not to be commited to disk anyhow.  Which is true 
for some types of files, and usually those are the files you really care 
not to have actuall disk I/O.  IMO, it never hurts to actually make sure 
this happens for any type of temporary file by using tmpfs (provided 
there's enough RAM).  There's no performance degradation for using tmpfs 
(instead of utilizing disk cache), but there is potential benefit.

-- 
Aleksandar Milivojevic <amilivojevic at pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7