红联Linux门户
Linux帮助

Linux 'scandisk' and fragmentation

发布时间:2008-01-27 01:15:20来源:红联作者:Axflue
Collated: Mike Andrew / Net Llama

For windoze-refugees, two questions are FAQ when it comes to files and hard drives.

Defragmenting

Short answer? You don't, you can't, you don't have to, stop reading.

Longish answer:

The extfs (extension 2 file system) that Linux OS operates under is resistant to fragmented files. Fragmenting happens when a file (of any size) will not 'fit' in a single space on the hard drive. A single space means a continguous linear range of sectors. Instead, the file is broken up to fit in a number of spaces on the hard drive. These 'spaces', and their size, occur randomly on a windoze file system as files are deleted. The reason why fragmentation is a bad thing (tm), is that reading linear sectors is AT LEAST 1000 x faster than seeking over an entire disk surface.

To put it very simply, while not entirely accurate, Linux will NOT split a file over a disk surface, instead, it finds the most appropriate space.

'Scandisk'

Windows refugees soon come to terms with the Linux equivalent: fsck. If only because, it runs each time the machine is booted.

That's where the similarities end.

Scandisk is designed to give you the warm fuzzies on a file system that most applications can seriously damage if they misbehave.

fsck is a tool designed to seriously damage the file system, if the super user misbehaves.

Linux is about security. Not even the super user can willy nilly scribble over a mounted partition.

to do so:

From NetLlama

> I would like to run fsck on my root directory without having to reboot.
> Could someone tell me if this is possible and if so, how do do it?

Sure its possible. (re)Booting has really no relationship to running fsck. Remount / as readonly:

mount -o ro,remount /

THen run the fsck as normal. When done, remount / as read-write:

mount -o rw,remount /

ANd you're done.
文章评论

共有 0 条评论