Solved

Problems clearing space on / of linux partitions

Posted on 2011-02-16
31
1,011 Views
Last Modified: 2013-11-22
I need to clear some space on my linux box but cannot work out why when I remove some files it is not reflected on the available space, please see df summary file attached.

I need to create some space in "/"

thank you in advance

DF-Partition-Size.txt
0
Comment
Question by:mfg1
  • 16
  • 8
  • 6
  • +1
31 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905362
Hi,

from which directory did you remove the files?

Please keep in mind that removing files from /var or /usr will have no effect on /, since these filesystems reside on different volumes.

The most common reason for space not getting freed is that the removed file's file handle is still in use by some process.

Try "lsof |grep deleted_file"

or even "lsof /"
You will most probably get a lot of output, but maybe there's a clue.

wmp
0
 
LVL 9

Expert Comment

by:AriMc
ID: 34905365
By default 5% of disk space is reserved for root's emergency use. If you add the used+available blocks in your /dev/sda1 for example, 21166 + 166931 = 188097, you'll see that they sum up to just 95% of the total size 198337.

In other words, your root partition is so full that it is already using the emergency reserve. You'll need to free more space until only about 2872572 blocks are used. After that you will see the available-value start growing.


0
 
LVL 4

Author Comment

by:mfg1
ID: 34905387
ok I know this is a silly question but what sort of stuff should I be able to remove safely? temp files etc.
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
ID: 34905397
Files in /tmp are always good candidates ...
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905402
Yes i checked there and it turns out only 1 file was present which is tiny, any more :-)
0
 
LVL 9

Expert Comment

by:AriMc
ID: 34905426
/var/log often contains saved and compressed (gz file extension) old log-files like syslog.2.gz. These should be safe to delete or move to another partition.

0
 
LVL 9

Expert Comment

by:AriMc
ID: 34905435
Oops, I just noticed you have /var on a different partition. Ignore that advice.

0
 
LVL 4

Author Comment

by:mfg1
ID: 34905436
This was the files i was deleting before, however will this make any difference as the /var is on another partition?

                                  15683016  10437996         4448348  71%       /var
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905439
Ok sorry i thought i had it wrong there.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905440
/var is not on the same volume as / !
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905445
Yes that is correct, so not sure what else I can remove.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905462
Try

du -kx / | sort -n

to see your biggest files/directories (at the bottom of the list)
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905473
ok not sure about this but it says that tmp does have some stuff in it, see below.

2741128 /tmp

but when I check by going to,

#cd /tmp
#ls
there is only 1 file there
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905489
lsof /tmp

?
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905501
here is the information I got back thx

# lsof /tmp
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
bash    5418 root  cwd    DIR  253,0     4096   18 /tmp
lsof    5677 root  cwd    DIR  253,0     4096   18 /tmp
lsof    5678 root  cwd    DIR  253,0     4096   18 /tmp
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 9

Expert Comment

by:AriMc
ID: 34905502
Also try

  ls -al /tmp

to see any hidden files or directories

0
 
LVL 4

Author Comment

by:mfg1
ID: 34905512
this is what I get if I tab twice after cd in the tmp directory

tmp]# cd
.bayes/    env2       .ICE-unix/

0
 
LVL 4

Author Comment

by:mfg1
ID: 34905518
Here is the responce
tmp]# ls -al /tmp
total 16
drwxrwxrwt.  4 root   root   4096 2011-02-16 10:36 .
drwxr-xr-x. 22 root   root   4096 2011-02-16 09:32 ..
drwxr-xr-x   2 root   root   4096 2011-02-08 18:33 .bayes
-rw-r--r--   1 apache apache    0 2011-02-15 14:33 env2
drwxrwxrwt   2 root   root   4096 2010-11-06 13:29 .ICE-unix
0
 
LVL 9

Expert Comment

by:AriMc
ID: 34905530
What do you see after this:

cd /tmp
du .

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905531
Ok,

.bayes and .ICE-unix are those hidden directories AriMc was talking about above!

What's in there?
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905557
I assume this is what you mean if not let me know and I will try again.

# ls -al /tmp/.bayes/
total 2741124
drwxr-xr-x  2 root root       4096 2011-02-08 18:33 .
drwxrwxrwt. 4 root root       4096 2011-02-16 10:36 ..
-rw-r--r--  1 root root 2806890496 2009-11-26 14:27 .ps_1753.mem


# ls -al /tmp/.ICE-unix/
total 8
drwxrwxrwt  2 root root 4096 2010-11-06 13:29 .
drwxrwxrwt. 4 root root 4096 2011-02-16 10:36 ..
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905561
thx for all these quick replies most appreciated.
0
 
LVL 9

Assisted Solution

by:AriMc
AriMc earned 250 total points
ID: 34905570
Ok, this one is using your disk:

/tmp/.bayes/.ps_1753.mem

It's also very old and probably safe to remove. Try moving it to another partition and keeping it there for a while for safekeeping.


0
 
LVL 4

Author Comment

by:mfg1
ID: 34905574
Ok should I move it to home for example?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905597
Could it be that yout machine is running for more than  14 months now?

If this could be the case check with

lsof /tmp/.bayes/.ps_1753.mem

whether the file is still in use (No output means it's not in use).

If it's not in use remove it, it's from an old Xsession!
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905625
ok I moved the file but when I check df it is still showing 0 available :-(
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34905636
That's because /home is on the same device as / !

0
 
LVL 4

Author Comment

by:mfg1
ID: 34905649
sorry what an idiot bear with me
0
 
LVL 6

Expert Comment

by:t-max
ID: 34905749
To avoid this in the future, you should think about having /tmp mounted at a different partition than /.
/tmp tends to get full from time to time, so having it mounted somewhere else allows the system to keep working (almost) normally.
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905768
Can I just say thank you to both of you guys for saving my life, really helped system now all working ok.
0
 
LVL 4

Author Comment

by:mfg1
ID: 34905796
t-max I would if I knew how, maybe that is something I should ask another day.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now