LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-12-2022, 08:22 AM   #1
John_Brass
Member
 
Registered: Apr 2015
Distribution: Scientific Linux, Linux Mint
Posts: 32

Rep: Reputation: Disabled
Who has eaten my disk space?


Yesterday I did not manage to login from the graphical surface. A small window popped up saying: "no space for X-server". I logged in recovery mode and the "df" command showed the system partition was full. I've deleted log files, but no success. Actually, "df" showed a considerable difference (several hundred Megabytes) between the number of available and used blocks, but still 0% free.

Thus, after searching Internet I found the command "sudo tune2fs -m0 /dev/sda6". This helped. After rebooting the PC was working as usual. However, I tested again with "df" and it showed 73% in use. This means the system reserve space was 27% before! But who has set up this unusual high value? Not me, because I saw the "tune2fs" command first time now. Is there any other program, which arbitrary changes the system reserve space? Or perhaps this was already set up when Linux was installed, several years ago? Why an installation reserves 27% of disk space (the system partition is 40GB)?

Another question: I also tried to start up the Linux box from a live Linux pendrive. This happened flawlessly, but after the login I had no access to the old Linux' system partition. It has not succeded to mount that, although all other harddisk partitions were correctly mounted and accessible. What could be the reason for this? Perhaps, because the partition directory ("/") is the same as the live Linux system directory? What to do in this case? This means one can not delete unused files from the system using a live Linux disk?

Thanks,

John Brass
 
Old 08-12-2022, 08:36 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,162

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
When you boot from a live image, you can mount the partition at a different place in your filesystem, such as under /mnt. Just be sure you are looking at the correct partition, since drive letters can change at each boot.
 
Old 08-12-2022, 09:04 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,813

Rep: Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958
You might have deleted log files that were still opened by the system which does not show as free until you reboot or stop /restart the process that uses the log file. You also might not see any free space % until you go below 95% used i.e. below reserved space of 5%.

Last edited by michaelk; 08-12-2022 at 02:49 PM.
 
Old 08-12-2022, 09:20 AM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by John_Brass View Post
Another question: I also tried to start up the Linux box from a live Linux pendrive. This happened flawlessly, but after the login I had no access to the old Linux' system partition. It has not succeded to mount that, although all other harddisk partitions were correctly mounted and accessible. What could be the reason for this? Perhaps, because the partition directory ("/") is the same as the live Linux system directory? What to do in this case? This means one can not delete unused files from the system using a live Linux disk?

Thanks,

John Brass
What command are you using to mount the problematic root filesystem? It's been too long since I've booted off a USB drive or CD as a rescue device so I'm unsure why the hard disk root filesystem didn't get mounted but I strongly suspect that it's because you already had a root filesystem (on the USB drive) mounted and the system basically responded "Uh... no."

I would likely try something like:
Code:
# mount /dev/sd<disk><part#> /mnt
You need to determine "<disk><part#> using "lsblk -f" since the drive letters will be different when you've booted from the USB drive. Then you can "cd" to "/mnt" and perform whatever cleanup you need to do. What's filling up the disk? Hard to say without knowing what activity is taking place on the system.

You may have already been doing this but using "du" is where I'd begin:
Code:
# cd /mnt
# du -sk * | sort -n
The directory trees with the most disk use will be at the bottom of the list. "cd" into the ones using the most space and keep issuing "du -sk *" commands. Eventually you should find a directory using a lot of space and it'll jog your memory about some activity that is running, a cron job that's generating a ton of output, some process that's supposed to be cleaning up after itself but actually isn't, whatever.

Slight aside: another handy thing Linux allows is to add a label to filesystems. That makes using many tools like "lsblk" and even "mount" a bit easier to use. Example to label "/" as "rootfs", simply:
Code:
# tune2fs -L rootfs /dev/sd<disk><part>  (<disk> and <part> are specific to your system)
Future "lsblk -f" commands will show that "rootfs" label in the LABEL column. You can also use the labels in your /etc/fstab entries. See the appropriate manpages for the details.

HTH...
 
Old 08-12-2022, 02:43 PM   #5
John_Brass
Member
 
Registered: Apr 2015
Distribution: Scientific Linux, Linux Mint
Posts: 32

Original Poster
Rep: Reputation: Disabled
Thanks for the answers. Actually I did not try to mount the partitions as the live Linux performed an automount - just not the system partition. I simply did not try with the /dev name.

Well, now I'm happy with the working Linux box, I do not try it until the next failure. :-))

Last edited by John_Brass; 08-12-2022 at 02:45 PM.
 
Old 08-13-2022, 09:27 AM   #6
suramya
Member
 
Registered: Jan 2022
Location: Earth
Distribution: Debian
Posts: 249

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by John_Brass View Post
Thus, after searching Internet I found the command "sudo tune2fs -m0 /dev/sda6". This helped. After rebooting the PC was working as usual. However, I tested again with "df" and it showed 73% in use. This means the system reserve space was 27% before! But who has set up this unusual high value? Not me, because I saw the "tune2fs" command first time now. Is there any other program, which arbitrary changes the system reserve space? Or perhaps this was already set up when Linux was installed, several years ago? Why an installation reserves 27% of disk space (the system partition is 40GB)?
By default Ext3/ext4 reserve 5% of the total space for root user. This allows the system/root process to continue working even after you get to 0% free space as a user. If you set this value to 0 (for your root partition) then when you run out of space again the entire system will crash when processes can't write to the disk. It is recommended that you leave a little bit of space as reserved to avoid this scenario. If 5% is too high then you can reduce it to a lower percentage.

I don't see the downside of removing the reserved space for disks/partitions other than the root partition and have been doing that on all my systems for a few years now without issues.

Also, ncdu is extremely useful in finding files that are using up your storage space.
 
Old 08-13-2022, 11:14 AM   #7
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,643

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561

Seems odd to have a relative percentage rather than an absolute value, and 5% seems like it comes from before GB/TB disks - even 1% of a modern disk would be excessive for the purpose of allowing root user to recover a system.

However, a quick search suggests that, if performance matters, it may be worth increasing that percentage of reserved space to prevent performance degradation that can occur as disks fill up.

 
Old 08-14-2022, 12:35 PM   #8
suramya
Member
 
Registered: Jan 2022
Location: Earth
Distribution: Debian
Posts: 249

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by boughtonp View Post
Seems odd to have a relative percentage rather than an absolute value, and 5% seems like it comes from before GB/TB disks - even 1% of a modern disk would be excessive for the purpose of allowing root user to recover a system.

However, a quick search suggests that, if performance matters, it may be worth increasing that percentage of reserved space to prevent performance degradation that can occur as disks fill up.

Yeah, this is from before the days of multi-gigabyte/terabyte disks. Which is why I always suggest (amongst other reasons) that you should have the root partition on a separate partition (15-30GB depending on how much software you anticipate installing) and keep the data partition separate. That way you can remove the reserved blocks on the data partition and leave them on the root partition.

This percentage thing is quite annoying in all things. At work we had a server with a multi-terabyte disk and the system was set to alert when the free space dropped below 30%. (Standard monitoring rule) so the alert would be raised even when we had more than 300 GB free... Ended up changing the rule to alert after the available space was less than a fixed size.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Please dont laugh, but libreoffice writer 3 has eaten my work, deadline tomorrow HELP technoretard Linux - Newbie 4 10-01-2012 02:35 AM
Hard disk space getting eaten up adrianlarsson Linux - Newbie 2 12-18-2006 06:22 PM
swap being eaten? minm Linux - Newbie 10 10-24-2004 10:29 PM
Ram being eaten by linux? minm Linux - Newbie 21 09-08-2004 08:52 PM
Red Hat 7.2 Memory Eaten Up ayhopkins Linux - Newbie 19 04-24-2002 04:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration