Disk defragmentation __linux under Linux

Source: Internet
Author: User
Defragmentation of disk under LinuxSome posts on the web say that XFS does not need to be defragmented, but it is wrong. XFS, such as delayed write technology, can actually reduce fragmentation, but if the server is in use for several years, and the file operation is more frequent, it will be fragmented and should be sorted. Note: The XFS-related commands in Debian are in the Xfsprogs package, and the XFS_FSR command is in the Xfsdump package. So to use XFS_FSR to defragment, remember to install Xfsdump package. In other Linux distributions, packages that contain XFS-related commands should also be called similar names and Google yourself.
Xfsdump-administrative Utilities for the XFS filesystem

XFSLIBS-DEV-XFS filesystem-specific static Libraries and headers

Xfsprogs-utilities for managing the XFS filesystem



First, view the fragments

1, view the/DEV/SDC1 of the debris situation:

# xfs_db-c Frag-r/DEV/SDC1

Actual 93133, ideal 8251, fragmentation factor 91.14%
This should clean up the pieces:)


2, view the/dev/sdb1 of the debris situation:

# xfs_db-c Frag-r/DEV/SDB1

Actual 905607, ideal 900507, fragmentation factor 0.56%
This doesn't have to be defragmented.


3. Another form of command:

# Xfs_db-r/DEV/SDD1
Xfs_db> Frag
Actual 117578, ideal 116929, fragmentation factor 0.55%


4, can also through the Xfs_bmap command to understand the situation of a file:

# xfs_bmap-v Case19.dat
Case19.dat:
Ext:file-offset Block-range AG Ag-offset Total
0: [0..9551]: 592061576..592071127 1 (103696496..103706047) 9552
1: [9552..86039]: 599312816..599389303 1 (110947736..111024223) 76488
2: [86040..170399]: 599655400..599739759 1 (111290320..111374679) 84360
3: [170400..256799]: 599751632..599838031 1 (111386552..111472951) 86400
&NBSP, Nike TN; 4: [256800..340079]: 1185490752..1185574031 2 (208760592..208843871) 83280
5: [340080..592703]: 1185577976..1185830599 2 (208847816..209100439) 252624


Ii. Organizing Fragments

# XFS_FSR/DEV/SDC1

Third, he obtained the benefit from the XFS_FSR:) (Excerpt from http://www.linux.com/feature/141404)

wow! Hi, That's l teach me to use a non-default tech without researching it.
Over the years, I MythTV box had gotten inexplicably slow with lots to disk access for many operations like starting Back to a recorded video. With the advice, I measured 98.6% fragmentation. A Few sample files I checked that were 1-6GB captured MPEG-2 videos were the on over stored 30,000
After 2 nights of the de-fragmenting, I ' m down to 17% fragmented and startup time of playing a-video-noticeably with Less hard drive activity.


Iv. Reference
http://www.linux.com/feature/141404
Http://www.nekochan.net/wiki/index.php/XFS_defragmentation
http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=/usr/share/catman/a_man/ Cat1/fsr_xfs.z

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.