You are not logged in.

#1 2008-06-27 04:02:25

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

[SOLVED]How to mount a ramdisk?

i have 2g ram and only use <0.5g.
i remember some other distro ( like ubuntu ) have /dev/ram, but arch dose not.
how can i mount it on /tmp?
thanks a lot

Last edited by aaaaarch (2008-06-30 03:47:01)

Offline

#2 2008-06-27 04:27:43

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,891
Website

Re: [SOLVED]How to mount a ramdisk?


Mr Green

Offline

#3 2008-06-27 04:41:51

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

Re: [SOLVED]How to mount a ramdisk?

i got this way, but the problem is no /dev/ram? file on my system!
so i wanna know how to enable /dev/ram? files.

Offline

#4 2008-06-27 14:58:03

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: [SOLVED]How to mount a ramdisk?

use tmpfs, which I believe is better than ramfs

mount none ~/.thumbnails -t tmpfs -o size=20M

This is what I use for my .thumbnails directory

Offline

#5 2008-06-29 10:37:42

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

Re: [SOLVED]How to mount a ramdisk?

could any one help me?

Offline

#6 2008-06-29 12:42:06

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED]How to mount a ramdisk?

Put this in /etc/fstab:

none    /tmp    tmpfs   nodev,nosuid,noexec,nodiratime,size=1024M    0   0

Offline

#7 2008-06-29 13:08:28

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: [SOLVED]How to mount a ramdisk?

This is what I use in /etc/fstab:

ramfs       /mnt/ramdisk ramfs   defaults              0 0

Offline

#8 2008-06-30 03:46:40

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

Re: [SOLVED]How to mount a ramdisk?

thanks, i've solved it

Offline

#9 2008-06-30 03:56:40

czar
Member
Registered: 2008-03-08
Posts: 115

Re: [SOLVED]How to mount a ramdisk?

aaaaarch wrote:

thanks, i've solved it

which is the solution...please share.

Offline

#10 2008-07-01 13:28:13

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

Re: [SOLVED]How to mount a ramdisk?

MrG's solution doesn't fit me, because no /dev/ram? on my system.
the solution for me is just like carlocci, lucke and Barrucadu said: mount "none" as tmpfs or ramfs.
you can choose anyone which can works on your system.

Offline

#11 2009-04-30 23:50:06

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,592
Website

Re: [SOLVED]How to mount a ramdisk?

lucke wrote:

Put this in /etc/fstab:

none    /tmp    tmpfs   nodev,nosuid,noexec,nodiratime,size=1024M    0   0

This is pretty cool, thanks for sharing it.  Can one do this without an /etc/fstab entry via a bash script for example?  What would the syntax be for using the mount command from the shell?

Last edited by graysky (2009-05-01 00:01:31)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#12 2009-05-01 09:37:55

bangoskank
Member
Registered: 2008-12-04
Posts: 18

Re: [SOLVED]How to mount a ramdisk?

graysky wrote:
lucke wrote:

Put this in /etc/fstab:

none    /tmp    tmpfs   nodev,nosuid,noexec,nodiratime,size=1024M    0   0

This is pretty cool, thanks for sharing it.  Can one do this without an /etc/fstab entry via a bash script for example?  What would the syntax be for using the mount command from the shell?

# mount -t tmpfs -o nodev,nosuid,noexec,nodiratime,size=1024M none /tmp

You could also use size=50% (or any other value) to get a percentage of your RAM in a tmpfs.

Last edited by bangoskank (2009-05-01 09:40:24)

Offline

#13 2009-05-01 15:50:39

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED]How to mount a ramdisk?

But does it really limit the maximum amount of ram it uses?

I like the idea of having a ramdisk, so far I haven't looked to much into it but this thread made me finally try it.

I've tried "mount -t ramfs -o size=256M none ramdisk" and I can write files bigger than 256M to ram .... am I missing something here? Ramfs should be the one that doesn't grow right?


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#14 2009-05-01 22:13:31

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: [SOLVED]How to mount a ramdisk?

I think that it will also use whatever /dev/shm has available too, Rookie.  Maybe run a df -h after doing your test & see what it turns up?

Offline

#15 2009-05-02 13:22:16

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED]How to mount a ramdisk?

I've been looking more into this and it seems that is the expected behavior of ramfs. tmpfs will use ram and swap if there isn't enough ram available but will limit the usage to the size specified in the mount options. tmpfs is also newer than ramfs so I guess it should be preferred over ramfs.

As I have 4G of ram and I don't use swap if I define a reasonable size for the ramdisk all should be ok. I intend to use a ramdisk to recompile stuff that takes longer to compile like the kernel or other big stuff, so 1G or 2G should be enough for that while still having more than enough ram for the system.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB