What command tells you how much space is in a directory?

I am trying to configure a gcc compiler and one of the things that I am trying is the pkgadd -d command.  When I do that I get an error that says "errno 28 No space left on Device".  What is the correct command that finds out how much space is in a directory.  The only command I know right now is df and that only gives me the overall view.  Also: Is there any way to increase the size of a directory without having to reformat the whole disk over again?

Who is Participating?
john-at-7fffConnect With a Mentor Commented:
OK. I would recommend that you read the documentation for ln -s before doing this.

Your big filesystem is /dev/dsk/c0t0d0s7 (mounted on /export/home0)
Unfortunately, you have a small filesystem (/dev/dsk/c0t0d0s3) mounted on /var

Make a new tmp directory on /export/home0:

    mkdir /export/home0/mytmp

Then remove /var/tmp and everything underneath it:

    rm -R /var/tmp

Then create a symbolic link so that /var/tmp is actually over at your new /export/home0/mytmp:

    ln -s /export/home0/mytmp /var/tmp

Now check your work:


     ls -l /var

You should see a line like this:

lrwxrwxrwx   1 root     other         18 Apr 16 23:11 tmp -> /export/home0/mytmp

Now try your pkgadd.

To get rid of the symbolic link and get things back to the original:

rm /var/tmp
mkdir /var/tmp
ls -l /var

df -k will give you the space left on each volume.

du will tell you how much space is used by each file.
You can also do

du -s

to get a summary, which is really useful. Like:

du -s /etc/*

Finally: Changing the size of a directory --

Well, the problem is likely that you want to change the space on a VOLUME, i.e., a partition on the disk. On the very newest versions of Solaris, there is what is known as Dynamic File Systems -- among other places, you might read: http://www.netapp.com/tech_library/3294.html

But in general, on Solaris, you would have to destroy the partition and create it anew to make it bigger.

Re: Running out of space during pkgadd: Sometimes you can set up some symbolic links to make pkgadd use other volumes. See this thread for instance:

rodunoAuthor Commented:
Good information but can you give me an example of how I would symbolically link the different directories?
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


du /var/tmp/*

What do you get?

(Just wondering how much junk is in your tmp directory.)

Also paste in a df -k

And you're definitely running as root (would have to be for pkgadd)?
rodunoAuthor Commented:
# du /var/tmp/*
2       /var/tmp/caafxaacb
0       /var/tmp/stats10505.dtd
0       /var/tmp/stats10506.xml
rodunoAuthor Commented:
# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0      90079   49343   31729    61%    /
/dev/dsk/c0t0d0s6     798495  716033   26568    97%    /usr
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
/dev/dsk/c0t0d0s3      32847    8622   20941    30%    /var
swap                  701000      16  700984     1%    /var/run
swap                  701008      24  700984     1%    /tmp
/dev/dsk/c0t0d0s5      26615    2133   21821     9%    /opt
/dev/dsk/c0t2d0s7    38476820       9 38092043     1%    /export/home0
/dev/dsk/c0t0d0s7    36827276  120234 36338770     1%    /export/home
/dev/dsk/c0t0d0s1     337815  218529   85505    72%    /usr/openwin
Oops -- on that last bit, you want rmdir /var/tmp then mkdir /var/tmp, etc.
Double oops: What I wrote orignally was right. Forgot it was a symbolic link!!
rodunoAuthor Commented:
Thanks for the detailed info.  I am through for today so I will try this tomorrow or definitely over the weekend and I will get back and let you know how it goes.
rodunoAuthor Commented:
Worked great!  Thanks a bunch!
#df -kh

increace the swap space
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.