Mount /tmp in ram?

Discussion in 'Modding and Customization' started by Demiurge, Aug 14, 2008.

  1. Demiurge

    Demiurge

    Joined:
    Aug 8, 2008
    Messages:
    28
    Likes Received:
    0
    Location:
    Norway
    Can someone please explain how to mount /tmp, /var/log and other useful directories to ram? I don't seem to manage to get the fstab right, my beloved one stops as soon as the cursor appears :(

    Code:
    /dev/sda1          /                  ext2          defaults,noatime,async        1 1
    none               /dev/pts           devpts        gid=5,mode=620         0 0
    none               /dev/shm           tmpfs         defaults               0 0
    none               /proc              proc          defaults               0 0
    none               /sys               sysfs         defaults               0 0
    tmpfs              /tmp               tmpfs         defaults,noatime,rw,mode=1777  0 0
    tmpfs              /var/tmp           tmpfs         defaults,noatime,rw,mode=1777  0 0
    tmpfs              /var/log           tmpfs         defaults,noatime,rw,mode=0755  0 0
    
    #/dev/sda2          swap               swap         defaults               0 0
    
     
    Demiurge, Aug 14, 2008
    #1
  2. Demiurge

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    /tmp is already mounted tmpfs, just not in the fstab, they did in in the /etc/rc.d/rc.S script instead, remove/comment the /tmp line in your fstab and it should work. If you want to check this look in the /proc/mounts file, this is the definitive list of mounts maintained by the kernel since the /etc/mtab file which mount reads is not always correct.
     
    retsaw, Aug 14, 2008
    #2
  3. Demiurge

    muaB

    Joined:
    Aug 27, 2008
    Messages:
    26
    Likes Received:
    0
    sry for dumb questions, i'm a linux noob (willing to change it ,p):
    1) why is that? i mean, whats the benefit of not setting it on "the right place"?
    2) if it is working, why isn't it listet in terminal using "mount"?
    3) what about /var/(lock/log)?

    thx in advance =)
     
    muaB, Sep 8, 2008
    #3
  4. Demiurge

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    1) Presumably they needed it mounted earlier than the filesystems in /etc/fstab, I don't know why though.

    2) Mount uses the /etc/mtab file to store details of mounts and also reads from it, mount also has an option not to write to this file when making mounts, typically this is used when the filesystem that contains /etc is read-only, however in this case it is mounted read-write before mounting /tmp. So the reason mount doesn't list it as mounted is because someone told mount not to record its mounting in /etc/mtab, but there isn't a good reason to do this.

    3) You can mount /var/log in the fstab without problems, however I choose to mount it in /etc/rc.d/rc.S just after the entry to mount /tmp to make sure it was done before any log files were written.
     
    retsaw, Sep 14, 2008
    #4
  5. Demiurge

    Guest Guest

    I have been having the same problem. I swear I got this working before. I had to reinstall the whole OS recently and now, as soon as I put /var/tmp and /var/log it gets stuck with a big X cursor. Very strange!
     
    Guest, Sep 23, 2008
    #5
  6. Demiurge

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    Are you sure the cause is when you put /var/tmp and /var/log, rather than the entry for /tmp?

    As I said before /tmp is already mounted in RAM before the fstab gets processed, I believe trying to mount another ramdisk on top of that is what causes the problem, though perhaps it is because by the time the fstab gets processed /tmp and possibly /var/tmp is already being used.
     
    retsaw, Sep 29, 2008
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.