LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-08-2012, 05:58 PM   #1
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 321
Blog Entries: 1

Rep: Reputation: 31
ramfs maxsize limit


I'd like to create a little FS in ram. Just to use there a little SQLite3 database.

I know ramfs size grows dynamically, so I tried this "maxsize" option and I got no error:

Code:
# mount -t ramfs -o size=128k,maxsize=256k ramfs ./ramfs/
But I think limit didn't work cos' I tried copying a file greater that 256Kb and it was copied.

I know tmpfs can use limit (doesn't grow dynamically) but as fas as I know tmpfs uses swap space, and what I want to do is avoiding use of hard disk, so ramfs is the one which best fits my needs.

Does anybody know if a limit can be set to ramfs filesystem?

I didn't find very much documentation. Thanks in advance.
 
Old 10-08-2012, 09:04 PM   #2
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by matiasar View Post
I know tmpfs can use limit (doesn't grow dynamically) but as fas as I know tmpfs uses swap space, and what I want to do is avoiding use of hard disk, so ramfs is the one which best fits my needs.
If you want to avoid use of the hard disk, then why don't you disable swap entirely? If swap is disabled, I don't think tmpfs will create it.
 
Old 10-09-2012, 03:14 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Nope.
Have a read of this.
 
Old 10-09-2012, 07:15 AM   #4
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 321

Original Poster
Blog Entries: 1

Rep: Reputation: 31
Thanks for your advices folks.
I wouldn't like disabling swap space.
Thanks for the documentation! After reading the document I just have a doubt I couldn't find the answer:

tmpfs by default uses swap space? Or first it uses RAM and in case of necessity swap?

Regards,
Matías
 
Old 10-09-2012, 03:57 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
tmpfs uses kernel cache (RAM).
Unless you are under heavy memory pressure, it is (extremely) unusual to see it swap. I haven't used anything else for years where tmpfs is an option.
 
Old 10-09-2012, 04:11 PM   #6
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 321

Original Poster
Blog Entries: 1

Rep: Reputation: 31
Cool SygOO. Then tmpfs is definitely my choice!
Thanks a lot for the info.

Last edited by matiasar; 10-09-2012 at 04:15 PM.
 
Old 10-09-2012, 08:17 PM   #7
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by syg00 View Post
Nope.
Have a read of this.
Yeah, I read that, too. I think you misunderstood me. I'm not saying tmpfs won't use swap, I'm saying that if there are no swap partitions mounted, tmpfs will not magically make them come into being (i think anyway!). Of course it will use them if they're there (if it really needs to, as you pointed out).

but if the OP doesn't want to disable swap, then that doesn't matter. however, the OP does not mention why he wishes not to swap. if it is for security reasons, then encrypting swap is always another layer of protection.

also, as to the original question: I believe there is work going on to patch the kernel to support the use of user quotas (like disk space usage) on tmpfs, but it is not a clean solution (yet).
 
  


Reply

Tags
grow, limit, ramfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with the ramfs................ sundar007 Linux - Embedded & Single-board computer 8 06-29-2010 09:09 AM
[SOLVED] maxSIZE of a file. Hitboxx Programming 22 05-26-2009 08:06 AM
Using inotify with ramfs Shreyasdm Linux - General 1 09-28-2008 04:28 AM
ramfs anyone? alaios Linux - General 0 10-21-2004 02:18 PM
ramfs alaios Linux - General 0 10-12-2004 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration