Depending on the objective - if I understand correctly - you are trying to regain as much space as possible. if you really want to regain ALL not used space from the virtual image file, I'd suggest to run a utility like "bcwipe" from within the virtual guest OS first. It will analyze your partitions and zero out the blocks that have been used in past but are not used now.
Then you can attempt to cp --sparse=never - this in theory should give you back as much space as possible. Regards ilya From: rhelv5-list-boun...@redhat.com [mailto:rhelv5-list-boun...@redhat.com] On Behalf Of John Haxby Sent: Wednesday, January 04, 2012 4:22 AM To: Srija; Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list Subject: Re: [rhelv5-list] Regarding sparse file On 4 January 2012 02:15, Srija <swap_proj...@yahoo.com<mailto:swap_proj...@yahoo.com>> wrote: 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 mean you want to fill in the holes? The easy way to do this, assuming you have the disk space, is with "cp --sparse=never file.img newfile.img; mv newfile.img file.img". You can also just re-write the file in place using perl/python/C/whatever but that's slightly risky because if you run out of disk space part way through you'll probably trash the file and lose whatever data you have. If this is a virtual machine image then you can fill in the sparse blocks by creating a very large file in the guest (cp /dev/zero /tmp/huge; rm /tmp/huge) although this won't necessarily fill all the sparse blocks (it won't touch swap, for example). Why do you think you need to make the file non-sparse? jch
_______________________________________________ rhelv5-list mailing list rhelv5-list@redhat.com https://www.redhat.com/mailman/listinfo/rhelv5-list