How Often Disk Defrag

J

John Williamson

choro said:
"Bin tinking" -- If I keep adding bits to a file and resaving it over
and over again and again it adds up to a defragged file of a fairly
large file. So I tried opening one such file and resaving it under a
different filename and deleted the older version. File size immediately
went down by a factor of several times.
That sounds like you were using something like Word with the quick save
option enabled. It just appends the edits to the end of the file with a
note to itself in the file to use the edited bits rather than the
original version. When you resave the file, it saves the current version
without the history, and this will reduce the file size.
Isn't that what defragging actually does? Bit like defrocking a wench!
(de-jeansing just doesn't sound right, does it?) ;-)
Not quite, no. Defragging re-arranges the parts of a file on the HD so
that the head doesn't have to search all over the platter to get the
various bits of it. In theory, it can save time, but most modern HDs are
fast enough that unless you're streaming HD video off the drive, you'd
probably never notice that the file takes 0.03 of a second instead of
0.005 of a second to load into RAM.

You may also notice a slowdown if a database is doing multiple searches
through multiple files on a badly fragmented HD to generate a report.
 
P

Paul

choro said:
"Bin tinking" -- If I keep adding bits to a file and resaving it over
and over again and again it adds up to a defragged file of a fairly
large file. So I tried opening one such file and resaving it under a
different filename and deleted the older version. File size immediately
went down by a factor of several times.

Isn't that what defragging actually does? Bit like defrocking a wench!
(de-jeansing just doesn't sound right, does it?) ;-)
-- choro
Fragmenting files is easy. I wrote a short C program to do it, so I could
put a million fragmented files on my hard drive. Then, I fed that to the
Windows 7 defragmenter for fun.

All that is required, is to keep a bunch of file handles open, and
make little writes to each one. The OS won't make a large space
so they won't conflict. And then they end up competing for space
like this. (At first, I thought I'd have trouble making fragmented
files, but it was easy.)

A A B A B B A B A B

Each of those files is fragmented.

If I use the nfi.exe utility (NTFS only), I see something like this.
This is a file with perhaps two hard links to the same data. And
the data is fragmented into 17 fragments. The Windows 7 defragmenter
will put these back into one chunk. (With nfi.exe, you can test
that for me :) )

*******
File 110660
\Program Files\Canon\Easy-PhotoPrint EX\Template\frameM004_2L_L.bmp
$STANDARD_INFORMATION (resident)
$FILE_NAME (resident)
$FILE_NAME (resident)
$DATA (nonresident)
logical sectors 5441600-5441631 (0x530840-0x53085f)
logical sectors 58199592-58199719 (0x3780e28-0x3780ea7)
logical sectors 58066792-58067079 (0x3760768-0x3760887)
logical sectors 58723640-58724231 (0x3800d38-0x3800f87)
logical sectors 61788208-61788831 (0x3aed030-0x3aed29f)
logical sectors 61768528-61768911 (0x3ae8350-0x3ae84cf)
logical sectors 61792480-61793103 (0x3aee0e0-0x3aee34f)
logical sectors 61775416-61775815 (0x3ae9e38-0x3ae9fc7)
logical sectors 57766616-57767287 (0x37172d8-0x3717577)
logical sectors 58825952-58826303 (0x3819ce0-0x3819e3f)
logical sectors 58877712-58878407 (0x3826710-0x38269c7)
logical sectors 58695904-58696231 (0x37fa0e0-0x37fa227)
logical sectors 58740320-58741023 (0x3804e60-0x380511f)
logical sectors 58833808-58834127 (0x381bb90-0x381bccf)
logical sectors 56225112-56225847 (0x359ed58-0x359f037)
logical sectors 58221816-58222103 (0x37864f8-0x3786617)
logical sectors 58811336-58811743 (0x38163c8-0x381655f)

File 110661
*******

You could download the nfi.exe utility, if you want to have
a look at this stuff. And see what the before and after looks
like. I would expect, when that file is defragmented,
the first chunk will no longer be at 5441600-5441631. It'll
be moved.

http://support.microsoft.com/kb/253066
http://download.microsoft.com/download/win2000srv/utility/3.0/nt45/en-us/oem3sr2.zip

Using 7ZIP, you can just extract the nfi.exe from that. It runs
in command prompt. It's a 22KB file, so it is pretty small. And
it gives you one more tool, to "look at the world" with.

Paul
 
C

choro

Fragmenting files is easy. I wrote a short C program to do it, so I could
put a million fragmented files on my hard drive. Then, I fed that to the
Windows 7 defragmenter for fun.

All that is required, is to keep a bunch of file handles open, and
make little writes to each one. The OS won't make a large space
so they won't conflict. And then they end up competing for space
like this. (At first, I thought I'd have trouble making fragmented
files, but it was easy.)

A A B A B B A B A B

Each of those files is fragmented.

If I use the nfi.exe utility (NTFS only), I see something like this.
This is a file with perhaps two hard links to the same data. And
the data is fragmented into 17 fragments. The Windows 7 defragmenter
will put these back into one chunk. (With nfi.exe, you can test
that for me :) )

*******
File 110660
\Program Files\Canon\Easy-PhotoPrint EX\Template\frameM004_2L_L.bmp
$STANDARD_INFORMATION (resident)
$FILE_NAME (resident)
$FILE_NAME (resident)
$DATA (nonresident)
logical sectors 5441600-5441631 (0x530840-0x53085f)
logical sectors 58199592-58199719 (0x3780e28-0x3780ea7)
logical sectors 58066792-58067079 (0x3760768-0x3760887)
logical sectors 58723640-58724231 (0x3800d38-0x3800f87)
logical sectors 61788208-61788831 (0x3aed030-0x3aed29f)
logical sectors 61768528-61768911 (0x3ae8350-0x3ae84cf)
logical sectors 61792480-61793103 (0x3aee0e0-0x3aee34f)
logical sectors 61775416-61775815 (0x3ae9e38-0x3ae9fc7)
logical sectors 57766616-57767287 (0x37172d8-0x3717577)
logical sectors 58825952-58826303 (0x3819ce0-0x3819e3f)
logical sectors 58877712-58878407 (0x3826710-0x38269c7)
logical sectors 58695904-58696231 (0x37fa0e0-0x37fa227)
logical sectors 58740320-58741023 (0x3804e60-0x380511f)
logical sectors 58833808-58834127 (0x381bb90-0x381bccf)
logical sectors 56225112-56225847 (0x359ed58-0x359f037)
logical sectors 58221816-58222103 (0x37864f8-0x3786617)
logical sectors 58811336-58811743 (0x38163c8-0x381655f)

File 110661
*******

You could download the nfi.exe utility, if you want to have
a look at this stuff. And see what the before and after looks
like. I would expect, when that file is defragmented,
the first chunk will no longer be at 5441600-5441631. It'll
be moved.

http://support.microsoft.com/kb/253066
http://download.microsoft.com/download/win2000srv/utility/3.0/nt45/en-us/oem3sr2.zip

Using 7ZIP, you can just extract the nfi.exe from that. It runs
in command prompt. It's a 22KB file, so it is pretty small. And
it gives you one more tool, to "look at the world" with.

Paul
Thanks for the info. I take your word for it. Though I also feel that as
MS Word keeps auto-saving the edits to the main file, it also scatters
things into different non-contiguous clusters and sectors. But once the
file is saved under a different name it writes the file using the same
or continuous cluster/sector.

Would I be right in assuming this?
-- choro
 
J

John Williamson

choro said:
Thanks for the info. I take your word for it. Though I also feel that as
MS Word keeps auto-saving the edits to the main file, it also scatters
things into different non-contiguous clusters and sectors. But once the
file is saved under a different name it writes the file using the same
or continuous cluster/sector.

Would I be right in assuming this?
That depends how full your HD is. Word doesn't (In fact no user programs
do) write the file to disc, it just tells the OS that it would like it
written to disc, and Windows deals with the details. If there's a big
enough empty space, the file will be written in one block, otherwise, it
will be written to whatever space is free. Windows normally uses
contiguous blocks of free space first, then fills in the gaps.

When a file is altered, sometimes the additions are written to adjacent
blocks, sometimes not, again it depends on how full your HD is and how
large the additions are.
 
P

Paul

choro said:
Thanks for the info. I take your word for it. Though I also feel that as
MS Word keeps auto-saving the edits to the main file, it also scatters
things into different non-contiguous clusters and sectors. But once the
file is saved under a different name it writes the file using the same
or continuous cluster/sector.

Would I be right in assuming this?
-- choro
As John suggested, if a file is "opened for append", a chunk
can go onto the "end" of the file, but not end up stored right
next to the last chunk. And as you say, that would encourage
fragmentation.

Now, it would be nice to believe, that simply re-saving the
file or copying it, would guarantee no fragments. But what
I would find occasionally, is System Restore would start
doing stuff, at the same time as the copy or save was
happening, and then there'd be fragments again.

If you wanted to try your hand at defragmenting, you
can use the "contig" program from Sysinternals. But even
this program, doesn't guarantee zero fragments on each attempt.
I've had to use this several times on the same file. And
the reason is the same as above - if the OS decides to
do some work at the same instant as you do, the file ends
up fragmented. The nice thing about this program, is you
can defrag one file at a time. This program is not an optimizer.
It doesn't "move the file to the left". It simply tries
to find a series of contiguous sectors, and plops the
file into it, using the Windows defragmenter API. It doesn't
care, if the file ends up out in the middle of the disk,
as long as all the sectors are together.

http://technet.microsoft.com/en-us/sysinternals/bb897428

The operating system defragmenter, can also run into this
kind of "interference" problem. At least with the older
Windows OSes. The defragmenter would "start over" some thing
it was doing, if you interfered with the partition it
was working on. For example, if you were to save
your MSWord file, while the defragmenter was running,
chances are your file would end up some place the defragmenter
was headed for. And it would then have to work out a new
set of plans, for what to do next.

Paul
 
J

John Williamson

Paul said:
As John suggested, if a file is "opened for append", a chunk
can go onto the "end" of the file, but not end up stored right
next to the last chunk. And as you say, that would encourage
fragmentation.

Now, it would be nice to believe, that simply re-saving the
file or copying it, would guarantee no fragments. But what
I would find occasionally, is System Restore would start
doing stuff, at the same time as the copy or save was
happening, and then there'd be fragments again.

If you wanted to try your hand at defragmenting, you
can use the "contig" program from Sysinternals. But even
this program, doesn't guarantee zero fragments on each attempt.
I've had to use this several times on the same file. And
the reason is the same as above - if the OS decides to
do some work at the same instant as you do, the file ends
up fragmented. The nice thing about this program, is you
can defrag one file at a time. This program is not an optimizer.
It doesn't "move the file to the left". It simply tries
to find a series of contiguous sectors, and plops the
file into it, using the Windows defragmenter API. It doesn't
care, if the file ends up out in the middle of the disk,
as long as all the sectors are together.

http://technet.microsoft.com/en-us/sysinternals/bb897428

The operating system defragmenter, can also run into this
kind of "interference" problem. At least with the older
Windows OSes. The defragmenter would "start over" some thing
it was doing, if you interfered with the partition it
was working on. For example, if you were to save
your MSWord file, while the defragmenter was running,
chances are your file would end up some place the defragmenter
was headed for. And it would then have to work out a new
set of plans, for what to do next.
The Defragger in '98 would stop and start over again every time it
needed to use the swap file while reading the FAT of the system drive,
which it was trying to copy to RAM. The only ways I found of getting
round the problem were to run the defragger on the system drive in safe
mode, or keep the system partition small enough for the FAT to fit in
RAM with a bit of room left over. At least that stupidity stopped
happening with the XP defragger.
 
D

Dave \Crash\ Dummy

Ant said:
Speaking of disk defragging in Windows 7. Is the internal the best
one to use or is there a better third party (freeware preferred) to
use?

Thank you in advance. :)
I won't presume to say which program or strategy is "best." I like to
keep my partitions defragged beyond any real practical need, and I use
Defraggler to do it. You will find a long list of free/cheap defragging
tools here:

http://thedatalist.com/pages/Defragging_Tools.htm
 
D

Dave \Crash\ Dummy

I also defrag about once a month. How do you set Windows 7 to defrag
automatically? Thanks.
Open Help and Support and search for "defrag." Item 3 is "Schedule Disk
Defragmenter to run regularly."
 
C

choro

The Defragger in '98 would stop and start over again every time it
needed to use the swap file while reading the FAT of the system drive,
which it was trying to copy to RAM. The only ways I found of getting
round the problem were to run the defragger on the system drive in safe
mode, or keep the system partition small enough for the FAT to fit in
RAM with a bit of room left over. At least that stupidity stopped
happening with the XP defragger.
I know exactly what you are talking about and the advisability of
defragging in the safe mode. But I thought this applied also to Win XP.
I can't remember whether I tried defragging in the Safe Mode with Win 7
but I know that Win 7 defragging is more efficient in the sense that it
doesn't go on forever and ever amen, like in the old days.

Another point not mentioned is that defragging hardly takes any time if
done regularly. The larger the partition and the more fragmented it is,
the longer does the process take.

Tried defragging using Paragon but found it to be a joke. Can't remember
exactly what happened but I remember giving it up and using Win 7's own
defragmenter.
-- choro
 
V

VanguardLH

J. P. Gilliver (John) said:
Yes, but I can't find it in the dark (-:!
That's why the responses are the flashlight to help you find the
switch. >;->
 
J

james

wrote in message
That should be plenty. I believe windows 7 defrags when necessary if
you
set it to do so.
Q

in message
How often should you use Disk Defrag? I now have mine set for once a
month. Thanks.
I also defrag about once a month.
How do you set Windows 7 to defrag automatically?
Thanks.
I don't know why a simple question couldn't be answered simply without
all the clever BS. If you didn't get the answer yet (I didn't follow
the thread to the end. Too much smart assed bullshit) do the
following.

click "Control Panel"
click "Performance information and tools"
click "Advanced Tools"
click "Open Disk Defragmenter"

pick your choices.
 
J

james

"Karen F" wrote in message
How often should you use Disk Defrag? I now have mine set for once
a month. Thanks.
It depends on how much you're adding and deleting. I automatically
let it run once a week at 2 AM.

I like to run Temp File cleaner also, monthly. The first time it will
run a long time (20 minutes maybe) but after that a couple of minutes.
It will free up a lot of space.

Also, I run Ccleaner on the registry monthly.

Your machine will fly.
 
J

Jeff

wrote in message


I don't know why a simple question couldn't be answered simply without
all the clever BS. If you didn't get the answer yet (I didn't follow the
thread to the end. Too much smart assed bullshit) do the following.

click "Control Panel"
click "Performance information and tools"
click "Advanced Tools"
click "Open Disk Defragmenter"

pick your choices.
Thank you James.
 
S

Stephen Wolstenholme

wrote in message


I don't know why a simple question couldn't be answered simply without
all the clever BS. If you didn't get the answer yet (I didn't follow
the thread to the end. Too much smart assed bullshit) do the
following.

click "Control Panel"
click "Performance information and tools"
click "Advanced Tools"
click "Open Disk Defragmenter"

pick your choices.
I think that some people, including myself, consider automatically to
mean 'on demand' rather scheduled.

BTW your list of clicks is not standard on many W7 installations.

Steve
 
J

John Williamson

choro said:
Tried defragging using Paragon but found it to be a joke. Can't remember
exactly what happened but I remember giving it up and using Win 7's own
defragmenter.
I gave up on the Windows defragger years ago, and now use the Auslogics
free one. The latest version has an option to optimise the file layout
on the HD to improve boot times. It made an almost unnoticeable
difference on a fresh install of Windows 7.Incidentally, if you want to generate a "standard" sigfile, its dash,
dash, space, newline, sig. Yours is close, but standards compliant
newsreaders won't automatically delete it when replying.
 
J

james

wrote in message
wrote in message


I don't know why a simple question couldn't be answered simply
without
all the clever BS. If you didn't get the answer yet (I didn't follow
the
thread to the end. Too much smart assed bullshit) do the following.

click "Control Panel"
click "Performance information and tools"
click "Advanced Tools"
click "Open Disk Defragmenter"

pick your choices.


Thank you James.
Happy to help.
 
J

james

"Stephen Wolstenholme" wrote in message

wrote in message


I don't know why a simple question couldn't be answered simply
without
all the clever BS. If you didn't get the answer yet (I didn't follow
the thread to the end. Too much smart assed bullshit) do the
following.

click "Control Panel"
click "Performance information and tools"
click "Advanced Tools"
click "Open Disk Defragmenter"

pick your choices.
I think that some people, including myself, consider automatically to
mean 'on demand' rather scheduled.
I appreciate your understanding of "automatic" and "on demand".
Perhaps this can help.

http://dictionary.reference.com/browse/automatic

au·to·mat·ic
   [aw-tuh-mat-ik]
adjective
1.
having the capability of starting, operating, moving, etc.,
independently
BTW your list of clicks is not standard on many W7 installations.
"Many"? How "many".

It's great to criticize when you haven't contributed.
 
A

Ant

The built-in defragmenter, defragments any file smaller than 50MB in size.
It won't defragment files larger than that.

Consequently, if you're a dyed-in-the-wool defragmenter type person,
you'll want *any* third party defragmenter, rather than the built-in one.
The built-in one solves a pragmatic problem, of only defragmenting
the files that need it. Whereas the third party defragmenter, will
make your drive look "pretty" (in the on-screen map). And that's worth
an extra $39.95.
Wow, built in disk defragger doesn't do big files? Hmm, I have several
huge files (GB sizes) like VMware Workstation images that might be
heavily fragmented from three years of usage. :( I prefer not to pay for
one since I rarely defrag.
--
"I used to command a battalion of German ants." --Tom
/\___/\ Ant(Dude) @ http://antfarm.ma.cx (Personal Web Site)
/ /\ /\ \ Ant's Quality Foraged Links: http://aqfl.net
| |o o| |
\ _ / If crediting, then use Ant nickname and AQFL URL/link.
( ) If e-mailing, then axe ANT from its address if needed.
Ant is currently not listening to any songs on this computer.
 
A

Ant

I won't presume to say which program or strategy is "best." I like to
keep my partitions defragged beyond any real practical need, and I use
Defraggler to do it. You will find a long list of free/cheap defragging
tools here:

http://thedatalist.com/pages/Defragging_Tools.htm
That is a lot. I will try those freewares. FYI, I have many big files
like VMware Workstation's images.
--
"When I am at my lowest, that is when I see things the clearest. It's
hard to care about ants when you're soaring with eagles." --unknown
/\___/\ Ant(Dude) @ http://antfarm.ma.cx (Personal Web Site)
/ /\ /\ \ Ant's Quality Foraged Links: http://aqfl.net
| |o o| |
\ _ / If crediting, then use Ant nickname and AQFL URL/link.
( ) If e-mailing, then axe ANT from its address if needed.
Ant is currently not listening to any songs on this computer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top