[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Clean deleted space in linux diks?



Niels Dettenbach (Syndicat IT&Internet) wrote:

 >We run different version of SLES. Are there any similar tools for linux
or a way of doing this in linux so the deleted space can be reclaimed?

Shure, use dd or similiar tools.

If you just want to overwrite with zeros you may do a:

dd if=/dev/zero of=/dev/yourdiskorpartition

(you may speed up write by giving a larger blocksize option like i.e. bs=1024k )

if you have enough random data / fast data souce you may use that instead of /dev/zero .

In this case he is wanting zeros so that the SAN will make the storage sparse.

If the disk is large, it may be a bit of a problem making a single large file. The OP hasn't said which specific OS (32 vs 64 bit), or filesystem, so I don't know what the max file size is (I vaguely recall a 4G limit under some OS/filesystem combinations). He may have to do something like :

a=0 ; while [ $a -lt X ]
do
  dd if=/dev/zero of=null-file-$a bs=1024k count=1024
done
rm null-file*

replacing X with a value appropriate to the free space available. This will create 1GB files of zeros, so if there is 75G of free space, I'd set X to 76 just to be sure. Probably best to stop all unnecessary services so things don't barf when the disk is full.


--
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.