Re: file fragmentation project

From: Kirk Strauser (kirk_at_strauser.com)
Date: 06/02/04


Date: Wed, 02 Jun 2004 21:55:06 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2004-06-02T21:10:02Z, Bart Nessux <bart_nessux@hotmail.com> writes:

> In particular, I'd like to write a file fragmentor in Python that will
> randomly fragment x% of files on a NTFS filesystem into y number of
> fragments.

You may or may not be able to do so, depending on how smart your exact
version of NTFS decides to be on that given day. Still, the standard
algorithm to fragment a file m bytes long into n pieces is:

   1) Create n * 2 files, each (m/n) bytes long.
   2) Delete every other file.
   3) Write the file to be fragmented, and hope that the filesystem naively
      shoves it into the empty holes.
   4) Delete the remaining "pad" files.

A similar algorithm is to replace step 1 with:

   1) Fill the entire drive with files (m/n) bytes long.

If the filesystem isn't smart enough to rearrange empty blocks, then that
should to the trick.

> Anyway, would Python be acceptable for this type of project? Speed is
> somewhat important, but not extremely.

You bet. Filesystem speed will be the limiting factor.
- --
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAvky35sRg+Y0CpvERAkm9AKCOeYJZ3aEbgcFERo8Iy5dxAKD6aQCeMWEO
bnwx/bkTjkWo+JE/pCrMjvU=
=CmhE
-----END PGP SIGNATURE-----



Relevant Pages

  • UFS1 filesystem compatibility problem under Linux
    ... filesystems under Linux, but this failed. ... time to see why it failed, but I've since downloaded recent kernel ... filesystem blocksize was limited to a small selection of values, ... made regular use of fragment sizes up to and including the block ...
    (Linux-Kernel)
  • Re: file fragmentation project
    ... Kirk Strauser wrote: ... > version of NTFS decides to be on that given day. ... > algorithm to fragment a file m bytes long into n pieces is: ... > 3) Write the file to be fragmented, and hope that the filesystem naively ...
    (comp.lang.python)
  • Re: Root FS corruption
    ... A subsequent reboot is needed for the ... A fragment ... allows for allocating a new block to the small file, ... Store the nextboot info "not in a filesystem". ...
    (freebsd-current)
  • Re: 2.6.24-rc2-mm1 -- mkfs failing on variety of fs types
    ... Attempt to write block from filesystem resulted in short ... Fragment size=4096 ... Writing inode tables: ... Guessing about desired format.. ...
    (Linux-Kernel)
  • Re: defragmentation in FreeBSD 4.11
    ... There is a minimum block and fragment size. ... Without checking I believe Solaris uses 8K blocks. ... > free space, just not enough free contiguous space. ... FreeBSD can automatically shift between the two as the filesystem ...
    (freebsd-questions)