fatal error No space left on device

问题描述 投票:7回答:3

Situation: Just installed linux, Trying to learn to code c. Gets set up with sudo apt-get install build-essential. Open nano type in my code

#include <stdio.h>

int main(int argc, char *argv[])
{
        puts("Hello World.\n");
        return 0;
}

open another console tab, types in make ex1then my world spins downward into the darkest abyss i have yet to experience on my first linux distro.

ragnar@ragnar:~/Documents/C$ make ex1
cc -Wall -g    ex1.c   -o ex1
ex1.c:7:1: fatal error: error closing /tmp/cc8d7Oap.s: No space left on device
 }
 ^
compilation terminated.
make: *** [ex1] Error 1


ragnar@ragnar:~/Documents/C$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb5       4.0G  3.8G     0 100% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            7.9G  8.0K  7.9G   1% /dev
tmpfs           1.6G  1.4M  1.6G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            7.9G  8.1M  7.9G   1% /run/shm
none            100M   28K  100M   1% /run/user
/dev/sdb2        96M   29M   68M  30% /boot/efi
/dev/sdb7        11G  248M  9.5G   3% /home

all help is appreciated.

c linux compiler-errors makefile
3个回答
13
投票

The partition containing the root folder (/) is 100% full. The root folder currently also contains the /tmp folder, which is used during compilation to store temporary files. As the root folder and with this the tmp folder is full, this fails.

To get around this either add more space, or reorganise the existing one.

As a workaround do

mkdir ~/tmp
export TMPDIR=~/tmp

and retry compilation.


A flexible way to organise a file system is using seperate partitions for

/
/usr
/home
/var
/tmp

A lazy approach would be to link /tmp/ to /var/tmp. This however might cause issues as in terms of clean-up the OS might handle the content in /var/tmp different from the content in /tmp. That is the content of /tmp/ would get deleted on each boot where as /var/tmp wouldn't.


0
投票

here is my output from df:

[857][rkwill.rkwill-desktop: /home/rkwill]$ df -h -T
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda1      ext4      910G   16G  849G   2% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
udev           devtmpfs  3.4G  4.0K  3.4G   1% /dev
tmpfs          tmpfs     684M  1.5M  683M   1% /run
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs     3.4G   96K  3.4G   1% /run/shm
none           tmpfs     100M   68K  100M   1% /run/user

You may notice that my disk partitioning is very simple (the swap partition is ~6gigs)

The actual disk is 1 tera byte.

tera byte disks are very cheap now-a-days.

Your whole disk seems to be ~33gig. That was great back in the days of MS-DOS and early versions of linux.

However, my ubuntu 14.04 linux is only using ~26gigs of the disk

(and I have numerous utilities, add ons, pictures, videos, source code for several projects, etc etc.)

suggest making the initial install (until you know more about how everything will work) with only the

当我使用多个分区时,我的组织方式和 @alk 的建议类似,只是增加了一个 Windows、lib 和 for 等分区。

这样的分区可以让我的服务器上的访问速度更快,有多个硬盘,故障模式也更安全,但对于我的桌面来说,几乎不值得。

我的台式机有一个多分区的外置太字节硬盘用于备份。

© www.soinside.com 2019 - 2024. All rights reserved.