Linux no space left on device but there is

ubuntu «No space left on device» but there is tons of space [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

I am getting the «No space left on device» error for pretty much anything i try to do. Even using tab to autocomplete a command! but when i do df -h i get:

ubuntu@ip-10-0-2-108:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 99G 6.5G 88G 7% / udev 3.7G 8.0K 3.7G 1% /dev tmpfs 1.5G 184K 1.5G 1% /run none 5.0M 0 5.0M 0% /run/lock none 3.7G 0 3.7G 0% /run/shm none 100M 0 100M 0% /run/user /dev/xvdb 414G 199M 393G 1% /mnt overflow 1.0M 1.0M 0 100% /tmp 
ubuntu@ip-10-0-2-108:~$ df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/xvda1 6553600 94227 6459373 2% / udev 951353 393 950960 1% /dev tmpfs 953649 274 953375 1% /run none 953649 3 953646 1% /run/lock none 953649 1 953648 1% /run/shm none 953649 1 953648 1% /run/user /dev/xvdb 27525120 11 27525109 1% /mnt overflow 953649 12 953637 1% /tmp 
ubuntu@ip-10-0-2-108:~$ sudo crontab -e /tmp/crontab.RvYjrR/crontab: No space left on device ubuntu@ip-10-0-2-108:~$ ls /va (hit tab for autocomplete) -bash: cannot create temp file for here-document: No space left on device -bash: cannot create temp file for here-document: No space left on device 

however the server seems to be running and everything seems to be working. what on earth is going on??

Источник

Ошибка no space left on device в Linux

Ошибка no space left on device в Linux может возникать при использовании различных программ или сервисов. В графических программах данная ошибка может выводится во всплывающем сообщении, а для сервисов она обычно появляется в логах. Во всех случаях она означает одно. На разделе диска, куда программа собирается писать свои данные закончилось свободное место.

Избежать такой проблемы можно ещё на этапе планирования установки системы. Выделяйте под каталог /home отдельный раздел диска, тогда если вы займете всю память своими файлами, это не помешает работе системы. Также выделяйте больше 20 гигабайт под корневой раздел чтобы всем программам точно хватило места. Но что делать если такая проблема уже случилась? Давайте рассмотрим как освободить место на диске с Linux.

Читайте также:  Нет звука через hdmi линукс

Как исправить no space left on device

Первым дело надо понять на каком разделе у вас закончилась память. Для этого можно воспользоваться утилитой df. Она поставляется вместе с системой, поэтому никаких проблем с её запуском быть не должно:

На точки монтирования, начинающиеся со слова snap внимания можно не обращать. Команда отображает общее количество места на диске, занятое и доступное место, а также процент занятого места. В данном случае 100% занято для корневого раздела — /dev/sda5. Конечно, надо разобраться какая программа или файл заняла всё место и устранить эту проблему, но сначала надо вернуть систему в рабочее состояние. Для этого надо освободить немного места. Рассмотрим что можно сделать чтобы экстренно освободить немного памяти.

1. Отключить зарезервированное место для root

Обычно, у всех файловых систем семейства Ext, которые принято использовать чаще всего как для корневого, так и для домашнего раздела используется резервирование 5% памяти для пользователя root на случай если на диске закончится место. Вы можете эту память освободить и использовать. Для этого выполните:

Здесь опция -m указывает процент зарезервированного места, а /dev/sda5 — это ваш диск, который надо настроить. После этого места должно стать больше.

2. Очистить кэш пакетного менеджера

Обычно, пакетный менеджер, будь то apt или yum хранит кэш пакетов, репозиториев и другие временные файлы на диске. Они некоторые из них ненужны, а некоторые нужны, но их можно скачать при необходимости. Если вам срочно надо дисковое пространство этот кэш можно почистить. Для очистки кэша apt выполните:

sudo apt clean
sudo apt autoclean

Для очистки кэша yum используйте команды:

3. Очистить кэш файловой системы

Вы могли удалить некоторые большие файлы, но память после этого так и не освободилась. Эта проблема актуальна для серверов, которые работают долгое время без перезагрузки. Чтобы полностью освободить память надо перезагрузить сервер. Просто перезагрузите его и места на диске станет больше.

4. Найти большие файлы

После выполнения всех перечисленных выше рекомендаций, у вас уже должно быть достаточно свободного места для установки специальных утилит очистки системы. Для начала вы можете попытаться найти самые большие файлы и если они не нужны — удалить их. Возможно какая-либо программа создала огромный лог файл, который занял всю память. Чтобы узнать что занимает место на диске Linux можно использовать утилиту ncdu:

Она сканирует все файлы и отображает их по размеру:

Более подробно про поиск больших файлов читайте в отдельной статье.

Читайте также:  Enable ipv4 forward linux

5. Найти дубликаты файлов

С помощью утилиты BleachBit вы можете найти и удалить дубликаты файлов. Это тоже поможет сэкономить пространство на диске.

6. Удалите старые ядра

Ядро Linux довольно часто обновляется старые ядра остаются в каталоге /boot и занимают место. Если вы выделили под этот каталог отдельный раздел, то скоро это может стать проблемой и вы получите ошибку при обновлении, поскольку программа просто не сможет записать в этот каталог новое ядро. Решение простое — удалить старые версии ядер, которые больше не нужны.

Выводы

Теперь вы знаете почему возникает ошибка No space left on device, как её предотвратить и как исправить если с вами это уже произошло. Освободить место на диске с Linux не так уж сложно, но надо понять в чём была причина того, что всё место занято и исправить её, ведь на следующий раз не все эти методы смогут помочь.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

How to Fix the “No Space Left on Device” Error on Linux

No Space On Device Feature

Most of the time, Linux is pretty specific with its error messages. “This didn’t work – try installing this package.” However, there’s one in particular that really doesn’t help me very much: “No space left on device.” What causes that? I thought I had 2 TB of storage, how can it be full? Where do I start looking? Today, we’ll be walking you through all of that in our guide on how to fix the “No space left on device” error on Linux.

Check the Space Left on Device

Before you go any further, it’s a good idea to check that there really is space left on the disk. While the tools in your desktop environment are good, it can be faster to use the direct ones from the command line.

If you’d like to use the tools in your desktop environment, they’ll give you easy-to-read representations of the information you can find with these tools. I’m using Fedora with GNOME, and the GNOME Disk Usage Analyzer tool shows me the following.

No Space On Device Disk Analyzer

Begin with du . Point it to the base directory on the drive that’s having the problem. Let’s assume it’s the partition with / .

No Space On Device Du

It’ll take some time to go through everything. Now, try with df .

No Space On Device Df

Add / and the filesystems mounted under it. For example, if you have /home on a separate drive, add that in with the reading for / . The total should come out close to what you had with du . If not, that might point toward a deleted file being used by a process.

Of course, the main concern here is whether or not the results of these commands come in under the size of the drive. If it did, there’s obviously something wrong.

Читайте также:  Linux chown всем пользователям

No Space on Device Possible Causes

There are a couple of main causes here. If you saw a discrepancy between du and df , you can jump down to the first option here. Otherwise, start at the second one.

Deleted File Reserved by Process

Occasionally, a file will be deleted, but a process is still using it. Linux won’t release the storage associated with the file while the process is still running, but you can find the process and restart it.

No Space On Device Lsof Deleted

Try to locate the process.

The problematic process should be listed. Just restart it.

sudo systemctl restart service_name

If it’s not immediately evident, do a full daemon reload.

sudo systemctl daemon-reload

Not Enough Inodes

There is a set of metadata on filesystems called “inodes.” Inodes track information about files. A lot of filesystems have a fixed amount of inodes, so it’s very possible to fill the max allocation of inodes without filling the filesystem itself. You can use df to check.

No Space On Device Inodes

Compare the inodes used with the total inodes. If there’s no more available, unfortunately, you can’t get more. Delete some useless or out-of-date files to clear up inodes.

Bad Blocks

The last common problem is bad filesystem blocks. Filesystems can become corrupt over time, and hard drives die. Your operating system will most likely see those blocks as usable unless they’re otherwise marked. The best way to find and mark those blocks is by using fsck with the -cc flag. Remember that you can’t use fsck from the same filesystem that you’re testing, so you’ll probably need to use a live CD.

Obviously, replace the drive location with the drive that you want to check. You can find that by using the df command from earlier. Also, keep in mind that this will probably take a long time, so be prepared to grab a coffee.

Hopefully, one of these solutions solved your problem. This issue isn’t exactly easy to diagnose in every instance. With any luck, though, you can get it cleared up and have your system working again normally.

If you’re looking for more Linux pointers, see our guide on how to set up Bluetooth in Linux. Or, for something a little different, see how to install Mac’s Safari browser in Linux. Enjoy!

John is a young technical professional with a passion for educating users on the best ways to use their technology. He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration.

Our latest tutorials delivered straight to your inbox

Источник

Оцените статью
Adblock
detector