/dev/shm "No space left on device" but df -h shows only 20% used.
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
/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:
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?
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
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'!
[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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.