No space left on device

6,439

Solution 1

Check what's the disk usage with

df -k

and

df -i

The first command will tell you how much diskspace (in terms of kilobytes) is available and the second one will do the counting for inodes . If you have a huge number of small files the partition may have still free diskspace, but run out of inodes (which if you don't know about them, you can see like 'slots' in a parking space)

Ok, so if you effectively are running out of inodes, the only way to fix it is to reformat the partition using different parameters. If you cannot do that, you can try to mitigate the problem by moving part of the 'inode-hungry' section of data to a different partition. Starting from /home top level, you can run this simple script (apologies if it's not 100% fool-proof ;-) )

for dir in *; do [ -d "$dir" ] && echo "$dir" && find "$dir" | wc -l; done

It should count for each subdirectory how many inodes are used (in short, each file or directory present). You can repeat the procedure going down a few levels if you want. Anyway, once you identify the directory that consumes most of the inodes, you can move it to somewhere else, and leave inside /home a symlink to the new location.

Shorter that that, your only chance is to archive (with tar, zip or similar tools) the part of data in /home directory that you are not currently using (and remove the loose files). This will bring the inodes count down, but at the cost of continuously archiving/unarchiving pieces of the storage.

Solution 2

I always start with the effortless "apt-get clean" to remove downloaded package files when I need more disk space.

Share:
6,439

Related videos on Youtube

Prabesh Shrestha
Author by

Prabesh Shrestha

Software Developer from Nepal currently in Munich. I have been developing web applications mosly with Ruby on Rails and Spring.

Updated on September 18, 2022

Comments

  • Prabesh Shrestha
    Prabesh Shrestha over 1 year

    I was getting No space left on device, so I removed some of the files. But again when I try to update my folder with svn update I am getting the same error. Is this the problem with space left?

    When I run df -k I get

    enter image description here

    and when I run df -i , I get

    enter image description here

    It seems like the system has ran out of inode space as you suggested even though I have the space left in my disk. How do I fix this?

    • Olli
      Olli about 13 years
      It might be corrupted filesystem. Or something is filling your disk space very rapidly. Try running fsck -f /dev/sdb (or whatever is your disk). You can't run fsck on mounted filesystem, though.
    • cokeman19
      cokeman19 about 13 years
      Check the free space using df.
    • Prabesh Shrestha
      Prabesh Shrestha about 13 years
      @Adam Bartek I did check with df and edited my question with the screenshots I got .
  • Prabesh Shrestha
    Prabesh Shrestha about 13 years
    Thanks for the suggestions. I did check with df -k and df -i . I have uploaded the outputs I am getting from these commands. It seems like the system has ran out of inodes as you suggested evenif I have the space left in my disk.How do I fix this ?
  • Lekensteyn
    Lekensteyn about 13 years
  • Prabesh Shrestha
    Prabesh Shrestha about 13 years
    @Lekensteyn formating my partition to use different file system will be a little difficult for me , since I will have to configure all my applications again. But I will be doing that if I don't find the solution. Thanks
  • bitwelder
    bitwelder about 13 years
    Edited my answer with some possible workarounds (there isn't other solution other than reformatting/extending the partition)