You are not logged in.

#1 2008-02-04 14:59:18

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,891
Website

ramdrive set up

Reading about Ramdrives... now the following commands are for reference only do not run them on your system just to be on the safe side!!!!!!!

Did read on forums a simple way to set up ramdrive but I cannot find it... sure it was iphitus :-)

Want something at least 10mb ?

Make a ramdrive:
The Linux kernel usually makes a number a ramdisks you can make into ramdrives. You have to populate the drive with zeroes like so:
Code:

dd if=/dev/zero of=/dev/ram7 bs=1k count=16384

Makes a 16 MB ramdisk full of zeroes.
Code:

mke2fs -m0 /dev/ram7 4096

puts a file system on the ramdisk turning it into a ramdrive. Watch this puppy smoke.
Code:

debian:/home/sam # hdparm -t /dev/ram7
/dev/ram7:
Timing buffered disk reads:   16 MB in  0.02 seconds = 913.92 MB/sec

You only to do the timing once because it's cool. Make the drive again because hdparm is a little hard on ramdrives. You can mount the ramdrive with:
Code:

mkdir /mnt/mem
mount /dev/ram7 /mnt/mem

Now you can use the drive like a hard drive. This is particularly superb for working on large documents or programming. You can copy the large file or programming project to the ramdrive, which on my machine is at least 27 times as fast as /dev/sda, and ever time you save the huge document, or need to do a compile it's like your machine is running on nitromethane. The only thing is the ramdrive is volatile. If you lose power, or lock up the data on the ramdrive is lost. Use a reliable machine during clear skies if you use a ramdrive.

MrG


Mr Green

Offline

#2 2008-02-04 18:08:42

sozo
Member
From: NL
Registered: 2008-01-21
Posts: 10

Re: ramdrive set up

Similar functionality is provided by /dev/shm I believe?

Offline

#3 2008-02-04 19:40:34

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: ramdrive set up

can't you mount -t ramfs /mnt/ramdrive  and it grows with the amount that you put on it.


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#4 2008-02-04 21:20:16

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,891
Website

Re: ramdrive set up

I thinks that what I was looking for :-) cool ....


Mr Green

Offline

#5 2008-02-05 08:33:51

roadboy
Member
From: Turkey
Registered: 2007-06-23
Posts: 38
Website

Re: ramdrive set up

You can also do this with /dev/shm

Just add below to /etc/fstab wink

none /media/ramdisk tmpfs defaults,user,size=1G,nr_inodes=10k,mode=0777 0 0


in /dev/null no one can hear your scream...

Turkish Archlinux & KDEmod Mirror Administrator
http://server.elsistech.com/archlinux/ ~ http://server.elsistech.com/archlinux/kdemod/

Offline

#6 2008-02-05 08:36:56

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: ramdrive set up

Could have been me, though lilsirecho has messed with this stuff a lot.

Arch used to have /tmp as a ram drive. To speed things up, I used ram occasionally when I was working on beyond earlier on, could create a clean kernel tree in moments.

James

Offline

#7 2008-02-05 08:40:43

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,891
Website

Re: ramdrive set up

thought I read it somewhere on forums....would be handy .... emmm might have been you James just not sure maybe lilsirecho will jump in :-)


Mr Green

Offline

#8 2008-02-05 14:57:20

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

The ramfs system is limited to one half of physical ram, it is a form of tmpfs which is similar.

EDIT:  Tmpfs automatically uses swap when full, ramfs does not.

The speeds are phenom since all elements can be run exclusively in ram.

I have recently studied the use of flash drives in Faunos.

Presently have two Compact Flash devices installed with IDE adapters such that one flash drive contains the boot for Faunos and the other is used for data...video, pix, whatever.  This drive is used as a r/o source, altho has r/w capability.  As such, it becomes a cachedir holding for example, mplayer with deps, vlc with deps, openoffice with deps and whatever else one desires to include.

When needed,say, mplayer is loaded to ram via pacman -Ud.  Then the video stored in the same flash drive is selected and played.  This allows for almost nil access time...the video file in mplayer can be scrolled with the mouse and sync is maintained regardless of forward or backward seek.

Pacman can be used with ....pacman --cachedir..... to upgrade at any time....this writes to the flash cache with ...-Sw  command. 

Any package in the cache can be loaded and run in ram in Faunos.  To retain the package thusly installed  in ram, the save session option is employed on reboot.

This system removes all HDD"s and replaces them with flash drives used mainly as r/o.

This approach increases the operating ram in use by the size of the package thusly placed in ram.  The video file which may be GB in size is not entered directly into ram but is dynamically accessed as r/o.

Thus, the total power drain is dramatically reduced and the ram in use is minimized.  My system has approx 500MB in use at boot and with mplayer installed runs about 600MB while playing a 1GB .avi.

I don't think running games is a good idea with flash!!!

This application of flash devices provides a means of utilizing a ram limited system for many apps that aren't suitable with normal HDD devices.

I have an 8GB flash 100x in use for video, players,pix, openoffice and many graphics and multimedia packages with deps(ffmpeg, avidemux,cinelerra,codeine).

I have been coping with the libata limitations for IDE UDMA 80-wire operation which prevents using UDMA above stage 2.  I have hopes the next Kernel will have that problem fixed.  It should improve the boot time for Faunos from 30 seconds to around 20.

Hope I haven't bored you with this monologue!!!!


EDIT:  By the way, no fsck checks with CF/IDE either!

Last edited by lilsirecho (2008-02-06 16:42:38)


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#9 2008-02-05 15:12:03

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,891
Website

Re: ramdrive set up

Well lots to digest :-)

Can I use a usb flash device in a similar way to ide compact flash not sure it will be as fast?

does having to load mplayer each time you need it slows things down or is it instant?

was thinking of building a diskless server CF route could be the answer

my normal system take longer than 30 to boot Faunos is fast


Mr Green

Offline

#10 2008-02-05 15:25:52

broch
Banned
From: L.A. California
Registered: 2006-11-13
Posts: 975

Re: ramdrive set up

this is what works for me
/etc/fstab:
tmpfs /dev/shm tmpfs size=256m 0 0
creates 256MB RAMDisk

Offline

#11 2008-02-05 15:43:51

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

Mr Green;

I haven't tried USB interface to the IDE bus because all USB devices require overhead on both read and write and this is provided in the IDE adapter circuitry.

There is no circuitry required with compact flash, therefore full capability is provided...with the caveat that at present UDMA is not well provided for in the kernel.

The install from a cachedir flash of mplayer takes place after command-line entry at the speed of the flash device, typically 15 to 20MB/sec.  It doesn't download the package but installs to ram the cached package with deps.  This is done with pacman and takes probably 17 secs.  The access time is nil compare to USB.  EDIT: 17 secs

I have hopes to make the 20 second level for FaunOS when a suitable Kernel handling of the UDMA parameter is provided.  The present kernel does not recognize the 80-wire cable needed for UDMA.

Remember the flash devices are not good for lots of writing.

The 30 second figure is for the time from "starting faun os" to desktop "sound off".  It does not include the start options or hardware detect.  That figure is 45 seconds and is system dependent plus a 5 second wait at the start.

I am anxiously awaiting an UDMA capable interface for the flash device to test the performance .

Last edited by lilsirecho (2008-02-06 03:18:58)


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#12 2008-02-05 16:12:18

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

Raymano has expressed interest in providing Faunos on a smaller scale which would likely reduce the boot time and enhance the performance of this discussion of IDE HDD replacement with flash drives.  The missing packages would reside in the cachedir flash drive.

Maybe a ten second boot?


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#13 2008-02-05 16:17:44

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

In addition to the flash drive IDE interface, an external USB drive would provide an additional capability for the system, including cd/dvd/HDD,sata,sane,etc...........to say nothing about even more flash!!!!  USB tho....


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#14 2008-02-05 16:21:48

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

I suppose if one really got lazy, you could generate the install of frequently used packages from cache by providing a script for the pacman interface commands for each desired package in the same cachedir.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#15 2008-02-05 16:50:14

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

When utilized as a cachedir, the flash drive/IDE appears in the system as /media/disk.

Took a while to find that in my fumblings!!!!


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#16 2008-02-05 17:39:16

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: ramdrive set up

Be aware that loading from the archive loads directly into ram via aufs and executes directly in ram.

This differs from running the system from flash-usb or flash-IDE with the boot flash device since it is compressed with squash and has to be de-compressed to run in ram.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

Board footer

Powered by FluxBB