Find the answer to your Linux question:
Results 1 to 4 of 4

Thread: Ramdisk File

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Ramdisk File


    I want to create a file system which can be store on the local hard drive similar to this...

    dd if=/dev/zero of=/tmp/lite bs=1k count=100000
    mkfs -t ext2 -i 1024 -b 1024 -F /tmp/lite
    mount -o loop /tmp/lite /tmp/loop

    it creates a file which can be mounted as a mount point and accessed in a read/write fashion which can then be unmount and copied and then be remount.

    All good so far, I have done this and works perfectly.
    Here is the problem I have, I want to be able to mount to either the main hdd (Basically just mounting it where it is) or mounting it to the ram (a mount command which copies it to the ram for fast IO speeds).

    Is there a way to do this, I'm open to many options I don't really care how this is achieved, its the end goal I'm after.


  2. #2
    Hi. I think you must create the ramdisk, then replicate the files to the ramdisk with rsync for example.
    I would do this :
    mount -o loop /tmp/lite /tmp/loop
    mount -t tmpfs /dev/shm /tmp/ramdisk
    rsync -av /tmp/loop /tmp/ramdisk
    Don't forget that any modification you make in /tmp/ramdisk WILL NOT be replicated to your "filesystem_in_a_file".

  3. #3
    I was afraid that this might be the case, thanks for you reply.

  4. $spacer_open
  5. #4
    ...Unless you enter a
    rsync -av /tmp/ramdisk /tmp/loop
    before unmounting and shutting down your computer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts