LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   No space left on drive (https://www.linuxquestions.org/questions/linux-newbie-8/no-space-left-on-drive-4175612263/)

darose78 08-19-2017 02:15 PM

No space left on drive
 
I am inexperienced in Linux having previously dabbled, but abandoned my efforts because of frustration. I now have more time and have resumed my acquaintance via Ubuntu 14.04 /16.04. (Kernel: 4.10.0xxxx)
I currently have two hard drives, 750 Gb (sda1) and 350 Gb sdb1 mounted as /mnt/backup.
Without prior warning, I suddenly was notified that I had 0 bytes space remaining on my hard drive. Despite deleting (NOT removing to 'Trash') three .iso images and several other files from my Downloads folder the figure remained at 0 bytes. I even rebooted only to find the same message, but no GUI.
Disconcertingly, I was subsequently not even permitted to delete files. A message reminded me that there was insufficient space to do so.
I will add that there were no previous versions of the kernel present.
I have two 1Tb drives itching to replace the above, but to further my education I would like to know:
1. How can I recover from this situation (not disaster.)?
2. Any advice on how best to manage my storage. Ideally, I would like to separate system from programs from data, but at the least manage data separately.
David Rose

pdixit 08-19-2017 03:19 PM

Hi Devid,

You can monitor it better that which data is increasing and how can you manage it. As you mentioned that you have two drive sda and sdb. are you using LVM? because then it will be easy to manage the space and no need to delete the old data from drive. can you post your disk configuration here?

you can set drive alert to get the mails when your disk space will almost full. for example you wants alert when your drive becomes 90% full. you can create an script and set it to the cron job. For example, check the link below:

http://www.linuxjournal.com/content/...space-gets-low

Ztcoracat 08-19-2017 03:36 PM

The first thing I'd do is boot to a Live Ubuntu CD or DVD and copy your files to a usb flash drive or an external drive if you have one.

To insure that your 750 GB drive and your 350 GB drive have not went south on you use S.M.A.R.T. to check the reliability of the drives.

https://en.wikipedia.org/wiki/S.M.A.R.T.

https://sourceforge.net/projects/smartmontools/

Run Memtest overnight to make sure the RAM isn't bad.
http://www.memtest.org/

You might want to check on the 'file system' as well. Make sure it hasn't been corrupted.
http://www.thegeekstuff.com/2012/08/...mand-examples/

As far as not having enough space left on the device message that your getting you can try adding more space to the partition. OR> boot to a Live CD/DVD and delete the unnecessary files that way.
You could also try clearing the pkg cache.

Code:

sudo apt-get clean
To remove files as root:
Code:

sudo rm /path/to/file
If suddenly you don't have a GUI it sounds like your DE crashed.
Run "starx" and see if it takes you to your DE. Should that fail you can always install another DE.


What is the output of:
Code:

cat /etc/os-release
Once you have a GUI you could use nautilus with root privileges to remove files.
Code:

gksudo nautilus
Be very careful running your system in this mode. Only delete or remove what's necessary.


Storage Management

There are many ways to manage storage.
Most members here back up their files and other data to an external drive or a server. A USB flash drive with enough gig's would be sufficient as well.

You could also create as many partitions as you like to manage files and data and use the Cloud:-

https://www.ubuntu.com/cloud/storage
https://ubuntuforums.org/showthread.php?t=1696116

Soadyheid 08-20-2017 07:05 AM

Quote:

I suddenly was notified that I had 0 bytes space remaining on my hard drive.
Which one? There are surely partitions on your drives? Run
Code:

$ df -h
to see what's causing the problem. Usually you find it's the root (/) partition which is full as it can hold a lot of the sub directories which the Distro might not allocate to separate partitions on install. Log files, and added applications can fill it up if it's small. How much space was allocated to the / partition?

If so, as mentioned you'd need to allocate a bigger / partition and without LVM it means backing up all your data then doing a clean install. (or it did in my day!) :)

You can then mount /home on a separate partition so your data will be safe if you ever have to re-install again (as long as you mark the partition as "don't format" during the partitioning section of the install)

My :twocents:

Play Bonny!

:hattip:

Michael Uplawski 08-20-2017 08:47 AM

Pardon me, if my suggestions are somewhat “frugal” and unsophisticated...

I am facing the problem with “No space left on drive” quite regularly, because I am updating my stretch/sid system quite often. Put the other way around: Updating my Linux-system fills the hard drive with files, and quite regularly, which may be a difference with your own situation.

A proposition: Install a simple program like Baobab (when it is possible again). The next time that you are informed that there is no more space left, see what happened in the /var directory. As you are using Ubuntu, see what happened in /var/cache/.

My solution is to start up aptitude, because I am still accustomed to this package management program, then under “Actions” (first menu) I execute “purge packet cache”.

The menu commands are translated from German and may have different designations in the English locales. For apt-get the corresponding command would be “clean”. “autoclean” may appear more useful, as it keeps useful packages available. But as they are probably already installed, anyway, the definition of “useful” can be discussed.

Sorry, if I missed the point.

jlinkels 08-20-2017 09:20 AM

Some additions.

In addition to df -h run this from a command line:
Code:

sudo du -h | egrep '[0-9\.]G|[0-9]{3}M'
It shows directories with space usage > 100M. You have to run as sudo to avoid that you don't have permissions to look into all directories.

Ubuntu is a nice distro for starters, but it makes a point of hiding information from users. Which is bad in case of problems and leads to the Windows system administrator policy: "for small problems reboot, for large problems, reinstall"

Therefor, even if it is discouraged, set a root password:
Code:

sudo su
passwd

Linux is built so root can always log in. Even is there is no disk space.

I am not sure which partition scheme you have used. Recommended is separate /var, /usr, /home and /. Sometimes also separate /boot. I am not sure about that anymore. When doing this, especially when using the recommended sizes, there is always a partition filling up which you don't want.

Nowadays I install everything in one single partiton. Maybe except /home if I am sure I have enough disk space and I want to have /home to survice reinstallations.

This is a recommendation for desktops and laptops. Not for servers in a production environment.

Anyway, run the "du" command as stated above and let's take it from there. Unless you are a movie collector, Ubuntu does not take up more space than 20G. Even if you do a lot of upgrades. I just checked my laptop. Total space: 73G. But 66G is for a W10 virtual machine image. :GRIN:

jlinkels

Michael Uplawski 08-20-2017 10:15 AM

Code:

sudo du -h / | egrep '[0-9\.]G|[0-9]{3}M'
The directory “/”(or file list) was missing. I did not know the uses of “du” and just looked it up in the man page.

jlinkels 08-20-2017 11:19 AM

Correct. You have to specify '/' or do 'cd /'

I did the latter and copy&paste command. Thank you.

jlinkels

AwesomeMachine 08-21-2017 04:15 AM

I'd try:
Code:

$ apt-get clean

JJJCR 08-21-2017 04:26 AM

try:

Quote:

du -h /var/logs


All times are GMT -5. The time now is 11:38 AM.