View previous topic :: View next topic |
Author |
Message |
fasorud n00b
Joined: 17 Mar 2005 Posts: 24
|
Posted: Fri Mar 14, 2008 3:21 pm Post subject: External USB drive free space reported incorrectly w/ df -h |
|
|
Ok so here is my situation.
I purchased a WD 500 Gig external drive that connects to my gentoo box via USB.
I connected it, fdisk'ed it and created just one partition on it for the whole available space, which I formatted as ext3.
I ran a backup on it, and after running a "df -h" this is what I get on the output:
Code: |
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 19G 3.4G 15G 20% /
udev 10M 104K 9.9M 2% /dev
/dev/hda4 18G 541M 17G 4% /var
shm 31M 0 31M 0% /dev/shm
/dev/sda1 459G 783M 435G 1% /mnt/backup
|
My questions are:
1) Why is the drive space reported as 459G instead of 500G? fdisk correctly reports it as 500G
2) How come, since only 783M was written to the drive, the free space is reported as 435G, as if 24G was used?
Any ideas? Is "df" just reporting this stuff wrong or is something else going on? Are there space limitations with ext3?
Rudy |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54234 Location: 56N 3W
|
Posted: Fri Mar 14, 2008 3:47 pm Post subject: |
|
|
fasorud,
There are several points here.
First, there are two different definitions of Gb, it not always clear which is which.
There is driver vendors Gb, which is always 10^9
There is binary Gb which is 2^30
Binary Gb are bigger than driver vendors Gb.
fdisk shows something like Code: | Disk /dev/sdc: 200.0 GB, 200049647616 bytes | which is clearly driver vendors Gb, Any ambiguity is resolved by the size in bytes.
appears to use binary Gb. Without the -h is shows a decimal number of 1024 Byte blocks. You can convert that to bytes to remove the ambiguity.
When you make a filesystem (any filesystem) some drive space is used for metadata. Thats the data the file system needs for itself, to keep track of your data. e.g. the used block bitmap, the inodes, the top level directory, the filesystem super block and its copies ...
ext2/3 also, by defualt, reserves 5% of the space for the super user. This is done to prevent an ordinary user from filing up the drive to the point where lock files cannot be created, a system in this state dies a horrible death.
You can recover this 5% superuser allocation with tune2fs. Its unlikely you will have lock files or logs on your USB drive, so its safe to recover it all.
Each inode you have in the filesystem takes 128 bytes. You can save space at file system creation time by reducing the number of indoes.
Every file you have requires one inode, so if you are storing big files you can have a lot of unused inodes when the partition is full.
will show your inodes.
Conversely, the partition is full when there are no remaining inodes, regardless of the empty space it may contain.
Try df as root and an ordinary user - it will give different answers. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|