need to clean up root partition
Am running opensuse 11.3. In the past few months the root partition has gone from 40% full to 97% full. It's 27G, which seemed like a lot at the time. Is there a tool to clear out the garbage? If not, can someone tell me how to do it by hand? Please keep it simple but detailed.
|
@ Reply
Hi mlmack,
I would suggest you to first find out the files that are using up the space on / . We cannot just delete the files which are needed by the system. Run the following commands which will help you to find out the files that are using up the space: 1. Code:
cd / Code:
du -ah | sort -nr > /root/list |
Thanks for answering so quickly. I went to su and ran the command. The response was
du: cannot access `./.gvfs': Permission denied If permission is denied to root, what next. BTW, I understand that I can't just hack at it. That's why I asked for help. |
@ Reply
Run su - root instead of su as su command does not import the root user PATH.
|
Quote:
Most common reasons for root filing up: logfiles in /var/log and old kernels. Kind regards |
not sure in opensuse but in arch and a few others package files downloaded are saved in /var/cache those you can usually delete once installed. Not sure if that's mounted seperately or not for you or if they're stored at all in your distrobution. Hope that helps
|
at this point i would not bother cleaning out /
OpenSUSE 11.3 will hit it's "End Of Life" in 3 days on Jan 16 it dies please stay current and install 12.1 11.4 hits End of life on "September 15th 2012 see http://en.opensuse.org/Lifetime I am betting that /var/log is huge and you have not set up cron to clean it out . Also have a look at /tmp ,and set up cron to clean that out . |
To respond to all at once:
Running 'su root' makes no difference.I get: "du: cannot access `./.gvfs': Permission denied" either way. cleaning out /var and /tmp helped a lot but not enough. How do I clean out old kernels? I'd rather not upgrade because I'm old (61) and set in my ways. I like what I have and don't want to go through a bunch of contortions to get it back. If possible at all. |
it is not " su root"
it is " su -" a dash there is a very big difference in " su " and " su - " be warned there will NEVER be a update to firefox in 11.3 after the 16'th there will NEVER be any security fixes there will NEVER be any new programs and NO updates to the ones installed 11.3 will be dead |
open source GUI tool - Bleach Bit can be used to free up disk space -
http://bleachbit.sourceforge.net/ They have Linux platforms w/ DL for Open Suse Easy to use- If you used a package manager to install kernels, they can be removed likewise. |
Once I got su straight, "du -ah | sort -nr > /root/list" returned to the prompt with no output.
Bitbleach may be useful but made no difference in this case. If old kernels can be removed with yast, I can't figure out how. |
Quote:
Code:
/root/list Code:
If old kernels can be removed with yast, I can't figure out how. Kind regards |
The kernel link looks like it'll do it. My thanks to you all.
|
Hi!
Please log-in using your User Name / ID as you would usually and then change your log-in to that of root: Code:
[demo@localhost bin]$ su - root A simple note on the hyphen: Using a hyphen (-) before the user name when you use "su" command to take on the privileges of some other user, you effectively use a "Log-in Shell". Without the hyphen, the Log-in environment would be called "No Log-in Shell". cd to any directory such /tmp: Code:
cd /tmp Code:
[root@localhost tmp]# du -ah . | sort -nr | grep -v ^0 | head Examples: Code:
[root@localhost ~]# du -ah /var/log | sort -nr | grep -v ^0 | tail -n 5 Code:
[root@localhost ~]# du -a /var/log | sort -nr | grep -v ^0 | tail -n 5 "sort -nr" = We give the output of "du" to "sort" by piping "|". "sort -nr" sort the fist column that is the size field and gives a Descending List of the Size. So, the big sized files/directories appear at the top and the lowest ones at the bottom. "grep -v ^0" = We are removing those entries that have "zero" sized files. "head" = Top 10 lines are displayed. You can replace "head" with "more" to navigate the entire output. Or you can write the output to a file with the help of redirection operator ">" and then giving it a file name: Code:
[root@localhost tmp]# du -a . | sort -nr | grep -v ^0 > files_list You can then decide which files/directories you may want to delete. "du -a ." = . (dot) means the current directory. You can replace the dot with any other directory's path: Code:
du -a "/var/log" Code:
[root@localhost tmp]# du -a /var/log | sort -nr | grep -v ^0 | head Code:
[root@localhost tmp]# find /boot/ -type f -size +1M | xargs ls -lh "xargs ls -lh" = We are long-listing each line processed by the find command. We can replace this command with "rm" to remove the file instead. Or "rm -rf" to remove forcefully and "r" for recursively if it is a directory. But we have already specified "-type f" to mean that only file names will appear. So, "rm -f" would be enough. Example: Code:
[root@localhost tmp]# find /boot/ -type f -size +1M | xargs echo "rm" Code:
find /boot/ -type f -size +1M | xargs rm -f That is why I have used "echo" to see what is going to happen. It is good to save the output in a file: Code:
[root@localhost tmp]# find /boot/ -type f -size +1M | xargs echo "rm" > output Code:
/bin/bash output See it in action: Code:
[root@localhost tmp]# find /tmp/ -type f -size +1M | xargs echo "rm" One more example for you: Code:
[root@localhost tmp]# find /tmp/ -type f -size +1k | xargs echo "rm" > output How can we delete them all in one go? Yes, executing the "output" file that contains the command "rm": Code:
[root@localhost tmp]# /bin/bash output Notice "k" is small in the find command. "M" and "G" will be in capital letters. Please Note: Do not use "/" after "find" because it will search the entire file system / Hard Disk that is visible to Linux/Unix on your system. Just try these areas/partitions/directories: Code:
find /tmp -type f -size +1k | xargs ls -lh Since, you are 61. I thought it would be nice to explain every piece of the commands I have given here. Please, excuse me if you were already familiar with them. :) Do let me/us know if you need more help. You would not need to check "/boot" partition if never installed any other kernel. That is, you have had only one Linux Kernel that was there at the time of a fresh installation of your Linux Distro. Just list the output of this command here so that we can tell you if you need to delete any file in "/boot" directory: Command: Code:
ls -ltrh /boot Code:
total 18M So, do post what your "/boot" directory holds so that we can help you better. Remember, any messing up with /boot may result in a unusable system. You may not even be able to log-in to or even boot your system. Cheers! |
I wish they would make CrapCleaner for Linux however, bleachbit is not too shabby it worked well on my Centos 5.7.
|
All times are GMT -5. The time now is 07:47 AM. |