How to give free space in /usr

Hello
after trying to update the FreeBSD 10.0-RELEASE-p12 System my 10GB space of /usr is full
Code:
/dev/ad0s1e  2,1G  324M  1,6G  17%  /tmp
/dev/ad0s1f  10G  9,8G  -241M  103%  /usr
/dev/ad0s1g  4,7G  770M  3,5G  18%  /home

I do not understand what this negative disk space -241M means?

My Server Software is not so big. Just Apache Webserver + MySQL + PHP (Websites and databse files are in /home) and eMail-Server (sendmail) some Services like bind, ftp, sshd.

I find out with du -sh *:
that the most data are in:
Code:
2,9G  /usr/local
3,9G  /usr/ports
1,6G  /usr/src

I have try these to give free space:
portsclean -C
portsclean -DP
portmaster -y --clean-distfiles
in /usr/ports make clean
in /usr/src make cleandir && make cleandir and make clean

But nothing helps...

How can I delete some space without deleting needed system files?
 
You can safely nuke /usr/ports/* and /usr/src/*. That will free you around ~5GB of space. Then you can use portsnap fetch extract to restore a clean ports tree.
 
Hello
after trying to update the FreeBSD 10.0-RELEASE-p12 System my 10GB space of /usr is full
Did you succed in upgrading the system? Did it fail because of the diskspace?
In either case you should clean /usr/obj like this:
Code:
# cd /usr/obj
# chflags -R noschg *
# rm -rf *
For building from sources you need about roughly 2,5-3GB free disk space.
While upgrading /usr/ports can be removed for freeing up about 1GB space.

You might want to know where the disk space has been consumed. Try du -hd1 /usr for a first look, and then explore the directories which look big du -hd1 /usr/bigsize | grep M.
You also might want to review if some of the installed ports can be deleted. pkg info -sa | grep MiB shows the big ones.
Searching for removable files might be considered too, i.e find /usr -name "*\.core"
 
Before you type rm -rf * make sure you know where you are by using pwd. You need to nuke your / first before you get into that habit.
Anyway, 3.9G in /usr/ports means that they have never been cleaned. Don't waste utilities, CPU and Disk IO for this since there is no benefit. Just remove them.
 
Well, and there is still rm -Irf *
man rm said:
-I Request confirmation once if more than three files are being removed or if a directory is being recursively removed. This is a far less intrusive option than -i yet provides almost the same level of protection against mistakes.


Code:
 # cd /usr/ports
 # rm -Irf *
recursively remove 55 dirs and 11 files?

And for those who cannot remember there is a little help from my friend alias:
Code:
# alias rm  'rm -I'

# cd /usr/ports
 # rm -rf *
recursively remove 55 dirs and 11 files?
This alias may be worth being put in the shell configuration file.
 
Well, and there is still rm -Irf *

This alias may be worth being put in the shell configuration file.

Still, it does not tell you what it is going to remove. So, if you are determined to perform this action and you think that you are in the correct place, you will answer yes! However, getting the habit you use pwd will save you one day.
 
Thanks a lot for all who has give me advice.

First:
Did you succed in upgrading the system? Did it fail because of the diskspace?
In either case you should clean /usr/obj like this:
Code:
# cd /usr/obj
# chflags -R noschg *
# rm -rf *
Good idea, but my /usr/obj ist empty. All are under /usr/src.
Yes updating the system was successful and I don't forget to reboot. But updating the "software" with portupgrade -ar run in trouble because of the Perl version (another problem) and because of not enough disk space. I have then cleaned the ports, which has given free space at this time and then I do portupgrade -PP to use packages when ever possible. I need the ports for Apache and Sendmail and some bit more to give my own installation settings. But for the rest of the hundreds of software piaces I could use packages when ever possible.

The question is: if I would delete all under /usr/src, would I further be able to make updates again with freebsd-update or build a new system? I have no own kernel.

Second: what is this with this minus diskspace -241M 103% /usr. I have some link to /tmp in /usr. But how can a partition get 103% full?

And why don't the commands above clean anything more?
 
The question is: if I would delete all under /usr/src, would I further be able to make updates again with freebsd-update or build a new system? I have no own kernel.
If you have a GENERIC kernel you can delete /usr/src and use freebsd-update for getting binary files. /usr/src is needed only if you want to build the system yourself from source or for building a custom kernel.
Second: what is this with this minus diskspace -241M 103% /usr. I have some link to /tmp in /usr. But how can a partition get 103% full?

FAQ Chapter 8. Disks, File Systems, and Boot Loaders]

And why don't the commands above clean anything more?
Good question. You have to search your disk :)
 
You can safely nuke /usr/ports/* and /usr/src/*. That will free you around ~5GB of space. Then you can use portsnap fetch extract to restore a clean ports tree.
I like to give the whole sequence, for those who read this thread:
Portsnap Ports new siting
Config file: /etc/portsnap.conf
rm /var/db/portsnap/tag
rm -rf /var/db/portsnap/files
rm -rf /usr/ports/*
cd /usr/ports
portsnap fetch
portsnap extract

To update an already installed Ports Collection, use portsnap update
portsnap update
Sure, you can combine fetch and extract for portsnap - I prefer to do it step by step.
Later on, when the ports tree has been built, you can make updates:
portsnap fetch update
Update or create the ports database file INDEX.db and fetch the ports index file called INDEX from the official
portsdb -Fu
 
Back
Top