1

I need to put two directories into a ramdisc. They share the same parent directory but I can't make that parent directory part of the ram disc. How would I go about doing this?

Bacu
  • 11
  • 1

1 Answers1

2

In Linux if a directory is associated with a mount all storage goes to that mount. With that said it is possible to have a TMPFS (Temp file system) mount inside a file system which comes from iSCSI for example, and within the TMPFS file system you can mount another file system which comes from local disk.

So in your case you have /path/to/parent as the directory you want your child1 and child2 directories.. In this case it's just a matter of putting this in your fstab file.

tmpfs /path/to/parent/child1 tmpfs defaults,size=20m 0 0
tmpfs /path/to/parent/child2 tmpfs defaults,size=20m 0 0

Now if the directory /path/to/parent is in another file system that file system must be mounted first.

More information can be found here.

Red Tux
  • 2,074
  • 13
  • 14
  • I'd feel a little safer recommending tmpfs over ramfs. See http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt and http://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt – sciurus May 03 '11 at 04:00
  • Good point, answer edited to reflect this. – Red Tux May 03 '11 at 04:53