View previous topic :: View next topic |
Author |
Message |
huuan Apprentice
Joined: 19 Feb 2007 Posts: 265 Location: California
|
Posted: Tue Apr 13, 2010 11:11 pm Post subject: du shows wrong size [SOLVED] |
|
|
windows failed to extract a gz image of an ubuntu server dis that I have to install on another server so I uploaded the gz image file to our gentoo server to extract it there.
It started off as a 200 meg file but when extracted showed as aroun 1.4G.
ls -rlt
...
-rw-r--r-- 1 peon peon 4091904 Apr 7 06:17 lucid-server-uec-amd64-vmlinuz-virtual
-rw-r--r-- 1 peon peon 1476395008 Apr 7 06:17 lucid-server-uec-amd64.img
-rw-r--r-- 1 jonny wheel 200558263 Apr 13 12:05 ubuntu-10.04-beta2-server-uec-amd64.tar.gz
but when I do du
# du -hs /home/jonny/
842M /home/jonny/
# du -hs /home/
842M /home/
# du -hs /home/jonny/lucid-server-uec-amd64-vmlinuz-virtual
4.0M /home/jonny/lucid-server-uec-amd64-vmlinuz-virtual
# du -hs /home/jonny/lucid-server-uec-amd64.img
592M /home/jonny/lucid-server-uec-amd64.img
My question is: why does a file that shows listed as 1476395008 bytes show via disk usage as 592M
and for a runner up question how come after I extracted it as root it is owned by another user 'peon'
I think I am losing my marbles here... any insight?
Thanks,
Jonny
p.s.
# cat /proc/version
Linux version 2.6.23-hardened-r7 (root@as.ucsd.edu) (gcc version 3.4.6 (Gentoo Hardened 3.4.6-r2, ssp-3.4.6-1.0, pie-8.7.10)) #3 SMP Thu Mar 27 16:43:33 PDT 2008
<sheepish>I know it's a bit out of date, I will be upgrading over summer but meanwhile...
Last edited by huuan on Wed Apr 14, 2010 6:12 am; edited 1 time in total |
|
Back to top |
|
|
platojones Veteran
Joined: 23 Oct 2002 Posts: 1602 Location: Just over the horizon
|
Posted: Tue Apr 13, 2010 11:21 pm Post subject: |
|
|
It's looks like a binary image file. It probably has a file system hole. See the last paragraph:
http://en.wikipedia.org/wiki/Sparse_file
Also known as a sparse file. |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Tue Apr 13, 2010 11:27 pm Post subject: |
|
|
The un-gzip'd archive could be a sparse file, ie have some large sequences of zero, the space for which is not actually allocated, therefore du will only show the amount of disk space it's actually using.
Try passing --apparent-size to du, see what size it tells you it is then.
Also, just out of curiosity, what does `file lucid-server-uec-amd64.img` return?
edit: I'm a slowpoke... _________________ "You have to invite me in" |
|
Back to top |
|
|
dwbowyer Apprentice
Joined: 18 Apr 2008 Posts: 155
|
Posted: Wed Apr 14, 2010 12:08 am Post subject: |
|
|
sound like someone used "dd" to make a disk image, which as it happens makes an EXACT copy of a partition.... including any empty space. |
|
Back to top |
|
|
huuan Apprentice
Joined: 19 Feb 2007 Posts: 265 Location: California
|
Posted: Wed Apr 14, 2010 6:11 am Post subject: |
|
|
Hopeless wrote: | The un-gzip'd archive could be a sparse file, ie have some large sequences of zero, the space for which is not actually allocated, therefore du will only show the amount of disk space it's actually using.
Try passing --apparent-size to du, see what size it tells you it is then.
Also, just out of curiosity, what does `file lucid-server-uec-amd64.img` return?
edit: I'm a slowpoke... |
Code: | # du -hs /home/jonny/
842M /home/jonny/
# du -hs --apparent-size /home/jonny/
1.7G /home/jonny/
# file lucid-server-uec-amd64.img
lucid-server-uec-amd64.img: Linux rev 1.0 ext3 filesystem data (large files)
|
So you all nailed it , a sparse file. We lives and sometimes we learns.
Thanks to platojonesm,Hopeless, and dwbowyer. Solved... BTW I had downloaded the wrong image |
|
Back to top |
|
|
|