Link to home
Start Free TrialLog in
Avatar of mfg1
mfg1Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Problems clearing space on / of linux partitions

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
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

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
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.


Avatar of mfg1

ASKER

ok I know this is a silly question but what sort of stuff should I be able to remove safely? temp files etc.
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mfg1

ASKER

Yes i checked there and it turns out only 1 file was present which is tiny, any more :-)
/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.

Oops, I just noticed you have /var on a different partition. Ignore that advice.

Avatar of mfg1

ASKER

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
Avatar of mfg1

ASKER

Ok sorry i thought i had it wrong there.
/var is not on the same volume as / !
Avatar of mfg1

ASKER

Yes that is correct, so not sure what else I can remove.
Try

du -kx / | sort -n

to see your biggest files/directories (at the bottom of the list)
Avatar of mfg1

ASKER

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
lsof /tmp

?
Avatar of mfg1

ASKER

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
Also try

  ls -al /tmp

to see any hidden files or directories

Avatar of mfg1

ASKER

this is what I get if I tab twice after cd in the tmp directory

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

Avatar of mfg1

ASKER

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
What do you see after this:

cd /tmp
du .

Ok,

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

What's in there?
Avatar of mfg1

ASKER

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 ..
Avatar of mfg1

ASKER

thx for all these quick replies most appreciated.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mfg1

ASKER

Ok should I move it to home for example?
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!
Avatar of mfg1

ASKER

ok I moved the file but when I check df it is still showing 0 available :-(
That's because /home is on the same device as / !

Avatar of mfg1

ASKER

sorry what an idiot bear with me
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.
Avatar of mfg1

ASKER

Can I just say thank you to both of you guys for saving my life, really helped system now all working ok.
Avatar of mfg1

ASKER

t-max I would if I knew how, maybe that is something I should ask another day.