Is it worth it? there is e2defrag. How long will it takes for 120GB? 8h will be enough?
I would like to improve read/write on the hard disc. hard disc seems to be new(9 months old). its in my work machine, i'm java programmer.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
What are your read/write rates? How much of an increase are you looking to gain? You probably won't get that much of an increase out of defragmenting.
The time needed for defragmenting your data will very much depend on the rate of fragmentation, amount of files and read/write speeds of your disk and other speed-factors of your hardware. 8h should be enough, but I can only guess.
Fragmentation is always an issue, but ext2/3/4 reserve some space to make sure they are able to write data in one go instead of always having to scatter it around. You can check how much space is reserved with
tune2fs -l /dev/<your device> | grep -i reserve. Reducing the reserved amount will likely increase fragmentation over time, while increasing the reserved amount will likely not help to decrease fragmentation further.
If you need to increase your read/write, maybe operating over a ramdrive will help for scenarios where you don't have too much data but a lot of small files. Also you may want to check SSDs out to increase your r/w.
Also refer to this answer for information on fragmentation.
I'm assuming that you aren't actually using ext2, but rather ext3 or ext4. Both are quite good at avoiding fragmentation, especially ext4. As a result, you almost certainly will not notice any difference after running e2defrag. As for how long it will take; that depends entirely on how much data it has to move. The first time you run it can take some time, but subsequent runs should be very fast. It is quite possibly one of the fastest defrag algorithms there is, though an unsafe one; if it is interrupted in the middle, you can kiss your filesystem goodby.