Results 1 to 3 of 3

Thread: Copying ramdrive

  1. #1

    Default Copying ramdrive

    As I understand it, you need to have the commands to automate creation of your ram drive in /etc/rc.local. However (and apologies for being in the wrong subforum if it is), where would I put the command to copy the files out of the ram drive and on to my RAID array?

    And if you want background, I have 12 GB of RAM on a dual Opteron 265 motherboard. 4 GB of that are planned for a /game folder that I'll need to copy the saved games (at minimum out of). Understand that I do know how to automate the creation, formatting, ownership, and copying of the game files, but I'm unsure of how to make sure the files are auto-copied when the system is sent the shutdown or reboot signal. Thanks for your help.

  2. #2

    Default Re: Copying ramdrive

    Using tmpfs is generally more efficient because the data is stored in VM pages, rather than backed by a memory block device.

    What you should do is create an entry in /etc/fstab to mount the tmpfs.

    Then in /etc/init.d, and the rc?.d/directories, create a boot up service, which mounts and sets up the game files, copies data from your RAID copy, using rsync -ax to initialise the 'drive'. The rc?.d directories have symlinks for services started in a runlevel S80gamefile-rd for example and K20gamefile-rd, to have service called with 'stop'.

    On shutdown, you can then use an rsync -ax, to copy only the changes back, via the stop part of the init.d script.

    You may also like to periodically sync up the changes with rsync, in case of power failure to reduce data loss.

  3. #3

    Default Re: Copying ramdrive

    Quote Originally Posted by robopensuse View Post
    Using tmpfs is generally more efficient because the data is stored in VM pages, rather than backed by a memory block device.

    What you should do is create an entry in /etc/fstab to mount the tmpfs.

    Then in /etc/init.d, and the rc?.d/directories, create a boot up service, which mounts and sets up the game files, copies data from your RAID copy, using rsync -ax to initialise the 'drive'. The rc?.d directories have symlinks for services started in a runlevel S80gamefile-rd for example and K20gamefile-rd, to have service called with 'stop'.

    On shutdown, you can then use an rsync -ax, to copy only the changes back, via the stop part of the init.d script.

    You may also like to periodically sync up the changes with rsync, in case of power failure to reduce data loss.
    Thank you for your suggestions. I had not considered using tmpfs, a quick google search indicates that it actually doesn't even need to be created (I would have formatted my /game to ext2), just mounted. It also indicates that it is dynamically growing and shrinking; is this something I need to be worried about? Since I have such an excess of RAM, and I've never seen utilisation over ~1,5 GB I was assuming that using a Ramdrive as a block device wouldn't impact my system. Also there was a mention of the tmpfs getting to big and the kernel killing it-we all know that the impulse to squeeze just a bit more in is very strong!

    I had also considered the rysnc, but am not very proficient yet in Linux and figured that it would be sufficient to simply have the contents copied--but there are frequent brown-outs/black-outs where I live, so perhaps it's time to start reading up.

    Also the adding the line into fstab was overlooked, but I suppose it would ensure that the 'drive' was available in Dolphin. Would including mount tmpfs /game -t mke2fs -o size=8G,mode=0777 automate the steps, which I was going to do as follows?
    Code:
    /sbin/mke2fs -q -m 0 /dev/ram0(obviously this step is not needed if I use tmpfs)
    /bin/mount /dev/ram0 /mnt/game (I'm guessing I can drop this step also and just do a mount tmpfs /dev/shm -t tmpfs -o size=8G)
    /bin/chown dave_boo:root /mnt/game
    /bin/chmod 0750 /mnt/game
    Last edited by dave_boo; 22-Jan-2009 at 17:54. Reason: mistypes

Posting Permissions

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