473,320 Members | 1,802 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,320 software developers and data experts.

How to pre-allocation Harddisk space?

Chi
According this
http://research.microsoft.com/resear...aspx?tr_id=841

said, if you pre-allocation space for writing , it will be much faster,
but how can i do this?
Thank
Apr 27 '06 #1
6 3195
Hi,

Interesting article.

It does provide code though. I did a quick scan and I saw that you will have
to P/invoke in order to use this feature, read the entire article and I'm
sure it will tell you how to do it
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Chi" <a@a.con> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
According this
http://research.microsoft.com/resear...aspx?tr_id=841

said, if you pre-allocation space for writing , it will be much faster,
but how can i do this?
Thank

Apr 27 '06 #2
Hi,

Take also in count wheater the described technique is useful in a single
disk or in an array escenario
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Chi" <a@a.con> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
According this
http://research.microsoft.com/resear...aspx?tr_id=841

said, if you pre-allocation space for writing , it will be much faster,
but how can i do this?
Thank

Apr 27 '06 #3
Did you actually read the document? It clearly states how you can
pre-allocate file space.

FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);

fs.SetLength(128 * 1024 * 1024);

But take care, don't expect it to be 'MUCH faster", it wont even be 'faster'
on a reasonable fragmented disk (few fragments).

Willy.


"Chi" <a@a.con> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
| According this
| http://research.microsoft.com/resear...aspx?tr_id=841
|
| said, if you pre-allocation space for writing , it will be much faster,
| but how can i do this?
| Thank
Apr 27 '06 #4
Chi
Then , what will increase the speed?
Because I change my code from synchronous to Asynchronous but the speed
is slower than before.

My code is just sending file between two computer but it will open more
than 1 network stream and filestream to read write.

Now,I use fs.seek to locate different entry point to read write.
any suggestion? Thank

Willy Denoyette [MVP] wrote:
Did you actually read the document? It clearly states how you can
pre-allocate file space.

FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);

fs.SetLength(128 * 1024 * 1024);

But take care, don't expect it to be 'MUCH faster", it wont even be 'faster'
on a reasonable fragmented disk (few fragments).

Willy.


"Chi" <a@a.con> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
| According this
| http://research.microsoft.com/resear...aspx?tr_id=841
|
| said, if you pre-allocation space for writing , it will be much faster,
| but how can i do this?
| Thank

Apr 27 '06 #5
This is a totally different question isn't it?

First of all, what makes you thing it's too slow, what are your
expectations, how are you measuring things. Second, why don't you use what
is provided by Windows, that is, a network connection to a remote share that
can be used to copy files back and forth?
Two diffrent resources are involved when transfering (disk) file data from
one system to another over a network connection: a Disk resource (at both
ends) and the Network.
In general, the network is the slowest then comes the disk (write side), so
instead of trying to optimize the disk reading/writing you should start
looking at the network part.
What kind of connection do you have, what's the topology what's his speed?
What kind of transport protocol are you using? And how are you accessing it
from the application level (Sockets, Named pipes other). How about the
buffer sizes. And last but not least, what (and how) did you measured as
transfer rate?

Willy.

"Chi" <a@a.con> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
| Then , what will increase the speed?
| Because I change my code from synchronous to Asynchronous but the speed
| is slower than before.
|
| My code is just sending file between two computer but it will open more
| than 1 network stream and filestream to read write.
|
| Now,I use fs.seek to locate different entry point to read write.
| any suggestion? Thank
|
| Willy Denoyette [MVP] wrote:
| > Did you actually read the document? It clearly states how you can
| > pre-allocate file space.
| >
| > FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
| >
| > fs.SetLength(128 * 1024 * 1024);
| >
| >
| >
| > But take care, don't expect it to be 'MUCH faster", it wont even be
'faster'
| > on a reasonable fragmented disk (few fragments).
| >
| >
| >
| > Willy.
| >
| >
| >
| >
| > "Chi" <a@a.con> wrote in message
| > news:%2****************@TK2MSFTNGP04.phx.gbl...
| > | According this
| > | http://research.microsoft.com/resear...aspx?tr_id=841
| > |
| > | said, if you pre-allocation space for writing , it will be much
faster,
| > | but how can i do this?
| > | Thank
| >
| >
Apr 27 '06 #6
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote:
Did you actually read the document? It clearly states how you can
pre-allocate file space.

FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);

fs.SetLength(128 * 1024 * 1024);

But take care, don't expect it to be 'MUCH faster", it wont even be 'faster'
on a reasonable fragmented disk (few fragments).


You'll end up with less fragments on average, however. The Cygwin 'cp'
utility (http://www.cygwin.com) ends up copying files in 4K chunks. A side
effect of that is large files copied with cp end up with hundreds of times
more fragments than the same files copied with (say) Windows Explorer.

Since I run cygwin bash as my main shell, I make frequent use of
http://www.sysinternals.com/Utilities/Contig.html to fix up files such as
the locatedb database after running updatedb.

If you're creating large files incrementally in .NET, using this will help
a lot to reduce fragmentation.

-- Barry
Apr 27 '06 #7

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

Similar topics

2
by: GriffithsJ | last post by:
Hi I have been given some text that needs to be displayed on a web page. The text is pre-formatted (includes things like lists etc) and displays okay if I wrap it using the <pre/> tag. ...
2
by: Porthos | last post by:
Hi All, I'm building an XSL document that puts two types of information in a table dimension: preformatted data and data extracted from my XML document (see below) <table> <tr>
21
by: Headless | last post by:
I've marked up song lyrics with the <pre> tag because it seems the most appropriate type of markup for the type of data. This results in inefficient use of horizontal space due to UA's default...
7
by: Alan Illeman | last post by:
How do I set several different properties for PRE in a CSS stylesheet, rather than resorting to this: <BODY> <PRE STYLE="font-family:monospace; font-size:0.95em; width:40%; border:red 2px...
1
by: R0bert Nev1lle | last post by:
Here's my next IE challenge (or frustration). It deals with the overflow attribute. Overflow property was a challenge on my page since the page emulates position fixed for IE. The present...
8
by: Jarno Suni not | last post by:
It seems to be invalid in HTML 4.01, but valid in XHTML 1.0. Why is there the difference? Can that pose a problem when such a XHTML document is served as text/html?
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no...
14
by: Schraalhans Keukenmeester | last post by:
I am building a default sheet for my linux-related pages. Since many linux users still rely on/prefer viewing textmode and unstyled content I try to stick to the correct html tags to pertain good...
7
by: Paul Connolly | last post by:
char *s = "Hello"; s = 'J'; puts(s); might print "Jello" in a pre-ANSI compiler - is the behaviour of this program undefined in any pre-ANSI compiler - or would it always have printed "Jello"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.