BadBlocksPlaceholder icon indicating copy to clipboard operation
BadBlocksPlaceholder copied to clipboard

Speed up the file creation

Open awol2007 opened this issue 5 years ago • 2 comments

Hi!

The file creation is very slow, but the MS have a good alternative to speed up the process:

Original version of write dummy files:

                    using (var filestream = File.OpenWrite(filename))
                        {
                            filestream.Write(block, 0, blockSize);
                            filestream.Flush();
                            filestream.Close();
                        }

The new faster version:

                        using (var fileStream = new FileStream(filename, FileMode.CreateNew, FileAccess.Write, FileShare.None))
                        {
                            fileStream.SetLength(blockSize);
                        }

HVND!

awol2007 avatar Nov 29 '19 07:11 awol2007

Faster program execution is always better... How does it behave when creating a file on a bad sector?

fraternl avatar Dec 24 '19 09:12 fraternl

Normally do nothing in the bad sector. When you can read the file with bad sectors, will see the read error.

awol2007 avatar Nov 26 '21 07:11 awol2007