Page 1 of 1
HDD is running to the max
Posted: Sunday 26 June 2016 22:05
by Derik
Please is there someone that can help me to clean my HDD from my Cubieboard 2..

- ScreenShot056.jpg (41.54 KiB) Viewed 3017 times
I see my drive is running to the max..
I try the clean option, that is give some space, only not for long.
My image is:
http://www.armbian.com/cubieboard-2/

- ScreenShot059.jpg (33.43 KiB) Viewed 3011 times

- ScreenShot058.jpg (34.25 KiB) Viewed 3017 times
Are there some maps that are using a lot of space that i can remove without having problem,,
Or a better solution..
Re: HDD is running to the max
Posted: Sunday 26 June 2016 22:15
by Egregius
ssh to it
cd /
du -h -d 1
"du -h -d 1" will show you the actual size of the folders.
Go in to the biggest folders and rerun the command until you find out what's eating your drive.
Re: HDD is running to the max
Posted: Sunday 26 June 2016 22:20
by Derik
mmm you think i am smart .....
Only this screendumps are almost my max ,,
Code: Select all
linaro@cubie:/$ sudo du -h -d 1
5.1M ./boot
4.0G ./var
4.0K ./media
13M ./tmp
16K ./lost+found
4.0K ./opt
42M ./home
192K ./run
4.0M ./etc
0 ./dev
5.1M ./bin
4.0K ./mnt
5.5M ./sbin
du: cannot access './proc/12638/task/12638/fd/4': No such file or directory
du: cannot access './proc/12638/task/12638/fdinfo/4': No such file or directory
du: cannot access './proc/12638/fd/4': No such file or directory
du: cannot access './proc/12638/fdinfo/4': No such file or directory
0 ./proc
4.0K ./srv
679M ./usr
32K ./root
396M ./lib
0 ./sys
5.2G .
linaro@cubie:/$
Re: HDD is running to the max
Posted: Sunday 26 June 2016 22:54
by marcelr
4.0G ./var
Why is /var so large? Maybe it's time to clean up some garbage there.
grtz,
marcelr
Re: HDD is running to the max
Posted: Monday 27 June 2016 8:10
by SweetPants
/var contains all logging. Check there what is using your disk
Verstuurd vanaf mijn HTC Desire 610 met Tapatalk
Re: HDD is running to the max
Posted: Monday 27 June 2016 9:22
by Egregius
well,
cd /var
sudo du -h -d 1
/var contains so much more than logging.
Recently I had same issue on one of my RPI's wich had a 2GB card. Appeared that all old kernels where still on the card...
Re: HDD is running to the max
Posted: Monday 27 June 2016 10:24
by gizmocuz
also the tool 'ncdu' is helpfull, it is a graphical 'du' application
Re: HDD is running to the max
Posted: Monday 27 June 2016 18:45
by Derik
Can i just simple delete the whole map ./var

- ScreenShot061.jpg (69.29 KiB) Viewed 2891 times
Re: HDD is running to the max
Posted: Monday 27 June 2016 18:47
by jvdz
Derik wrote:Can i just simple delete the whole map ./var
Not when you still want to use the system afterwards.

So have you checked the subdirectories for large files. I would first check /log, /backups and /tmp
Jos
Re: HDD is running to the max
Posted: Monday 27 June 2016 19:24
by Derik
Just the first big ones?

- ScreenShot062.jpg (126.31 KiB) Viewed 2882 times
And here to?

- ScreenShot063.jpg (150.78 KiB) Viewed 2882 times
Can i remove the older versions???
The only backup i wil give a lot of money is my Domoticz DB...
When my OS stock, i set a new os on my sd...
Re: HDD is running to the max
Posted: Monday 27 June 2016 19:29
by jvdz
Seems you aren't running the logrotate utility that normally would clean and compress logfiles to ensure they don't grow to that size.
EDIT: Looks like it was working till 25 January last year as there are compressed versions of auth.log
Jos
Re: HDD is running to the max
Posted: Monday 27 June 2016 19:35
by Derik
jvdz wrote:Seems you aren't running the logrotate utility that normally would clean and compress logfiles to ensure they don't grow to that size.
Jos
Ok
I did change nothing. [ i think ]
Just flash the sd and run domoticz on it...[ runs 2-3 years ]
Can i remove this log files..? [ in all the years i did not use this stuff ]
And the DPKG.Status old versions?
And the alternative and apt.extend. xx old versions?
Re: HDD is running to the max
Posted: Monday 27 June 2016 19:53
by jvdz
Why worry about the few Kb's of the DPKG? The issue seems to be the log files not being cleared.
You can find quite some hits on Google on this question around deleting auth.log, but think you really should fix the logrotate so the system won't fill up again over time.
Jos
Re: HDD is running to the max
Posted: Monday 27 June 2016 20:13
by Derik
Hero's....

- ScreenShot064.jpg (17.95 KiB) Viewed 2863 times
And proud @ myself...
Re: HDD is running to the max
Posted: Monday 27 June 2016 20:15
by Egregius
I would run these commands:
sudo truncate -s 0 *.log -> empty all logfiles without deleting them and thus preserving ownership and permissions.
sudo rm *.gz -> remove all old compressed logfiles. This can also be done in /var/backups
Don't know what those btmp files are occupying 200MB, should google that to see if it's safe to remove/empty them.
Also, try to find out why logrotate doesn't run anymore, then that handles it automatically for you.
In the config files of logrotate you can specify how many .gz files are kept.
Re: HDD is running to the max
Posted: Monday 27 June 2016 20:21
by Derik
Code: Select all
linaro@cubie:~$ cd /var/log
linaro@cubie:/var/log$ sudo truncate -s0 auth.log
linaro@cubie:/var/log$ sudo truncate -s0 syslog
linaro@cubie:/var/log$ sudo truncate -s0 daemon.log
linaro@cubie:/var/log$ sudo truncate -s0 kern.log
And a few others:
Code: Select all
linaro@cubie:/var/log$ sudo truncate -s0 btmp.1
linaro@cubie:/var/log$ sudo truncate -s0 btmp
linaro@cubie:/var/log$ sudo truncate -s0 message
linaro@cubie:/var/log$ sudo truncate -s0 messages
linaro@cubie:/var/log$ sudo truncate -s0 auth.log.1
linaro@cubie:/var/log$ sudo truncate -s0 debug
linaro@cubie:/var/log$ sudo truncate -s0 messages.1
linaro@cubie:/var/log$ sudo truncate -s0 kern.log.1
linaro@cubie:/var/log$ sudo truncate -s0 syslog.1
linaro@cubie:/var/log$ sudo truncate -s0 lastlog
linaro@cubie:/var/log$ sudo truncate -s0 dpkg.log.1
linaro@cubie:/var/log$ sudo truncate -s0 auth.log
And look:

- ScreenShot065.jpg (8.83 KiB) Viewed 2855 times
And:

- ScreenShot066.jpg (12.62 KiB) Viewed 2855 times
And:

- ScreenShot067.jpg (70.53 KiB) Viewed 2853 times
This give my CB more space then ever...
THANKS ALL!!
xxx
Re: HDD is running to the max
Posted: Monday 27 June 2016 21:04
by marcelr
Drops as steeply as the exchange rate of the British Pound
grtz,
marcelr
Re: HDD is running to the max
Posted: Monday 27 June 2016 21:06
by Derik
Re: HDD is running to the max
Posted: Tuesday 28 June 2016 6:14
by Egregius
gizmocuz wrote:also the tool 'ncdu' is helpfull, it is a graphical 'du' application
Seems a nice tool, thanks.
But not available on OS X and Synology so I searched some more and came up with these commands:
find biggest folders
Code: Select all
perl -e'%h=map{/.\s/;99**(ord$&&7)-$`,$_}`sudo du -h -d 1`;die@h{sort%h}'
find biggest folders and subfolders
Code: Select all
perl -e'%h=map{/.\s/;99**(ord$&&7)-$`,$_}`sudo du -h`;die@h{sort%h}'
Almost the same can be done with piping the du command to sort. This command will display all sizes in MB so not good for small files:
1 level:
With subfolders: