Hi, Do you have to defragment and clean up a hard drive in Ubuntu Linux like you do with Windoze? As i can't find anything that looks like it at present.
Barry
On 31/07/07, Barrys linux mail bazubuntumail@tiscali.co.uk wrote:
Hi, Do you have to defragment and clean up a hard drive in Ubuntu Linux like you do with Windoze? As i can't find anything that looks like it at present.
Barry
No, not really. In fact, you don't really need to do that in Windows XP with the NTFS filesystem, anymore. It's a hangover from the Windows 9x FAT32 days ...
The equivalent in Linux is fsck, which will run automatically about the 30th time a partition is mounted on boot-up. Generally, it doesn't do anything tho - it just checks for errors.
If you're running Ubuntu, I wouldn't worry about it.
Peter.
samwise wrote:
On 31/07/07, Barrys linux mail bazubuntumail@tiscali.co.uk wrote:
Hi, Do you have to defragment and clean up a hard drive in Ubuntu Linux like you do with Windoze? As i can't find anything that looks like it at present.
Barry
No, not really. In fact, you don't really need to do that in Windows XP with the NTFS filesystem, anymore. It's a hangover from the Windows 9x FAT32 days ...
WHAT??!!!!!!!!!
Sorry, massive disagreement from here... NTFS fragments dreadfully, take a look after a defrag, then say, install MS Office, then take another look.
Cheers, Laurie.
On Tue, 2007-07-31 at 18:24 +0100, Laurie Brown wrote:
WHAT??!!!!!!!!!
Sorry, massive disagreement from here... NTFS fragments dreadfully, take a look after a defrag, then say, install MS Office, then take another look.
Warning..long answer ahead
NTFS does still suffer from fragmentation problems, not as badly as FAT as the filesystem logic is a bit cleverer about block allocation. Part of the illusion of NTFS coping better is that modern disks cope better..but there is an improvement over FAT for sure
ext2/3 also suffer (it is the non contiguous value you get when you run fsck) however the problem is far less rampant and usually only happens on really old (and heavily modified when full) partitions. There are no stable tools I know of to fix fragmentation on ext2/3 and given how small the problem is there are unlikely to ever be any. ext suffers a lot less than FAT as it pre-allocates blocks beyond a given file length to allow for future growth. This however does not deal with the fragmentation problems you get on a nearly full filesystem which is why for optimum performance it is good to run ext2/3 with some free space.
If you do get into a problem with fragmentation (which is highly unlikely as generally the non contiguous value stays below say 5%) then the only completely safe fix I am aware of is to copy the data off and reformat.
Even in the cases of heavy fragmentation on Linux the performance impact is almost negligible compared to the days of MSDOS due to the way that modern kernels access information on a drive. MSDOS and old versions of Windows assumed single user, single process, single file, disk access. and so only retrieved what it needed from the disk. Linux on the other hand retrieves pretty much whatever passes under the drive head and it can hold in cache (using spare memory) whether it thinks it needs it or not..given that most file fragmentation happens over a small block of clusters there is a very reasonable chance that the rest of the fragmented file is already in cache as the heads made their way to what was requested.
Most if not all of this is also done in NTFS and modern NT kernels, so although NTFS does become fragmented (and generally more so than Linux filesystems) the actual performance benefit of correcting it is not as obvious as in the days of FAT
On 31-Jul-07 16:33:02, Barrys linux mail wrote:
Hi, Do you have to defragment and clean up a hard drive in Ubuntu Linux like you do with Windoze? As i can't find anything that looks like it at present.
Barry
Just to clarify a bit on other replies.
As Samwise said, fsck will be automatically run around every 30th reboot. You can also force it to run if you shutdown with the command
shutdown -F -h now
which brings the system to a halt. The "-F" causes 'shutdown' to plant adummy filename which is picked up next time the system boots, and triggers the fsck.
Or you can do
shutdown -F -r now
which forces an immediate reboot. (For normal use, omit the "-F"). [why do I always hit the wrong keywhen I type that command?]
Again as Samwise said, fsck will check for any file-system errors, and correct them. Normally there are none.
As far as I know, fsck (in whatever version is appropriate for your type of file-system) does nothing about "fragmentation". It will, however, report what amounts to the degree of fragmentation which exists in the partition it is checking, as "% non-contiguous".
On Linux systems, this number is usually very small, and stays small, because of efficient file-system design. Even under heavy usage over years, it is unlikely to rise above 2-3%.
For example, on a 4GB "/" partition which is almost full (18MB free) which I have been using heavily and continuously for about 4 years, I get the result:
155184/469568 files (1.3% non-contiguous), 885935/937432 blocks
while on another 20GB "/" partition which is nearly full (350MB free), again heavily and continuously used for about 6years, I get
214794/2420096 files (1.8% non-contiguous), 4501788/4831548 blocks
all of which is extremely healthy!
So much is fragmentation a non-issue with Linux that only recently has there been a "defrag" project:
http://defragfs.sourceforge.net/
My Red Hat 9 system (first example above), from aound 2003, has 'defragfs' installed (not that I've ever used it). My other, older systems (one is the second example above) do not have 'defragfs' at all, and I've never even thought of wanting to defrag!
Best wishes to all, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 31-Jul-07 Time: 19:03:59 ------------------------------ XFMail ------------------------------