Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
08-21-2003, 09:14 AM
|
#1
|
Member
Registered: Nov 2002
Posts: 67
Rep:
|
hd6 (/) is 84% full
I want to remove some unneeded directories/folders to free up some space on hd6 (/). Is this the root directory and does everything below it affect how full it is (ex. /usr, /var, /etc)
What command can I find that will help also?
|
|
|
08-21-2003, 09:28 AM
|
#2
|
Member
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49
Rep:
|
What you want is the du command. Something like du -h /var will give you a good idea of how big /var is.
Also, I recall a script called durep which produces some nice html output. You may want to look for it on freshmeat.net.
|
|
|
08-21-2003, 09:38 AM
|
#3
|
Member
Registered: Nov 2002
Posts: 67
Original Poster
Rep:
|
thx, that's very helpful. It shows /var/logs with 130M.
are log files safe to empty and if so how would I empty it without deleting the file.
I'm not a Linux Pro as you can tell.
|
|
|
08-21-2003, 09:42 AM
|
#4
|
Member
Registered: Oct 2002
Location: Malaysia
Posts: 106
Rep:
|
Hi,
You might wish to go to /var/log and do another du -h or du -sH *.Most of the time the file with number ending in the end such as filename.1 and etc can be safely removed :
rm -f /var/log/*.1
rm -f /var/log/*.2
.....
after restart your apache with the command :
service httpd restart
Hope this help.
|
|
|
08-21-2003, 09:48 AM
|
#5
|
Member
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358
Rep:
|
130M of text? If you run "ls -d */|xargs du -sh" in /var/log what does it return?
As far as I know its ok to delete the *.gz compressed log files if you dont want them. I do that occaisionally.
|
|
|
08-21-2003, 09:59 AM
|
#6
|
Member
Registered: Nov 2002
Posts: 67
Original Poster
Rep:
|
thx, that definitely cleared some space. It looks like that affected hda 7 (/var), but hda6 (/) is still 84%.
Was just wondering, is it safe to delete old Kernels? Is that what is in /boot?
|
|
|
08-21-2003, 10:01 AM
|
#7
|
Member
Registered: Oct 2002
Location: Malaysia
Posts: 106
Rep:
|
Hi,
I would not suggest you to remove the old kernel.Just in case something bad happen to your new kernel, you will still be able to boot up using old kernel...
just my 2 cents
|
|
|
08-21-2003, 10:04 AM
|
#8
|
Member
Registered: Nov 2002
Posts: 67
Original Poster
Rep:
|
Quote:
Originally posted by m0rl0ck
130M of text? If you run "ls -d */|xargs du -sh" in /var/log what does it return?
As far as I know its ok to delete the *.gz compressed log files if you dont want them. I do that occaisionally.
|
Here is what it returned...This is after I deleted server *.1, *.2, etc /var/log files. Now when I run du -sH /var/log it shows 52M.
5.1M bandwidth/
3.8M dcpumon/
8.0K gdm/
19M samba/
4.0K squid/
4.0K vbox/
Last edited by vadertech; 08-21-2003 at 10:05 AM.
|
|
|
08-21-2003, 10:08 AM
|
#9
|
Member
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49
Rep:
|
Ah! So /var is not a subdirectory of /, bug is a mounted partition! Makes perfect sense. If you want to clear out /, cleaning up the mountpoints isn't going to do it (It's useful, but not what you want today.) To see what is mounted and how much space the mounts are using, do a df -h. For instance, if you see /home mounted just like /var, making more space there will not help you much in .
Just do a df -h, and it'll be clear what I mean.
|
|
|
08-21-2003, 10:16 AM
|
#10
|
Member
Registered: Nov 2002
Posts: 67
Original Poster
Rep:
|
This is what it displays for hda6 (/)
FileSystem Size Used Avail Used Mounted on
/dev/hda6 494M 390M 78M 84% /
....... /boot
....... /home
etc...
Ok since it is mounted, how can I go about either giving (/) more disk space or clearing some space.
|
|
|
08-21-2003, 10:29 AM
|
#11
|
Member
Registered: Nov 2002
Posts: 67
Original Poster
Rep:
|
for example...I have 38G for /usr but am only using 3.8G. This just seems like wasted space since the only thing we use this server for is webhosting. How would I lessen /usr and distribute some of the diskspace to /home and (/).
|
|
|
08-21-2003, 03:55 PM
|
#12
|
Member
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49
Rep:
|
Symlinks.
Move stuff to usr, and symlink back to it.
Let me give an example
Say you've got loads of stuff in /opt. Copy it to /usr/opt, then move /opt to /opt-old and link /usr/opt to /opt. (ln -s /usr/opt /opt) Later once you find it all works, remove /opt-old
Play around with it for a while before embarking om moving large quantities of data and possibly breakiing things. You'll want to use the -R and -p flags with cp to copy recursively and maintain attributes etc.
|
|
|
08-22-2003, 01:16 PM
|
#13
|
Member
Registered: Nov 2002
Posts: 67
Original Poster
Rep:
|
Thx again, sounds like alot of serious and detailed work. Anyway unmounting /var to make it a sub directory of / would make a difference in the size of / since I cleaned alot of log files from /var?
|
|
|
08-22-2003, 02:06 PM
|
#14
|
Member
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49
Rep:
|
No, that would cost you space on the partition that holds /. If you unmount /var, you'll be stuck with an empty /var directory (and lots of error messages about missing directories and so forth), and a partition whith lots of space you can mount anywhere in the filesystem.
Look at it this way: this is the story of /, and mounts and partitions, and / is special. Partitions are partitions (ie: chucks of diskspace), but what you do with them in linux is different from dos. / is special, it's similar to c:\, but the other partitions are not used as driveletters like D:\ or E:\ but are brought into play by "parking" them into an empty directory under /, like /home or /var. Get the idea? This is the important thing to get. So if in your case you clean out /var, it won't make a difference in how much space there's available on the partition you use for /.
This is nice, but who cares? You do. This is the way it works :-) So every now and then you actually want a bunch of files somewhere on a spot that has no room for it, so what do you do? You park it somewere (in a partition) that has the room, and place a symlink on the spot where you want it. Symbolic links are cool, and the best thing since sliced bread.
However, if you want this resolved in a more permanent way, there's two things you could do. 1 may be risky for your data, 2 will certainly erase it.
1 Find something to resize your partitions. Make the partition for /var smaller, make the one for / larger. I believe there's something called parted which seems to work, but I've never even looked at it. It seems Partition Magic can do it too, but I'm not sure.
2 Alternatively: do a reinstall, and resize the partitions to something more agreeable during the setup. Since you'll be repartitioning your drive, all your data will be lost, however. I don't know how much trouble that would be.
I hope things are a bit clearer now. I tried to expain it as best as I could.
cheerio,
René
|
|
|
08-22-2003, 02:12 PM
|
#15
|
Member
Registered: Jun 2003
Location: Florence, SC
Distribution: Gentoo i386
Posts: 180
Rep:
|
Just a hint: the xdiskusage tool can be a wonderful compliment to du when you're trying to figure out where all your disk space has gone
-Andrew
|
|
|
All times are GMT -5. The time now is 11:06 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|