LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-24-2005, 03:52 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 49
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
 
Old 10-24-2005, 04:03 PM   #2
nilleso
Member
 
Registered: Nov 2004
Location: ON, CANADA
Distribution: ubuntu, RHAS, and other unmentionables
Posts: 372

Rep: Reputation: 31
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
 
Old 10-24-2005, 04:38 PM   #3
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 49
Talking

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...

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.
 
Old 10-24-2005, 05:14 PM   #4
nilleso
Member
 
Registered: Nov 2004
Location: ON, CANADA
Distribution: ubuntu, RHAS, and other unmentionables
Posts: 372

Rep: Reputation: 31
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.
 
Old 10-24-2005, 06:16 PM   #5
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 49
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
 
Old 10-24-2005, 08:13 PM   #6
nilleso
Member
 
Registered: Nov 2004
Location: ON, CANADA
Distribution: ubuntu, RHAS, and other unmentionables
Posts: 372

Rep: Reputation: 31
that's right ...maybe you could compress it.
 
Old 10-25-2005, 10:05 AM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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.
 
Old 10-25-2005, 12:50 PM   #8
Wells
Member
 
Registered: Nov 2004
Location: Florida, USA
Distribution: Debian, Redhat
Posts: 417

Rep: Reputation: 53
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%.
 
Old 03-13-2006, 08:41 PM   #9
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 49
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fsck and lost hard drive space LinuxGeek Linux - Software 1 07-19-2005 08:17 PM
out of Hard drive space it-s Linux - General 4 06-28-2005 03:03 PM
lost hard drive space trolsbane Mandriva 3 09-16-2003 08:16 PM
Hard Drive Space Odd_Bloke Linux - Newbie 4 09-13-2003 08:44 AM
hard drive space, available bbenz3 Linux - General 4 03-22-2002 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration