LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 08-21-2003, 09:14 AM   #1
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Rep: Reputation: 15
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?
 
Old 08-21-2003, 09:28 AM   #2
Iturbide
Member
 
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49

Rep: Reputation: 15
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.
 
Old 08-21-2003, 09:38 AM   #3
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
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.
 
Old 08-21-2003, 09:42 AM   #4
andy18
Member
 
Registered: Oct 2002
Location: Malaysia
Posts: 106

Rep: Reputation: 15
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.
 
Old 08-21-2003, 09:48 AM   #5
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
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.
 
Old 08-21-2003, 09:59 AM   #6
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
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?
 
Old 08-21-2003, 10:01 AM   #7
andy18
Member
 
Registered: Oct 2002
Location: Malaysia
Posts: 106

Rep: Reputation: 15
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
 
Old 08-21-2003, 10:04 AM   #8
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
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.
 
Old 08-21-2003, 10:08 AM   #9
Iturbide
Member
 
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49

Rep: Reputation: 15
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.
 
Old 08-21-2003, 10:16 AM   #10
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
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.
 
Old 08-21-2003, 10:29 AM   #11
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
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 (/).
 
Old 08-21-2003, 03:55 PM   #12
Iturbide
Member
 
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49

Rep: Reputation: 15
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.
 
Old 08-22-2003, 01:16 PM   #13
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
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?
 
Old 08-22-2003, 02:06 PM   #14
Iturbide
Member
 
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49

Rep: Reputation: 15
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é
 
Old 08-22-2003, 02:12 PM   #15
beaucoup
Member
 
Registered: Jun 2003
Location: Florence, SC
Distribution: Gentoo i386
Posts: 180

Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
memory full sailu_mvn Linux - Software 3 08-22-2005 08:06 AM
My hd is full ... boumbo Fedora 3 02-20-2005 06:06 AM
Which distributions do not support --full-time for ls (ls --full-time)? GCS Linux - Distributions 0 07-28-2004 01:25 AM
/var full masterJ Red Hat 11 01-16-2004 12:27 PM
/ = 98.5% full lachlan Linux - Software 1 06-17-2002 04:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration