Nguyen Vu Hung a ?crit :
> I still don't know what is the different between df's ouput and the size that 
> ls -l | awk '{print $5}' reports.
>   
The "df" command is for total filesystem size. It will display you the
used/free block occupation. So it's not about files on it but only about
free blocks in the filesystem. Take care about the fact by default
ext2/3 reserve 5% for root usage only (or other specified user/group).
You can change this using "tune2fs -m P", with P the percentage.

The "du" command is for total block occupation in a directory hierarchy,
starting from the current directory by default. It's also about block
usage, not file size.

E.g. :

$ mkdir testdir
$ cd testdir
$ du
4 (because my filesystem use a 4 KB block size)

$ touch testfile
$ ls -l testfile
total 0 (because no block used for an empty file)
-rw-r--r-- 1 root root 0 2007-12-06 17:39 testfile

$ echo test > testfile
$ ls -l testfile
total 4 (because 1 block used for a file of size < 4 KB)
-rw-r--r-- 1 root root 5 2007-12-06 17:40 testfile

$ dd if=/dev/zero of=testfile bs=1k count=5
$ ls -l testfile
total 8 (because 2 blocks needed to store 5 KB)
-rw-r--r-- 1 root root 5120 2007-12-06 17:41 testfile

$ du
12 (3 blocks of 4 KB : 1 for testdir and 2 for testfile)

> It is not the case. Our files are all small.
>   
Then you may need to do the opposite: may be reduce block size to 2KB
could help, but not sure... It's really dependent of your data. Be
carefull about having enough inodes available too! Check "df -i" for
knowing how many are used currently.

> I also found -i interesting:
>        -i bytes-per-inode
>   
Yes, this is what should be used. Except that it should not be used
alone. And that's why they did the -T option: to ease this process with
help of the "/etc/mke2fs.conf" configuration file.

Hint: first play with "tune2fs -l" to know how your filesystem is
configured.

-- 
Jean Christophe "????" ANDR? ? http://asie-pacifique.auf.org/
Responsable technique r?gional
Agence universitaire de la Francophonie (AuF) ? Bureau Asie-Pacifique (BAP)
Adresse postale : AUF, 21 L? Th?nh T?ng, T.T. Ho?n Ki?m, H? N?i, Vi?t Nam
T?l. : +84 4 9331108   Fax : +84 4 8247383   Mobile : +84 91 3248747
? Note personnelle : merci d'?viter de m'envoyer des fichiers PowerPoint  ?
? ou Word, voir http://www.gnu.org/philosophy/no-word-attachments.fr.html ?

Trả lời cho