LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Lost Hard Drive Space (https://www.linuxquestions.org/questions/debian-26/lost-hard-drive-space-376484/)

kushalkoolwal 10-24-2005 03:52 PM

Lost Hard Drive Space
 
Hi,

There is something strange going on. I have two hard drives attached to my system. One of them is Running Debian(sarge) on it. Whenever I try to format my second HDD(from the debian installed on First HDD) and mount it over /mnt/data folder, there is a 10% loss of total Hard drive space.

For E.g., I have a HDD with capacity 512MB. I run the following commands over it to partition it and format it.

Code:

echo '0,
'\
| sfdisk -L /dev/hdc

and then I make an ext3 parition on it by

Code:

mke2fs -j -T news /dev/hdc1
and then I run a file system check on it which runs successfully

Code:

fsck -f -a /dev/hdc1
Finally, I mount it by following command:

Code:

mount /dev/hdc1 /mnt/data
And now when I try to check the space of the mount device by giving command df -h, I get the following:
Code:

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda7            7.5G  3.8G  3.4G  53% /
tmpfs                443M    0  443M  0% /dev/shm
/dev/hdc1            482M  8.1M  449M  2% /mnt/data

As you can see, in the size coloumn it shows 482MB whereas it should have been 512MB.

Does any one know why this is happening?I have tried this with another HDD(different model and make) also and I get the same result.

Thanks

nilleso 10-24-2005 04:03 PM

That is a normal result of formatting due to overhead etc. It is the case with all OS'es and all hardware.
If you were to try a search before posting, you would have found a lot of examples like this

cheers :)

kushalkoolwal 10-24-2005 04:38 PM

Ahh, that was really silly of me. I should have thought that before. Actually, I just assumed that Linux won;t take the space away unlike Windows...:D

I would further like to know that suppose I have a tar ball of size 490MB. Now when I give the command:

df -h -B M, it calculates the space according to 1024*1024 and the output is:

Code:

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda7            7.5G  3.8G  3.4G  53% /
tmpfs                443M    0  443M  0% /dev/shm
/dev/hdc1            482M  8.1M  449M  2% /mnt/data

whereas when I give the command df -h -B MB it takes 1000*1000 for caculation and hence more space in total size(506MB as compared to 482MB in above)
Code:

root@debian:~# df -h -B MB
Filesystem          1MB-blocks      Used Available Use% Mounted on
/dev/hda7              7975MB    4006MB    3565MB  53% /
tmpfs                    465MB      0MB    465MB  0% /dev/shm
/dev/hdc1                506MB      9MB    471MB  2% /mnt/debian
root@debian:~#

Now which one I should follow?506MB or 482MB?
Also,The size 490MB of my tar ball which Debian shows is based on which calculation:1MB=1000KB or 1MB=1024KB???

Thanks for the help.

nilleso 10-24-2005 05:14 PM

1KB= 1024B ... you can't confuse the bits ;)

...notice that when you requested a print where 1K=1000, the used and available space increased as well ... meaning both df prints are equal, just using different multipliers.

kushalkoolwal 10-24-2005 06:16 PM

Thanks I understand what you are trying to say.

Based on your explanation, does that mean my 490MB tar ball won't fit into my partition which shows 482MB free space(based on 1K=1024B)???

Thanks

nilleso 10-24-2005 08:13 PM

that's right :mad: ...maybe you could compress it.

saikee 10-25-2005 10:05 AM

Every partition has a reserved area for the boot loader and storage of the index data of the filing system. The entire track 1 out of 64 is used for that purpose. So any data storage should never exceed

1000/1024*63/64 *100% = 96% of the orginal.

512Mb*96% = 492Mb.

Wells 10-25-2005 12:50 PM

Also note that linux by default tends to reserve 5% of the drive space of a formatted partition for the root user. Per the mkfs.ext3 manpage:

Code:

      -m reserved-blocks-percentage
              Specify the percentage of the filesystem blocks reserved for the
              super-user.  This  avoids  fragmentation, and allows root-owned
              daemons, such as syslogd(8), to continue to  function  correctly
              after non-privileged processes are prevented from writing to the
              filesystem.  The default percentage is 5%.


kushalkoolwal 03-13-2006 08:41 PM

Quote:

Originally Posted by Wells
Also note that linux by default tends to reserve 5% of the drive space of a formatted partition for the root user. Per the mkfs.ext3 manpage:

Code:

      -m reserved-blocks-percentage
              Specify the percentage of the filesystem blocks reserved for the
              super-user.  This  avoids  fragmentation, and allows root-owned
              daemons, such as syslogd(8), to continue to  function  correctly
              after non-privileged processes are prevented from writing to the
              filesystem.  The default percentage is 5%.



But does this 5% reserves is included in the output of the command

df -h
or
df -h -B M
or
df -h -B MB


All times are GMT -5. The time now is 05:16 PM.