Ubuntu – No space left on the device though there is space


I am copying file and I got an error message saying "no space left on the device".

root@nn:~# df -h
Filesystem                                       Size  Used Avail Use% Mounted on
/dev/xvda2                                       5.9G  5.9G     0 100% /
udev                                              98M  4.0K   98M   1% /dev
tmpfs                                             48M  196K   48M   1% /run
none                                             5.0M     0  5.0M   0% /run/lock
none                                             120M     0  120M   0% /run/shm  198G  108G   75G  59% /groups/ch-geni-net/Hadoop-NET               198G  108G   75G  59% /proj/ch-geni-net
/dev/xvda4                                       7.9G  147M  7.4G   2% /mnt

root@nn:~# df -i
Filesystem                                       Inodes  IUsed   IFree IUse% Mounted on
/dev/xvda2                                       385024 107796  277228   28% /
udev                                              25038    388   24650    2% /dev
tmpfs                                             30537    262   30275    1% /run
none                                              30537      4   30533    1% /run/lock
none                                              30537      1   30536    1% /run/shm
overflow                                          30537      4   30533    1% /tmp
/dev/xvda4                                       524288     12  524276    1% /mnt 8752638 443710 8308928    6% /groups/ch-geni-  net/Hadoop-NET              8752638 443710 8308928    6% /proj/ch-geni-net

Why cant it use /dev/xvda4 when /dev/xvda2 is full ? /dev/xvda4 is newly mounted. Running ubuntu 12.04LTS.

Best Answer

That isn't how Linux works.

You need to move files from

/dev/xvda2                                       5.9G  5.9G     0 100% /

to some other place.

You can find which files are using space by using du.

du -kx | sort -nr | less

Will list files and directories ordered by which use the most space.

You could move them and symlink them if needed so that they appear to be in the previous location.

e.g. I use uvt on my system and so my uvt directory is rather large, I may want to move it out of my root file system

mkdir -p /mnt/var/lib/uvtool/libvirt
mv /var/lib/uvtool/libvirt/images /mnt/var/lib/uvtool/libvirt
ln -s /mnt/var/lib/uvtool/libvirt/images /var/lib/uvtool/libvirt/images

In this case I'd have to shutdown those uvt machines before I move them. Depending on what you move you may need to shutdown services and/or restart them after the data is moved.