scandisk & defrag in linux
Results 1 to 9 of 9

Thread: scandisk & defrag in linux

  1. #1
    Join Date
    Nov 2000
    Location
    buenos aires
    Posts
    335

    scandisk & defrag in linux

    i was wondering what is the linux equivalent of windows `scandisk` and `defrag`. i know there is something called `fsck`, or in my case `ef2sck`; but all the documentation that i found says that the program must run in an unmounted file system.
    my doubt is, if i keep my machine running for a long time, i can`t execute that program, right? or is there a way of running it?
    also, what about a defragmentor for linux? is there any, what is it named? is there any restriction to its execution as in `fsck`?
    thank you very much.

  2. #2
    Join Date
    Jun 2000
    Location
    Bethlehem, PA, USA
    Posts
    646
    There is a program to defrag ext2 partitions, but it is risky. Generally, the ext2 filesystem does a good enought job that you do not need to run a defrag utility.

    fsck can be used to check your ext2 paritions, but you seldom need to do so unless your system crashed (which most distros have fsck run automatically then). You can run it manually, just do not run it on a mounted disk.

  3. #3
    Join Date
    Nov 2000
    Location
    buenos aires
    Posts
    335
    thanks danns, but, even if i want to, how do i unmount a file system?
    i know how to unmount a floppy disk, but, sorry, this seems pretty weird to me.
    i have my linux system on one hd -/dev/hda-, how can unmount that while is running?, and if i can do that feat, how can i re-mount it? if i unmount that, i no longer have an os running.

  4. #4
    Join Date
    Jun 2000
    Location
    Bethlehem, PA, USA
    Posts
    646
    You can boot into linux single mode by typing the label of your desirec OS at your boot loader prompt and adding single. For instance, i fyou are using lilo and the image you want to boot is labeled linux:

    linux single

    You can also umount / by dropping to run level 1. As root type:

    init 1

    at the command line, then

    umount /

  5. #5
    Join Date
    Mar 2000
    Location
    Elyria, Ohio - USA
    Posts
    2,075
    My 2 cents worth.

    When you go down to init level 1, just calling init 1 is not good enough, since it doesn't sync your disks. The two preferred methods are:

    sync; sync; sync; init [1 or S]

    or

    shutdown 0

    The sync command insures that all buffers and such are flushed to disk, keeping all file systems happy happy. shutdown does this for you. The 0 after shutdown just says that you want to do it NOW.

    In order to restart your system into multiuser mode, type

    sync; sync; sync; init [2-5]

    depending on your default init level, which you can find out, if you don't know, with:

    grep init /etc/inittab

    As far as the umount /, although umount doesn't complain, you can not umount /. If you did, you couldn't get to the /bin or /etc directories for the root commands you need for fs maintenance.

    If you feel you need to do an fsck, do:

    shutdown -r -F 0

    This tells shutdown you want to reboot and force an fsck upon reboot. This is a far safer method of fsck'ing, especially if you only have the one / partition.

    As far as keeping your system up, as long as you don't do something really stupid, your box can stay up indefinitely.

    ------------------
    If it ain't broke, fix it till it is.
    If it ain't broke,
    Fix it till it is.

  6. #6
    Join Date
    Nov 2000
    Location
    buenos aires
    Posts
    335
    thank you very much, both of you.
    bottom line, i can`t execute a `fsck` while linux is up, and there is no need for defragmentation, the file system does a very good task in that regard.
    let me ask you another thing, what about `badblocks`, can i execute that on a mounted file system? is there naything special i should know about it?
    thanks in advance.

  7. #7
    Join Date
    Mar 2000
    Location
    Elyria, Ohio - USA
    Posts
    2,075
    Personally, I wouldn't run badblocks, unless I had some compelling reason to do so. Especially since, in the BUGS section of the badblocks manpage, the developer says:

    I had no chance to make reals tests of this program since I use IDE drives which remap bad blocks. I only made some tests on floppies.
    Since he appears not to trust this program on his own hard drive, I don't see why you would. -mk

    ------------------
    If it ain't broke, fix it till it is.
    If it ain't broke,
    Fix it till it is.

  8. #8
    Join Date
    Nov 2000
    Location
    buenos aires
    Posts
    335
    you have a nice valid point there, thanks.

  9. #9
    Join Date
    May 2000
    Location
    Calgary, AB, Canada
    Posts
    508

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •