LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-20-2011, 04:25 AM   #1
amunro
LQ Newbie
 
Registered: May 2011
Posts: 16

Rep: Reputation: Disabled
/dev/shm "No space left on device" but df -h shows only 20% used.


I run centOS 5 on a VPS.

I am trying to write to a ramdisk at /dev/shm as my IO speed is terrible, however everytime I try and write to the directory, it copies around 700mb and then tells me there is no space left.

However, when I run df, it tells me that there is plenty of space:

[root@V-3242 shm]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 150G 6.1G 144G 5% /
none 3.9G 776M 3.2G 20% /dev

[root@V-3242 shm]# free -m
total used free shared buffers cached
Mem: 7955 800 7155 0 0 0
-/+ buffers/cache: 800 7155
Swap: 859 773 85


Any ideas? I notice that my Swap is now full, perhaps it could be restricted to only swap memory. If so, how do I change this so it can use my physical RAM?

Here is my fstab if it helps:

none /dev/pts devpts rw 0 0
 
Old 12-20-2011, 10:54 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
When you want to write to /dev/shm, why do you mount /dev/pts instead?
 
Old 12-20-2011, 11:40 AM   #3
amunro
LQ Newbie
 
Registered: May 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
When you want to write to /dev/shm, why do you mount /dev/pts instead?

I don't, that's just how the fstab came came with the installation. You think I should try writing to /dev/pts ?
 
Old 12-20-2011, 11:45 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
No, of course not. The best way to use a ramdisk nowadays is doing it with tmpfs. Try something like this:
Code:
mkdir /ramdisk
mount -t tmpfs tmpfs /ramdisk
This will mount the tmpfs ramdisk to /ramdisk and gives it by default a maximal size of 50% of your RAM. Keep in mind that tmpfs only uses the amount of RAM it actually needs. I, for example, use it for /tmp on my laptop with SSD.
This is how the entry in my fstab looks like:
Code:
tmpfs		/tmp		tmpfs		defaults,mode=1777	0 0
Here some output from mount and df:
Code:
tobi@dragon ~ :) % mount
/dev/sda2 on / type ext4 (rw,noatime,discard,commit=0)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda3 on /home type ext4 (rw,noatime,discard,commit=0)
tmpfs on /dev/shm type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw,mode=1777)
tmpfs on /home/tobi/.cache type tmpfs (rw,mode=1777)
//server/server on /server type cifs (ro,mand)
tobi@dragon ~ :) % df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/sda2        9.9G  4.3G  5.2G  46% /
/dev/sda3         25G   20G  3.7G  85% /home
tmpfs            1.9G     0  1.9G   0% /dev/shm
tmpfs            1.9G   92K  1.9G   1% /tmp
tmpfs            1.9G  8.0K  1.9G   1% /home/tobi/.cache
//server/server  1.8T  1.8T   30G  99% /server
 
Old 12-20-2011, 11:25 PM   #5
amunro
LQ Newbie
 
Registered: May 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
No, of course not. The best way to use a ramdisk nowadays is doing it with tmpfs. Try something like this:
Code:
mkdir /ramdisk
mount -t tmpfs tmpfs /ramdisk
This will mount the tmpfs ramdisk to /ramdisk and gives it by default a maximal size of 50% of your RAM. Keep in mind that tmpfs only uses the amount of RAM it actually needs. I, for example, use it for /tmp on my laptop with SSD.
Ok I have tried making a new ramdisk however I still find that it copies the data it says 'No space left on device' even though I have plenty of physical RAM left over.

Here is the output I get so you can see what I am talking about:

Code:
 
[root@V-3242 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          7955       5778       2177          0          0          0
-/+ buffers/cache:       5778       2177
Swap:          859        724        134
[root@V-3242 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/simfs            150G  6.1G  144G   5% /
none                  3.9G  4.0K  3.9G   1% /dev
tmpfs                 3.9G  778M  3.2G  20% /ramdisk
[root@V-3242 ~]# cp server/server.log /ramdisk/server
cp: writing `/ramdisk/server/server.log': No space left on device
As you can see, there is at-least 2177mb left and the /ramdisk directory is only 20% full, however it still says 'No space left on device'!
 
Old 12-21-2011, 10:34 AM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Is it possible that your data contains many small files, so that the file-system runs out of inodes? You can check that with df -i
 
Old 12-21-2011, 04:40 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
Why no (real) info ? What is the size of that log file, and what's on /ramdisk (ls /ramdisk) ?
 
Old 12-21-2011, 11:31 PM   #8
amunro
LQ Newbie
 
Registered: May 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
No the inodes are fine:

Code:
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/simfs           119832704  332495 119500209    1% /
none                 1018330      96 1018234    1% /dev
tmpfs                1018330   35182  983148    4% /ramdisk
The folder contains around 35k data files.

Code:
[root@V-3242 ramdisk]# find . -type f | wc -l
35020
Also the size of the file doesn't even matter, it refuses anything I try copy. I can delete everything in the folder however it always reports 'No space left on device' at 20% capacity.
 
Old 12-23-2011, 06:15 AM   #9
amunro
LQ Newbie
 
Registered: May 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Bump.
 
Old 03-06-2012, 12:38 PM   #10
karanis
LQ Newbie
 
Registered: Mar 2012
Posts: 1
Blog Entries: 21

Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
Is it possible that your data contains many small files, so that the file-system runs out of inodes? You can check that with df -i
TobiSGD is totally right... It is because of being "out of inode", not disk space... At least for my situation.

Thanks TobiSGD

Last edited by karanis; 03-06-2012 at 12:39 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apt-get -f install fails due to "No space left on device" madkayaker Linux - Newbie 9 01-05-2014 09:39 PM
"No space left on device" - rootfs image build error sjremya Linux - Software 2 08-30-2010 12:16 AM
Moving a file into a large directory: "No space left on device" Jimantha Linux - General 2 09-09-2008 11:40 PM
"No space left on device" error using SystemV shared memory clalfa Programming 5 07-09-2007 07:34 AM
"no space left on device" - But df shows free space! monita Linux - General 7 03-30-2004 01:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:05 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