To: comp.os.linux.misc,alt.os
I am looking for a command like "df -f" but for directories...
"df -h" tells me the size, used, available, and percent-used for
*partitions* such as /dev/sda1 or /dev/hda1.
How do I find the same information (especially percent-used)
for *directories* such as /etc, /tmp, or /usr/local?
I have several disks and am trying to decide which directories
to put on which disk. Knowing how much space each one uses
now would be a big help.
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
|
|
0
|
|
|
|
Reply
|
clueless.newbie (3)
|
4/26/2011 12:48:22 PM |
|
Clueless newbie wrote:
> Try running du from inside your /usr directory, then tell me
> how much space your /usr directory occupies.
>
> Do you see the problem?
>
RTFM
man du
and perhaps sed, grep, awk, or whatever else....
followups set
|
|
0
|
|
|
|
Reply
|
yan (1418)
|
11/1/2005 6:17:24 PM
|
|
[ Excessive crossposting trimmed ]
["Followup-To:" header set to comp.os.linux.misc.]
On Tue, 01 Nov 2005 17:39:35 +0000, Clueless newbie staggered into the
Black Sun and said:
> stan@worldbadminton.com wrote:
>>In comp.os.linux.misc Clueless newbie <nospam@nospsm.nospam> wrote:
>>>I am looking for a command like "df -f" but for directories... How
>>>do I find the same information (especially percent-used) for
>>>*directories* such as /etc, /tmp, or /usr/local?
>>du will tell you how much space a directory uses
> Try running du from inside your /usr directory, then tell me
> how much space your /usr directory occupies. Do you see the problem?
Like most commands, du has a bunch of options. "man du" and pay
particular attention to the -s option.
> "df -h" tells me the size, used, available, and percent-used for
> partitions such as /dev/sda1 or /dev/hda1. How do I find *the* *same*
> *information* for directories such as /etc, /tmp, or /usr/local?
> Note that "the same information" means "the same information."
What is "percent used" supposed to mean for directories? Do you mean
"if du -s reports that a directory reports 200M used, and that directory
is on a 2G partition, that directory has 9.76% 'percent used' "? If
that's what you want, you're going to have to find out how big each
partition is, then foreach directory on each partition, run du -s on
that directory, then divide the du result by the partition size. This
is a little more complex than just running du, and bash does integer
arithmetic on its variables, so you may have to use bc or Perl or
something.
What about symlinks? You'll have to be careful if, f'rexample, /opt is
part of / , and /opt/junk/ is a symlink to /home/junk/ , which contains
~800M of important stuff. The "-x /dev/hdXY" option to du may help you
out there. (Note that symlinks like that are almost always
user-generated, and not there in a default install.)
> "df -h" tells me the size, used, available, and percent-used for a
> partition. How do I find the same information for a directory?
Also, what does "space available" mean for a directory? Oh well, HTH,
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / "He is a rhythmic movement of the
-----------------------------/ penguins, is Tux." --MegaHAL
|
|
0
|
|
|
|
Reply
|
danSPANceswitTRAPhcrows (1928)
|
11/1/2005 6:33:43 PM
|
|
On 01 Nov 2005 16:07:33 GMT, in comp.os.linux.misc Clueless newbie <nospam@nospsm.nospam> wrote:
> I am looking for a command like "df -f" but for directories...
> "df -h" tells me the size, used, available, and percent-used for
> *partitions* such as /dev/sda1 or /dev/hda1.
> How do I find the same information (especially percent-used)
> for *directories* such as /etc, /tmp, or /usr/local?
> I have several disks and am trying to decide which directories
> to put on which disk. Knowing how much space each one uses
> now would be a big help.
I'm not sure what you mean.
If you mean that you want to know what percentage of the total
filesystem space is used by just the /usr/local directory (and it's
files and subdirectories, and so on), then first:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda2 37856128 18895324 17037824 53% /
...
then
$ du -sck /usr/local
172980 /usr/local
172980 total
and finally 172980 / 37856128 = 0.4% of /
Newsgroups and followup set to comp.os.linux.misc
--
Dale Dellutri <ddelQQQlutr@panQQQix.com> (lose the Q's)
|
|
0
|
|
|
|
Reply
|
ddelQQQlutr (156)
|
11/1/2005 6:42:44 PM
|
|
jon martin solaas wrote:
>Do you see the solution? You obviously found out what the -h switch
>does for df, so what's the big problem with du-switches?
When question asked, knew about --help. Did not know abut man.
--help does not have needed information. man does, so now I know answer.
To learn Linux, is useful to have running Linux system.
To have running Linux system, is useful to use old computer for
mistake making before converting main computer and throwing away
Windows CD.
To set up old computer is useful to use six old SCSI drives, all sizes.
To use six old SCSI drives is useful to put different directories on
different drives.
To put different directories on different drives is useful to know
how much space each directory uses.
To know how much space directories use is needful to know about
commands such as man, df, du, and others.
to know about commands such as man, df, du, and others is needful
to learn Linux. I chicken and egg problem.
Having poor english skills makes finding answers on web harder.
Solution to chicken and egg problem is in kind comp.os.linux.misc
users telling me about commands such as man, df, du, and others.
I thank you all for kind help.
|
|
0
|
|
|
|
Reply
|
nospam3155 (2)
|
11/2/2005 1:37:11 PM
|
|
Dances With Crows wrote:
>What about symlinks? You'll have to be careful if, f'rexample,
Please excuse my poor english; I cannot find "rexample" in English
to Russian dictionary. What does "f'rexample," mean? Is slang?
>/opt is part of / , and /opt/junk/ is a symlink to /home/junk/ , which
>contains ~800M of important stuff. The "-x /dev/hdXY" option to du
>may help you out there.
Is possible problem with solution being proper usage of switches.
For example:
"du /usr/X11 -sh" says 0MB.
"du /usr/X11 -shD" says 195MB.
"du /usr/X11 -shL" says 285MB.
(will try -x switch later.)
Which variation is correct for finding out the size of the
disk needed to hold /usr/X11? (Not really /usr/X11 on seperate
partition; example chosen because of big differences in sizes)
"Symlinks" are like windows shortcuts, small thing pointing to
large thing elsewhere, yes? So I think I need space on partition
only for small-thing-pointing, not large-thing-pointed-to. yes?
|
|
0
|
|
|
|
Reply
|
nospam3155 (2)
|
11/2/2005 1:50:19 PM
|
|
Clueless newbie <nospam@nospsm.nospam> wrote:
> Dances With Crows wrote:
>>What about symlinks? You'll have to be careful if, f'rexample,
> Please excuse my poor english; I cannot find "rexample" in English
> to Russian dictionary. What does "f'rexample," mean? Is slang?
It's "for example", written phonetically and with a typo (missing
space between the words - or maybe he meant to run it together).
Surely merely missing a space and apostrophizing the "for" doesn't
make it unreadable!
>>/opt is part of / , and /opt/junk/ is a symlink to /home/junk/ , which
>>contains ~800M of important stuff. The "-x /dev/hdXY" option to du
>>may help you out there.
> Is possible problem with solution being proper usage of switches.
> For example:
> "du /usr/X11 -sh" says 0MB.
I presume you mean /usr/lib/X11. It's a symlink.
> Which variation is correct for finding out the size of the
> disk needed to hold /usr/X11?
None. It's a symlink - it takes no space.
Peter
|
|
0
|
|
|
|
Reply
|
ptb (2756)
|
11/2/2005 2:00:44 PM
|
|
On 11/02/05 15:00, Peter T. Breuer wrote:
>
> None. It's a symlink - it takes no space.
>
Not true. It may need a block. 4k for a 10G ext3 partition.
Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 <http://counter.li.org/>
|
|
0
|
|
|
|
Reply
|
lsodgf0 (405)
|
11/2/2005 3:51:55 PM
|
|
In comp.os.linux.misc Giovanni <lsodgf0@home.net.it>:
> On 11/02/05 15:00, Peter T. Breuer wrote:
>>
>> None. It's a symlink - it takes no space.
>>
> Not true. It may need a block. 4k for a 10G ext3 partition.
Not really, IIRC if the symlink name is shorter then 60
characters it doesn't take a single block as the information is
stored directly in the inode it uses at least on ext2/ext3. So
you lose an inode but zero blocks.
Hint:
Wouldn't argue with Peter about fs internals. ;-)
--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 265: The mouse escaped.
|
|
0
|
|
|
|
Reply
|
USENET22 (5462)
|
11/2/2005 4:20:40 PM
|
|
Giovanni <lsodgf0@home.net.it> wrote:
> On 11/02/05 15:00, Peter T. Breuer wrote:
>> None. It's a symlink - it takes no space.
> Not true. It may need a block. 4k for a 10G ext3 partition.
That would be a very long name. It goes in the directory inode.
% mkdir foo1
% du foo1
1 foo1
% ln -s /tmp /tmp/foo1/
% du foo1
1 foo1
Peter
|
|
0
|
|
|
|
Reply
|
ptb (2756)
|
11/2/2005 5:00:08 PM
|
|
On 11/02/05 17:20, Michael Heiming wrote:
>>Not true. It may need a block. 4k for a 10G ext3 partition.
^^^
>
> Not really, IIRC if the symlink name is shorter then 60
> characters it doesn't take a single block as the information is
> stored directly in the inode it uses at least on ext2/ext3. So
> you lose an inode but zero blocks.
>
> Hint:
> Wouldn't argue with Peter about fs internals. ;-)
>
As you wrote if the name of the pointed file is longer than 60 character
it _needs_ a block :-)
Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 <http://counter.li.org/>
|
|
0
|
|
|
|
Reply
|
lsodgf0 (405)
|
11/2/2005 5:02:04 PM
|
|
Giovanni <lsodgf0@home.net.it> wrote:
> On 11/02/05 17:20, Michael Heiming wrote:
>> Wouldn't argue with Peter about fs internals. ;-)
> As you wrote if the name of the pointed file is longer than 60 character
> it _needs_ a block :-)
And that is simply not very common (actually, it's possible to work in
directories with 60 char paths, but it only leaves you 20 chars to type
commands in after the prompt ... ;).
Peter
|
|
0
|
|
|
|
Reply
|
ptb (2756)
|
11/2/2005 5:44:45 PM
|
|
Tony Lawrence wrote:
>
> Although that's generally true in practice, all
> filesystems are going to have some limitation on the
> number of directory entries, and may have different
> limits on sub-directory limits and links vs. ordinary
> files. Of course these are usually so large that you are
> unlikely to ever see the problem come up, though some of
> us are old enough to have worked on systems where you
> would see that now and then without doing anything
> particularly stupid.
>
> As those limits are available, an overly ambitious du
> program *could* tell you the percentage of entries used.
>
What make you think that? A directory will start out with
one directory block. When that fills up it chains another
directory block, and so on. There is no fixed size for
directories or a maximum size for them. Each and every
directory can potentially take up the whole of the unused
part of the disk. The only thing that will stop the whole of
the disk being allocated to a single directory and its
contents is running out of inodes, I guess, but that limit
applies to all directories.
Cheers,
Cliff
--
Barzoomian the Martian - http://barzoomian.blogspot.com
|
|
0
|
|
|
|
Reply
|
enkidu.com (38)
|
11/3/2005 9:40:02 AM
|
|
To: comp.os.linux.misc,alt.os
In comp.os.linux.misc Clueless newbie <nospam@nospsm.nospam> wrote:
: I am looking for a command like "df -f" but for directories...
: I have several disks and am trying to decide which directories
: to put on which disk. Knowing how much space each one uses
: now would be a big help.
du will tell you how much space a directory uses
Stan
--
Stan Bischof ("stan" at the below domain)
www.worldbadminton.com
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
|
|
0
|
|
|
|
Reply
|
stan1 (2)
|
4/26/2011 12:48:22 PM
|
|
To: comp.os.linux.misc,alt.os
On 2005-11-01, Clueless newbie <nospam@nospsm.nospam> wrote:
> I am looking for a command like "df -f" but for directories...
du
--
Uspjesne regije, tvrtke, muskarci i zene znaju da je uvijek bolje biti
prvorazredna verzija sebe nego drugorazredna verzija nekog drugog.
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
|
|
0
|
|
|
|
Reply
|
davorin.vlahovic (1)
|
4/26/2011 12:48:23 PM
|
|
To: comp.os.linux.misc,alt.os
Clueless newbie <nospam@nospsm.nospam> writes:
>I am looking for a command like "df -f" but for directories...
>"df -h" tells me the size, used, available, and percent-used for
>*partitions* such as /dev/sda1 or /dev/hda1.
>How do I find the same information (especially percent-used)
>for *directories* such as /etc, /tmp, or /usr/local?
There is no "percentage used" for directories. Directories can be as large
as you wish, as long as they still fit on the partition. All the system can
tell you is the size of the directory (man du).
>I have several disks and am trying to decide which directories
>to put on which disk. Knowing how much space each one uses
>now would be a big help.
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
|
|
0
|
|
|
|
Reply
|
unruh1 (4)
|
4/26/2011 12:48:24 PM
|
|
To: comp.os.linux.misc,alt.os
try this:
start menu:- system:- file system:- kdirstat
kdiskfree
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
|
|
0
|
|
|
|
Reply
|
darklight (1)
|
4/26/2011 12:48:35 PM
|
|
|
16 Replies
60 Views
(page loaded in 0.19 seconds)
|