Thanks  for your reply.
 
>>You can fully allocate it, or perhaps deallocate if there any
>>all-zero blocks withing it and release them, but that's it.

Ok I completely  agree what  you said. So if I want to deallocate  if any  
zeros then what is the procedure?
 
Thanks again ...


________________________________
From: Peter Grandi <pg_...@el5.for.sabi.co.uk>
To: RH EL5 <rhelv5-list@redhat.com> 
Sent: Wednesday, January 4, 2012 11:05 AM
Subject: Re: [rhelv5-list] Regarding sparse file

> Hi, If the  file contains the sparse  bits then can anybody
> guide me , how to remove those ? For example when I am
> checking file.img [ as below] , it's size is 38G. Basically
> it's size is 93G because of the sparse.

You are using "size" in two completely different meanings.

> [root@server]# du -sh file.img
> 38G     file.img
> [root@server]# du -sh --apparent-size file.img
> 93G     file.img

The 38G is the blocks used, an implementation detail, and the
93G is the file length, a property of the file.

The space occupied is usually greater than the length of the
file for several reasons, and can be smaller if it is sparse
enough (or if it is transparently compressed).

> I need the 'du -sh'  and 'du-sh --apprent-size ' should be 
> same  and ie,  38G. Help is really appreciate.

What you seem to want is absolutely impossible. If a file is 93G
long, it is 93G long. It may only require 38G of space occupied
if it is sparse, but you cannot truncate its length to 38G
without losing information.

You can fully allocate it, or perhaps deallocate if there any
all-zero blocks withing it and release them, but that's it.

Perhaps you should state what you are trying to achieve, because
that may make sense.

Public service announcement: sparse VM disk images that are
sparse because incrementally allocated tend to perform terribly.
I have seen VM disk images created by some !"%^& with over a
million fragments as they grew from a few GiB to a hundred GiB
(that itself is a bad idea).

_______________________________________________
rhelv5-list mailing list
rhelv5-list@redhat.com
https://www.redhat.com/mailman/listinfo/rhelv5-list
_______________________________________________
rhelv5-list mailing list
rhelv5-list@redhat.com
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to