LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-28-2019, 12:05 PM   #1
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Rep: Reputation: 8
"/" filesystem 100% filled


I have a problem with my QNAP (Intel 64bit, 8GB RAM). System software is some bizarre mutation of Ubuntu. For example, filesystem "/" has a capacity of only 290 MB and its normal occupation is 90%. I received such information from QNAP help-desk. The rest of the filesystems (like /var/log, /root, /lib etc. etc) are mounted to "/". Except - surprisingly - /etc. I wrote some of my own scripts and something fills my filesystem "/" to 100%. Does any of colleagues have an idea for some script in the shell (QNAP has no bash, only sh), which, say, every 5 minutes from cron, examines which file on the filesystem has increased its size by, say, 100 Kb (compared to the previous test)? If I detected which file is growing, I would move it elsewhere, e.g. via a symbolic link. Do you have any idea from your colleagues?
Please consider that the total capacity of this filesystem is - as I wrote - only 290 MB. So not much. Hence, such testing of a single file system will not burden the NAS too much.
 
Old 09-28-2019, 12:36 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
You could use find with -mmin

Find files modified in the last 5 minutes.
Code:
find . -mmin -5 -type f -exec ls -l {} +

find . -mmin -5 -type f | xargs ls -l
You could monitor a file every minute with
Code:
while true; do
    wc -c <filename> | cut -d " " -f1
    sleep 60
done
Save the output as a variable and compare that to next time.
Code:
a=5
b=7
echo $(($b - $a))
Or for sh
Code:
let c="$b-$a"
echo "$c"
Should be able to do that with a few simple small tools.
 
Old 09-28-2019, 12:46 PM   #3
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
But look at statement:

Code:
find . -mmin -5 -type f -exec ls -l {} +
Dot mean "find recursively from current dir". In my case "the dot" is "/". That means "find" will search thru whole 5 TB disk instead "/" filesystem, 290 MB size only.
 
Old 09-28-2019, 12:55 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
find has an option to stay on a single filesystem: -mount
I would probably try:
cd <any dir>; du -sh * | sort -h
but you need to take care about * (or you need to specify the list of dirs).
I think du will work [much] faster.
 
Old 09-28-2019, 01:21 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Suggestions are helpful. I'd also try
Code:
du -hd1 /
which will only report the sizes of each directory below /
from man du
Quote:
-d, --max-depth=N
print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is the same as --summarize
Yes, that will report sizes of things not mounted under /, like /home, but it's only going to be one line. You appear to know what's under /, yes?

That said, the first place I'd look would be in /var/log. -- especially if logrotate is not set up/running.

Last edited by scasey; 09-28-2019 at 01:24 PM.
 
Old 09-29-2019, 05:02 AM   #6
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,793

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
find big recent files on the / filesystem:
Code:
find / -xdev  -size +1000 -mtime -1
List deleted files that are still hold open by a running process;
Code:
lsof | grep '(deleted)'
 
Old 09-29-2019, 08:39 AM   #7
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
Finally I discovered the cause of the "/" file system overflow. When I create a QNAP offline backup (4 times a day) on another NAS (made from Raspberry Pi, but with a GB port), I sync dnsmasq files at the same time, the source of which is Raspberry Pi. Everything is done via SSH and RSYNC via SSH. Then restart dnsmasq on QNAP, also using the SSH command. This operation causes the /var/log/network/dnsmasqd.log file to grow very fast because QNAP reports some bizarre errors. I used a workaround to reset the contents of this file from cron because they are not needed for anything. Currently, file system occupation is stable at 94%. And this situation QNAP Helpdesk considers correct.

Nevertheless, I think that occupation of file system where logs are stored at level of 95% is wrong. Its crazy, 95% occupation on 290 MB filesystem size, dedicated to logs. Any instability of any application, native or not, leads to a system crash. This should never happen and it is a mistake from my point of view. I reported it to the QNAP Helpdesk and let them think now.

Last edited by mackowiakp; 09-29-2019 at 08:43 AM.
 
Old 09-30-2019, 01:43 AM   #8
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,793

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
That's why you better put log and spool on a separate file system (in zfs or btrfs simply add directory quota).
Generally I recommend an extra /var
 
Old 09-30-2019, 08:21 AM   #9
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
spool is less problem. But log - yes. Waiting for native solution from QNAP, I created symbolic link of /var/log to dir on filesystem with huge free space. As a workaround.
 
Old 09-30-2019, 08:39 AM   #10
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Your solution is a good one. Of course, if there is a problem with the disk or filesystem where you have put /var/log, then you will lose the logs. If that is a concern, then you might want to set up some remote logging to another system as well.
 
Old 10-01-2019, 12:57 AM   #11
mackowiakp
Member
 
Registered: Jun 2014
Location: Poland/Gdynia
Distribution: Mageia 9, SH4, Debian
Posts: 367

Original Poster
Rep: Reputation: 8
There is a lot of another strange configs in QNAP. For example size of shared memory is 3,8 GB but usage is less than 150 kB. That means that /dev/shm occupies half of installed memory so it is useless for any apps. I know, default RAM config takes in practically all Linux distros half of memory for tmpfs`s. Of course it could be easy changed in fstab. But QNAP Help-desk informed me that "We do not support units with changed filesys layout". Crazy. They know from me that half of memory is useless. So I adivce him to ask on LinuxQuestions forum if it is too difficult for him.
Whats regarding eventuality of disk failure - there is no problem. My NAS has 4 bays. Each bay is equipped with 5 TB HDD. Each pair of disks is configured as 2 times RAID-1. Disks are hot swapable. So if HDD failure accrues, it is easy to repair such situation without data lost.
 
Old 10-01-2019, 09:06 AM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by mackowiakp View Post
There is a lot of another strange configs in QNAP. For example size of shared memory is 3,8 GB but usage is less than 150 kB. That means that /dev/shm occupies half of installed memory so it is useless for any apps.
No, it doesn't. That 3,8GB is a maximum. At any given time, /dev/shm uses only the memory it needs. The same is true for other tmpfs filesystems. Right now I have tmpfs filesystems with allocations that total more than the size of my memory. The system runs fine. Actual tmpfs usage is less than 1% of memory.

Last edited by rknichols; 10-01-2019 at 09:07 AM.
 
  


Reply

Tags
filesystem, script, ubuntu



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
[SOLVED] C++: Why does "100 x 9/5" differ from "100 x (9/5)"? ceyx Programming 2 05-20-2013 09:08 PM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM
Harddisk filled-up after removing file chii-chan Linux - Newbie 1 11-12-2003 09:13 PM
Affero! Are you a member? Have you filled out your profile? DavidPhillips General 3 12-31-2002 05:30 PM
What if / is filled up? Manish Linux - Security 4 03-25-2002 01:03 PM

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

All times are GMT -5. The time now is 05:43 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