LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-22-2009, 04:51 PM   #1
BumbleBee
LQ Newbie
 
Registered: Jul 2009
Distribution: Fedora Core 11
Posts: 28

Rep: Reputation: 15
Drive Defragmentor Linux Fedora Core 11


Hi, I have been a Linux user for a maybe a month now. I am quite new and I am just starting to get the hang of things. Well my question was simply is there a hard drive defragmenter software for Linux? I am currently using Linux Fedora Core 11 32-bit. I did tons of research on google and everywhere I go, it always says "You dont need to de-fragment Linux since it has a smart file system." , however I really need a software utility that can be installed and works for Linux for other purposes. If anybody can please give me a link or a suggestion to a software utility that allows de-fragmentation.
-Maybe this information might help for the software choice.
-If I open up system monitor and click on the file systems tab, it says 193.7mb is ext3 and 19gb is ext4. So I am guessing the main file system of my OS is ext4.
-Also I might as well mention this in this post, are their any free-ware virus scan programs similar to malwarebytes anti-malware for Linux? I know Linux doesn't really need it but I do, if you know any please mention it.

--Any help would greatly be appreciated.
-Bumblebee
 
Old 08-22-2009, 05:07 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
For drive defragging, you will need to use fsck (in a terminal type man fsck to see the options). For an antivirus program, try clamav or just do a search online for "linux antivirus program".
 
Old 08-22-2009, 05:16 PM   #3
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Damn, typed up a whole post and reloaded. Here goes again:

Based on your request, I am guessing that you're coming from Windows. Needing to stop operations and defrag the disk isn't some fact of computers; it's the kludge that fixes deficiencies in Microsoft's filesystems. The ext* filesystems are smart enough to generally prevent the whole thing from getting that screwed up in the first place. Try `yum search defrag`; one package comes up and it is not a defragmenter. The fact that, in this world full of hackers, no one has found an ext* defragmenter a sufficiently worthwhile project to get it into the repos of one of the largest distros should tell you something. Why do you think you need this?

I can tell you with 99.9% certainty that this is what your partitioning looks like:
19 GB ext4 = root filesystem; contains everything (except what's on the next line), including your home directory
193.7MB ext3 = /boot; contains configuration for grub (the menu before you boot) and the actual binary images of your installed kernels

Similarly, Linux just doesn't really need antivirus most of the time. Linux has what they call a 'competent security model'; privileges are separated and so it's much more difficult to get into the computer or do anything bad once you're in. Linux AV does exist - Clam AV, maybe? - but I believe that's more targeted at mail servers and checking for Windows viruses before sending mail along. If you are really interested, look into rkhunter and chkrootkit, but understand that you are not in any danger by not having them.


XavierP: Correct me if I'm wrong, but I don't think fsck does any defragmenting, at least on ext* filesystems. Its purpose is to maintain filesystem consistency and recover data when references to it are lost.

Last edited by karamarisan; 08-22-2009 at 05:17 PM.
 
Old 08-22-2009, 05:37 PM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
From my understanding The reason their is not a need for defragmenters is due to the way the file system writes its files in windows fat / fat32 / and ntfs. Ext 3 / 4 both use a preallocation method for files while windows writes in a contiguous method.

Also XavierP is correct in that fsck will show the amount of fragmentation on a unix / linux system.

EDIT

Also forgot to mention that Linux / Unix goes a step ahead by reserving adjacent blocks for future expansion of the file.

Last edited by jstephens84; 08-22-2009 at 05:38 PM.
 
Old 08-22-2009, 05:42 PM   #5
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Quote:
Originally Posted by jstephens84 View Post
Also XavierP is correct in that fsck will show the amount of fragmentation on a unix / linux system.
Er, are we all using the same fsck? Output, please.
 
Old 08-22-2009, 05:46 PM   #6
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
Code:
FSCK(8)                                                                FSCK(8)

NAME
       fsck - check and repair a Linux file system
First line of the man page.
Code:
DESCRIPTION
       fsck is used to check and optionally repair one or more Linux file sys‐
       tems.   filesys  can  be  a device name (e.g.  /dev/hdc1, /dev/sdb2), a
       mount point (e.g.  /, /usr, /home), or an ext2 label or UUID  specifier
       (e.g.   UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).  Nor‐
       mally, the fsck program will try to  handle  filesystems  on  different
       physical  disk  drives  in  parallel to reduce the total amount of time
       needed to check all of the filesystems.

       If no filesystems are specified on the command line, and the -A  option
       is  not  specified,  fsck  will  default  to  checking  filesystems  in
       /etc/fstab serially.  This is equivalent to the -As options.
And the rest. A 10 second scan of Google suggests that people are using it on ext4 systems, though I don't use fsck (except for the automated checks after a number of reboots) and have no experience of ext4, so I can't say how or how well it all works on those systems. Historically, it's been used as the Linux equivalent to scandisk and defrag.
 
Old 08-22-2009, 05:53 PM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by karamarisan View Post
Er, are we all using the same fsck? Output, please.
If you boot using a live cd do

Code:
fsck /dev/<your device here>
at the very end you will see output and one of those lines will read (11674 frags, 15189 blocks, 1.6% fragmentation) Course those are just specific figures to another system of mine. Yours may very.
 
Old 08-22-2009, 06:43 PM   #8
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
What distro is this, and what filesystem are you getting that output from? I have never seen that output from any fsck (note that fsck is a do-nothing helper program that calls fsck.whatever to do the real work).
 
Old 08-22-2009, 06:48 PM   #9
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
First, fsck is a consistency checker, not a defragmenter. It does *show* the fragmentation index, but nothing else, and I would really hate that. fsck is meant to be fast. I wouldn't like to have to wait 8 hours to fsck a 1tb drive at boot time. There have been some attempts at creating a defragmenter, right now you could check this one which is fs-agnostic:

http://vleu.net/shake/

However, I doubt you really need to defragment anything. You will usually get no gain of that unless you are in very very extrema circumstances. The reasons why linux doesn't suffer from fragmentation issues (usually) is that the fs's act more efficiently, and the in-kernel i/o scheduler does a good job at keeping the i/o operations ordered in a sane fashion so there are no useless disk seeks.

So, there are two separate issues here: the fs's fragment less, and the fragmentation -even if it happens- really doesn't harm your performance.



Second, in which regards malware checkers, you should worry about rootkits mostly, rkhunter and chkrootkit can take care of that. There are some AV softwares in linux. ClamAV seems to be the de-facto standard and it integrates greatly with most tools, like kmail or sylpheed, and many others.

PS. There's work in progress to design both a tool and an online defragmenter for ext4, certainly this would make no sense if fsck was able to defragment, would it? Plus the concepts of "repair" and "defragment" are vastly different, a fragmented fs is not broken, it's just sub optimally distributed

Last edited by i92guboj; 08-22-2009 at 06:51 PM.
 
Old 08-22-2009, 07:31 PM   #10
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
@i92guboj - good point, well made. As I said, beyond the auto checks I have never used fsck, but I do remember it being recommended in years past whenever someone asked about a defragger. I stand corrected

@BumbleBee - you obviously have a very specific need here, can you enlighten us? That way we can properly recommend tools to you.
 
Old 08-22-2009, 07:47 PM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by XavierP View Post
@i92guboj - good point, well made. As I said, beyond the auto checks I have never used fsck, but I do remember it being recommended in years past whenever someone asked about a defragger. I stand corrected
I've also thought that in the past, it's a widespread belief and it's not strange to think that when you see that info at the end of the fsck report. So it's not your fault at all. But when you stop and think a bit you notice that it would be a really poor defragger when after being run it reports the /boot drive as being 73% fragmented or the like when it's full (which is not so strange when it lives on its own partition).
 
Old 08-22-2009, 07:57 PM   #12
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
Just one of those things that I read and never really thought about, I guess. Having said that, there is evidence of the question being asked here in 2003 and fsck being suggested. This could be one of those thing that never goes away!
 
Old 08-22-2009, 10:19 PM   #13
BumbleBee
LQ Newbie
 
Registered: Jul 2009
Distribution: Fedora Core 11
Posts: 28

Original Poster
Rep: Reputation: 15
-Well...I am well aware that ext4 is smarter then ntfs and that virus aren't a problem for linux. BUT!, my computer is a dual boot. I have Linux Fedora Core 11 32-bit and Microsoft Windows Xp Home Edition 32-bit Service Pack 3. Therefore, since an anti-virus scanner in windows xp cant scan the core OS files that are being used, I wanted to see if I could scan my windows os from linux while my windows was completely dormant which would technically give me a much more thorough scan. ITs not about linux, its about windows. However if it doesn't work, I would still like to have an anti-virus and defragmentor to see for myself. I mean i am really new to linux (have been a windows user all my life) and curiousity keeps getting the better of me with this linux and i want expiriment and see for myself. I hope you understand.

-As for anti-virus I actually found avg for linux, I downloaded the .rpm file, installed it and all that. However i dont know how to open it up so i can update it and do scans with it and stuff. Can anyone help me on where to find the program and how do i know wether it running realtime and protecting me, is there like a task mananger here?

-Thank for your help, I will try your suggestions and report back tomorrow. Your help is really apprieciated.
 
Old 08-22-2009, 10:56 PM   #14
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
I applaud your desire to explore and learn by trying things (r--t knows we need more of that), but at least on the defrag thing, there just isn't really anything for you to work with. Don't worry about it. It's like you've bought your first automatic after driving stick your whole life and you're looking for the clutch. If you want to learn about your new transmission, there's plenty of info out there. Try this link - kinda technical, but if you need help understanding it, we do that, too.

By the way, I checked the defragger i92guboj linked to. I haven't examined the source, but based on the author's page, you can tell how it works. As he said, it is filesystem-agnostic, which immediately tells you it's not analogous to the Windows defragger. The latter operates by diving into the fs, looking for fragmented files, and repairing them by moving data around and modifying the fs directly. This shake program appears to work by looking at files, taking a guess as to how likely they are to be fragmented based on attributes like size and when they were last modified, and then copying the ones it deems in need and changing the reference to the copy (the effect of which is to get the data together and in order). It does a little more than that, but hopefully you can tell why these two are not the same thing.

I don't know anything about scanning Windows from Linux, because the only Windows I keep around is one install for games and that isn't worth protecting. You'll have to research that one yourself if you really want to spend time on that. That said, the people who make AV software for Windows know what the limitations are, and since their products are (to at least some degree) effective, I assume they've worked around them.

Run `rpm -ql <package name>` to get a list of the files that were installed by an rpm (e.g., amarok-1.4.10.fc11.x86_64.rpm becomes amarok). You can look for things in /bin, /usr/bin, etc. and find the actual binaries, which you can then run with --help or run `man <whatever the binary is called>` to get some info. However, in this case, it might be easier to just go the author entity's website and read the documentation there.

Again, though, Linux is not Windows, and the truism about never running without AV software just isn't so true here. There are plenty more things you could spend your time learning about that you would get more utility out of. For example - it's never too early to get comfortable working in a command-line environment. I'd suggest you worry less about what you learned in your Windows days and about how to use Linux to better your Windows installs and start checking out all the cool things Linux has to offer. Honestly, once you learn how to use this, you never want to go back.

Last edited by karamarisan; 08-22-2009 at 10:58 PM.
 
Old 08-23-2009, 02:36 AM   #15
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
Quote:
Originally Posted by i92guboj View Post
There have been some attempts at creating a defragmenter, right now you could check this one which is fs-agnostic:

http://vleu.net/shake/
That's not the result of that namedropper guy (tmcco) that got into it with everyone here and then got Mr. Ts'o to come in and make some comments is it? It looks suspiciously like it from the description. In any case, I'd be wary of anything that is supposed to defrag a filesystem using userspace commands (i.e. just copying files).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I install a linux fedora core 9 on a hard drive that already have windows xp muasif80 Linux - Newbie 1 10-05-2008 08:47 AM


All times are GMT -5. The time now is 08:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration