Port-hpcmips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RAM disk

On Thu, 14 Feb 2008, Scott Lawrence wrote:

Is there a way to set up a RAM disk under hpcmips NetBSD?  Perhaps something
like 1meg big (or auto expanding... either way)

I looked around and found some information about making an install image
that sits in ram, but not really a live, usable, mountable partition after
boot... or perhaps i'm on crack and not reading things through correctly.

On the z50, disk access to the CF card is pretty painful (PIO), and it'd be
nice to have the source code and project directory i'm working on be in a
RAM disk, perhaps like 1meg or so big, then just manually flush changes to
the CF card manually...

I've been using BSD for about 17 years, but I'm only just now getting really
into the details of maintaining and using my own machine.

        The simplest option is probably to mount a tmpfs filesystem and
        copy the files you want to it, then copy things back when done.


        # mkdir /ramdisk
        # mount -t tmpfs tmpfs /ramdisk
        # cp -R /somedir /ramdisk

        the tmpfs will grow and shrink as necessary, so watch out if you
        put too much data on there and use up all your ram...

        Another trick which might help speed up your existing disk is
        to mount the filesystem softdep,noatime, eg: from /etc/fstab

            /dev/wd0a    /    ffs    rw,softdep,noatime    1    1

        softdep will buffer writing updates back (this may or may not be
        a win - it can significantly reduce disk writes, but uses more
        ram... not always what you want on a low ram box)

        noatime will stop the machine from updating the atime (access time)
        on files when they are read, which again reduces writes. It will
        still update the modification time when files are written.

        I'd suggest try noatime first to see, then try add softdep later
        to check if that helps more. Finally try the ramdisk...
        (Though ramdisk + softdep is possibly going to consume all your
        ram :)

        Write a little script to help get consistent timing numbers and
        maybe even let us know how it goes :)

                David/absolute       -- www.NetBSD.org: No hype required --

Home | Main Index | Thread Index | Old Index