473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

file fragmentation project

Python may not be suitable for this, but I thought I'd ask the experts:

I'm doing a summer project that will attempt to measure exactly how file
fragmentation affects disk drive and OS performance. I'd like to use
Python for some of this. 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. For example, assuming that we
start with a 100% defragmented drive, run the program to randomly
fragment 20% of the drive's files into 7 different fragments (may also
base the number of fragments on the file's size).

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

All comments and advice are welcomed.

Bart
Jul 18 '05 #1
3 2687
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2004-06-02T21:10:02Z, Bart Nessux <ba*********@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+Y0CpvERAkm9AKCOeYJZ3aEbgcFERo8Iy5 dxAKD6aQCeMWEO
bnwx/bkTjkWo+JE/pCrMjvU=
=CmhE
-----END PGP SIGNATURE-----
Jul 18 '05 #2
Thanks for the advice Kirk, I appreciate it.

Kirk Strauser wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2004-06-02T21:10:02Z, Bart Nessux <ba*********@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+Y0CpvERAkm9AKCOeYJZ3aEbgcFERo8Iy5 dxAKD6aQCeMWEO
bnwx/bkTjkWo+JE/pCrMjvU=
=CmhE
-----END PGP SIGNATURE-----

Jul 18 '05 #3
Bart Nessux <ba*********@hotmail.com> schreef:
Python may not be suitable for this, but I thought I'd ask the experts:

I'm doing a summer project that will attempt to measure exactly how file
fragmentation affects disk drive and OS performance. I'd like to use
Python for some of this. 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. For example, assuming that we
start with a 100% defragmented drive, run the program to randomly
fragment 20% of the drive's files into 7 different fragments (may also
base the number of fragments on the file's size).

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

All comments and advice are welcomed.


Read this: <http://www.sysinternals.com/ntw2k/info/defrag.shtml>

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Olaf Noehring | last post by:
Hi I am the administrator of TSEP - The Search Engine Project (www.tsep.info). We developer are unclear about the speed of two different methods: Is it faster to a) write to a file or b)...
2
by: gary | last post by:
hello everyone, we dropped the clustered & nonclustered indeces on a table, then rebuilt them. logical fragmentation is near zero, but extent fragmentation is about 40%. how can this be if the...
18
by: Tron Thomas | last post by:
Given the following information about memory management in C++: ----- The c-runtime dynamic memory manager (and most other commercial memory managers) has issues with fragmentation similar to a...
0
by: sql-db2-dba | last post by:
I don't mean that our data grows in an exponential rate. According to the Adm planning manual, LOB data is stored in segments that are ("powers of 2" * 1024). Wouldn't this mean that the larger...
6
by: Tom | last post by:
Given: A binary data file of records. Task: Random access using seekg(). I've never found any documentation stating that the offset from begin file marker is safe on a fragmented file. I've...
1
by: Chris Mullins | last post by:
We've been using the SSLStream class found in System.Net.Security to build a giant Sockets server that provides TLS encryption at the channel leve. Before .Net 2.0, we used an open-source...
8
by: rcamarda | last post by:
I thought I would delve into index fragmentation and I found some great sql from many posters (thanks Erland!). My question is how bad is bad? I know this is very subjective. Some scripts I found...
5
by: Andreas Schmitt | last post by:
Hi, I recently worked on an open source project and tried to make on of the arrays they are using dynamically allocated to get rid of the max size. I used the realloc instead of the usual C++...
28
by: n00m | last post by:
Both codes below read the same huge(~35MB) text file. In the file 1000000 lines, the length of each line < 99 chars. Stable result: Python runs ~0.65s C : ~0.70s Any thoughts?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.