Link to home
Start Free TrialLog in
Avatar of lwdalton3
lwdalton3Flag for United States of America

asked on

Ramdisk to emulate a hard drive on Linux Fedore

Currently I am using the statistical package R, but mostly prepare my data with C. The passing of data from C to R is very cumbersome, so I have simply been communicating from R to C via leaving messages on the hard drive. From R I save a file (write.table function) then call a C program without passing paramters, but C loads a file, does what it needs to do, write something down and then R reads it back via read.table. It is not eloquent but it works. It would be nice to speed things up  with a RAM drive that would for all intents and purposes be an extension of the hard drive.

I have tried to figure out the one which comes with Fedora but instructions are  way to cryptic for me and some kind of error always pops up. I do not need the drive to be invisible. I would rather it not autoboot. I need about 8mb of memory reserved for data. All I need to store are .txt files and do not need to run programs from the file.

just want to be able to do something like

FILE *inFile = fopen( "./root/myRAMDISK/myfile.txt", "r");

Avatar of Josef Pospisil
Josef Pospisil
Flag of Germany image

http://www.cyberciti.biz/faq/howto-create-linux-ram-disk-filesystem/

try this i could create a ramdisk within seconds on Ubuntu maybe it will work for Fedora...
Yes, Jelcin, those look like generic Linux instructions.  They should work just fine in Fedora or whatever Linux.

lwdalton3, you will need to have RAM disk support enabled in the kernel.  But if you are using a stock kernel, it should be.  

The mount command is important.  You can't just open the file unless the ramdisk is mounted.  You can automount it (but that doesn't sound like what you want).  You can also configure /etc/fstab so that a user (not root) can mount it, if that's what you need.
Avatar of lwdalton3

ASKER

I think I am on the right path here, but Fedora wants a bit more. So maybe that is what hmccurdy refers to. If so I would need pretty much word by word what the entries are. I am OK once comfortably in the confines of C, but am pretty clueless about the command line.
Thanks for response, and I apologize in advance for only responding once a day-- have to work a long day job. I do not mind having an autoload with boot up if that is what is necessary. LD

[root@raven ~]# mkfs -q/dev/ram1 8192
mkfs.ext2: invalid option
Usage: mkfs.ext2 [-c|-l filename] [-b block-size] [-f fragment-size
      [-i bytes-per-inode] [-I inode-size] [-J journal-options]
      [-G meta group size] [-N number-of-inodes]
      [-m reserved-blocks-percentage] [-o creator-os]
      [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
      [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
      [-T fs-type] [-U UUID] [-jnqvFKSV] device [blocks-count]
[root@raven ~]# mkdir -p/ramcache
mkdir: invalid option -- '/'
Try `mkdir --help' for more information.
[root@raven ~]# mkdir -p /ramcache
[root@raven ~]# mount /dev/ram1 /ramcache
mount: you must specify the filesystem type
[root@raven ~]#
ASKER CERTIFIED SOLUTION
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What was posted got me on the right track.
After digging around I found the following as what worked

[root@raven ~]# mkdir  /var/ramdisk
[root@raven ~]# mount -t  tmpfs none  /var/ramdisk -o  size=28m
[root@raven ~]# cd /var/ramdisk
[root@raven ramdisk]# dir
[root@raven ramdisk]# cp /root/Desktop/microarraydata.txt /var/ramdisk
[root@raven ramdisk]# dir
microarraydata.txt
[root@raven ramdisk]#