fsck reports 18905 non-contiguous files (20.9%) and 40 non-contiguous directories (0.0%) on an ext4 file system so I would really like to defragment it. Is there any way?
fsck reports 18905 non-contiguous files (20.9%) and 40 non-contiguous directories (0.0%) on an ext4 file system so I would really like to defragment it. Is there any way?
Make really, really, really sure that the file system is not mounted. usually boot from install disk. Then run this command:
X= Your partition infoCode:fsck.ext4 -P /dev/sdXX
Of course for further info just type this:
Code:man fsck.ext4![]()
Fedora20 AMD X6 1090T - 8GIG RAM - Nvidia GTX-650 - LXDE. Linux since 1995 - No Gnomes allowed.
Mythbuntu - Mythtv .27 - AMD 6core- 8 gigs ram Nvidia GTX-650 Ceton 4 port tunner
Mint 17 64bit - Dual Core AMD 5200 2gig ram -GT 9400
Galaxy Blaze 4G ICS ClockworkMOD :)
He wants to defrag the files and dir's.
I think the issue is very mute and he would need to know what file are involved.
#e2freefrag /dev/mapper/VolGroup-LogVol will show he extent sizes with numbers
#frrefrag /home/useryou/Documents/* shows fragmetaion of files; drill down as needed
man pages available,
#e2defrag or online defrag or background defrag is not installed.
There may be one that works, it may need kernel patches and compiled, and it may contain bugs.
But officially, there is no ext4 defrag yet.
SJ
Do the Math
waterfoul, disregard my above post, review the e2freefrag instructions by SlowJet.
man 8 e2freefrag
I misunderstood about wanting to do a fsck, deleting my post now.![]()
Last edited by diamond_ramsey; 28th October 2009 at 08:20 AM.
2 dual cores, 11 GB RAM, F18 Spherical Cow - 3.11.10-100.fc18.x86_64 / i686
2 dual cores, 11 GB RAM, F19 Schrödinger's Cat - 3.14.25-100.fc19.x86_64 / i686
2 dual cores, 11 GB RAM, F20 Heisenbug - 3.17.4-200.fc20.x86_64 / i686
2 dual cores, 11 GB RAM, F21 - 3.17.4-300.fc21.x86_64 / i686
80 x86_64 computing cores, 144 GB RAM & 8 SATA Seagate 7200.12 500 GB harddisks
i use this command in root prompt , but its say unable to umount the disk error
i wanna defrag to root filesystem drive
ASUS M3N78-EM, AMD Phenom™ X4 Quad-Core 9650+, 6GB DDR2 RAM, 160GB x 2 RAID0 HDD, Nvidia Geforce8300 Hybrid SLI
Run @ Fedora12 x86_64,& Windows7 Ultimate x64
[SIGPIC][/SIGPIC]
(Akmods-nvidia @ rpmfusion)
R.Mathan MCA, MCITP, MCTS
To manually defrag or fsck root you want to boot a live CD or similar and manipulate the umounted filesystem.
Of course you can't unmount the root filesystem when it's in use. Boot from a LiveCD and try it that way.
You're actually better off backing up your drive, reformatting and restoring. Linux normally spreads files out all over the drive, both to avoid fragmenting and to lower the average seek time. Defragging packs them all at one end, the way Windows stores them. Not only do they get fragmented faster, the average seek time goes up. Backing up, nuking and restoring keeps them spread out, the way they're supposed to be. HTH, HAND.
Registered Linux user #470359 and permanently recovered BOFH.
Any advice in this post is worth exactly what you paid for it.
If you want to defrag/check the root file system do this:
1. touch /forcefsck
2. reboot
The file forcefsck will cause a file system check at boot time.
Jim
actually, with ext4, you can defrag while online (mounted)
just use the e4defrag program (included in the e2fsprogs package.)
just run:
e4defrag /dev/sdXx (where sdXx is the partition of the filesystem you wish to defrag, like sda4)
The forcefsck at boot will check the filesystem, but won't defrag it.
Edit:
Forgot to mention that you have to run e4defrag with the -test parameter for now, since it isn't a fully tested version. it requires the -test parameter, I guess just to make certain that you realize it's still a test version.
Last edited by DBelton; 27th December 2011 at 06:19 PM.
Something to consider: the disk someone wants to defrag may be virtualized. My goal is to minimize the rolled up size of an entire virtual machine. I could zero out all the unused file space, but then the unrolled machine will take up all the space of the virtual disks with real zeros. So, yes, I really do want to move all the data to one end of the virtual disk. Then I can shut the virtual machine down and run a virtual machine host tool to delete the unused file system pages. viola' my machine image is smaller. I do wish my e2fsprogs actually did have the e4defrag thingy......
Yes, that will work, right up to the moment when you need to write something to that partition, such as a new kernel, and you find out that there's no room because you've very cleverly removed all of the free space. Some things really are better left alone.
Registered Linux user #470359 and permanently recovered BOFH.
Any advice in this post is worth exactly what you paid for it.
Compacting the files has no effect on that. These are unroll-often, ugrade-rarely VM's. So trans-global distribution time is actually an issue. OS upgrades causing fragmentation, not so much. I also realized you thought I would resize the partition. Nope. Just compact the data so it both uses less host disk space and compresses better.
Can't you just copy the files to a new virtual drive?