Skip to contentSkip to conversation

cannot defrag volume, fragmentation factor 21.73%

DISCUSSION Richard Ems 4 participants 9 messages Oct 18, 2010 – Oct 22, 2010

lore
Share & tools
lore
#0 lore raw

Hi all,

this is on openSUSE 11.3.

# uname -a
Linux fs1 2.6.34.7-0.3-default #1 SMP 2010-09-20 15:27:38 +0200 x86_64 x86_64 x86_64 GNU/Linux
# echo frag | xfs_db -r /dev/disk/by-label/data1
xfs_db> actual 6451844, ideal 5050129, fragmentation factor 21.73%
# xfs_db -V
xfs_db version 3.1.2
# xfs_fsr -V
xfs_fsr version 3.1.2
# df -h /dev/sdb1
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1              17T   13T  4.3T  75% /data_1

The volume is new, 12TB were rsync'ed from another volume, some new files came after the sync.

I ran several times xfs_fsr, but the 21.73% factor stays there.
There where some busy or modified files on which I started xfs_fsr later again, but this ones where small files and the 21.73% is still there.

Any ideas?

Richard

Signature · 12 lines
Richard Ems       mail: [email protected]

Cape Horn Engineering S.L.
C/ Dr. J.J. Dómine 1, 5º piso
46011 Valencia
Tel : +34 96 3242923 / Fax 924
http://www.cape-horn-eng.com

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 1 line · On Montag, 18. Oktober 2010 Richard Ems wrote:

I ran several times xfs_fsr, but the 21.73% factor stays there.

Possibly you have some very big files which cannot be defraged? What output does xfs_fsr -v give?

Signature · 13 lines
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc

it-management Internet Services
http://proteger.at [gesprochen: Prot-e-schee]
Tel: 0660 / 415 65 31

****** Radiointerview zum Thema Spam ******
http://www.it-podcast.at/archiv.html#podcast-100716

// Wir haben im Moment zwei Häuser zu verkaufen:
// http://zmi.at/langegg/
// http://zmi.at/haus2009/

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 7 lines · Michael Monnerie
Quoted 1 line · On Montag, 18. Oktober 2010 Richard Ems wrote:

I ran several times xfs_fsr, but the 21.73% factor stays there.

Possibly you have some very big files which cannot be defraged? What output does xfs_fsr -v give?

There are no very big files, surely some with a couple of GBs but not more. All files are defragmented.

Attached the gzipped output of 3 runs of xfs_fsr generated with the command:

{ set -x ; for i in 1 2 3 ; do date ; echo frag | xfs_db -r /dev/disk/by-label/data1 ; date ; xfs_fsr -v /data_1/ ; date ; echo frag | xfs_db -r /dev/disk/by-label/data1 ; date ; done ; set +x ;} > ~/logs/defrag/data1/xfs_fsr-HOME-2010.10.18-1.log 2>&1 &

Thanks, Richard

Signature · 7 lines
Richard Ems       mail: [email protected]

Cape Horn Engineering S.L.
C/ Dr. J.J. Dómine 1, 5º piso
46011 Valencia
Tel : +34 96 3242923 / Fax 924
http://www.cape-horn-eng.com

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 2 lines · On Montag, 18. Oktober 2010 Richard Ems wrote:

Attached the gzipped output of 3 runs of xfs_fsr generated with the command:

All files reported have "after:1", so where does the fragmentation come from? Interesting. Maybe a umount;mount helps? Could be the info is just wrong until a remount?

Signature · 13 lines
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc

it-management Internet Services
http://proteger.at [gesprochen: Prot-e-schee]
Tel: 0660 / 415 65 31

****** Radiointerview zum Thema Spam ******
http://www.it-podcast.at/archiv.html#podcast-100716

// Wir haben im Moment zwei Häuser zu verkaufen:
// http://zmi.at/langegg/
// http://zmi.at/haus2009/

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
In reply to Richard Ems

Richard Ems put forth on 10/18/2010 7:09 AM:

Quoted 5 lines

I ran several times xfs_fsr, but the 21.73% factor stays there. There where some busy or modified files on which I started xfs_fsr later again, but this ones where small files and the 21.73% is still there.

Any ideas?

Yes. The answer is in a thread in last month's archive:
http://oss.sgi.com/pipermail/xfs/2010-September/047003.html

Dave Chinner put forth on 9/11/2010 3:23 AM:

Quoted 4 lines

xfs_db used buffered IO on the block device, which is not coherent with the filesystem. If you are using it on an active filesystem, then running "echo 1 > /proc/sys/vm/drop_caches" before you run xfs_db should make it read from disk at least once....

Signature · 6 lines
Stan

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw
In reply to Richard Ems
Quoted 21 lines · Richard Ems

Hi all,

this is on openSUSE 11.3.

# uname -a
Linux fs1 2.6.34.7-0.3-default #1 SMP 2010-09-20 15:27:38 +0200
x86_64 x86_64 x86_64 GNU/Linux
# echo frag | xfs_db -r /dev/disk/by-label/data1
xfs_db> actual 6451844, ideal 5050129, fragmentation factor 21.73%
# xfs_db -V
xfs_db version 3.1.2
# xfs_fsr -V
xfs_fsr version 3.1.2
# df -h /dev/sdb1
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1              17T   13T  4.3T  75% /data_1
Quoted 7 lines

The volume is new, 12TB were rsync'ed from another volume, some new files came after the sync.

I ran several times xfs_fsr, but the 21.73% factor stays there. There where some busy or modified files on which I started xfs_fsr later again, but this ones where small files and the 21.73% is still there.

Understand your numbers. What frag reports is how many extents there are vs a perfect layout. It does not tell you how badly fragmented your filesystem is. Extent-based filesystems can have "fragmentation" like you see reported above, but not suffer at all because the extents are large enough not to affect IO throughput.

e.g. If I have a 100GB file in 100x1GB extents, frag would report an ideal of 17 extents and measure 100. That would give a frag factor of 83%. Now, is that filesystem fragmented? Theoretically yes. Practically, no.

Why? Because extents of 1GB are more than large enough for any IO to that file reach full throughput. Therefore, while the file layout is not perfect, the "fragmentation" has no impact on performance and therefore the filesystem should not be considered fragmented.

So, for 13TB of data, having 20% of your files with two extents rather than one is not a problem unless that causes you application measurable performance issues...

IOWs, trying to reduce fragmentation without understanding what the numbers tell you about the layout of your filesystem can be counter productive. Especially as running xfs_fsr when you don't really need to can have other side-effects that affect the long-term aging characteristics of the filesystem (e.g. causing preamture free space fragmentation).

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#6 lore raw
Quoted 57 lines · Dave Chinner
Quoted 21 lines · Richard Ems

Hi all,

this is on openSUSE 11.3.

# uname -a
Linux fs1 2.6.34.7-0.3-default #1 SMP 2010-09-20 15:27:38 +0200
x86_64 x86_64 x86_64 GNU/Linux
# echo frag | xfs_db -r /dev/disk/by-label/data1
xfs_db>  actual 6451844, ideal 5050129, fragmentation factor 21.73%
# xfs_db -V
xfs_db version 3.1.2
# xfs_fsr -V
xfs_fsr version 3.1.2
# df -h /dev/sdb1
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1              17T   13T  4.3T  75% /data_1
Quoted 7 lines

The volume is new, 12TB were rsync'ed from another volume, some new files came after the sync.

I ran several times xfs_fsr, but the 21.73% factor stays there. There where some busy or modified files on which I started xfs_fsr later again, but this ones where small files and the 21.73% is still there.

Understand your numbers. What frag reports is how many extents there are vs a perfect layout. It does not tell you how badly fragmented your filesystem is. Extent-based filesystems can have "fragmentation" like you see reported above, but not suffer at all because the extents are large enough not to affect IO throughput.

e.g. If I have a 100GB file in 100x1GB extents, frag would report an ideal of 17 extents and measure 100. That would give a frag factor of 83%. Now, is that filesystem fragmented? Theoretically yes. Practically, no.

Why? Because extents of 1GB are more than large enough for any IO to that file reach full throughput. Therefore, while the file layout is not perfect, the "fragmentation" has no impact on performance and therefore the filesystem should not be considered fragmented.

So, for 13TB of data, having 20% of your files with two extents rather than one is not a problem unless that causes you application measurable performance issues...

IOWs, trying to reduce fragmentation without understanding what the numbers tell you about the layout of your filesystem can be counter productive. Especially as running xfs_fsr when you don't really need to can have other side-effects that affect the long-term aging characteristics of the filesystem (e.g. causing preamture free space fragmentation).

Quoted 3 lines

Cheers,

Dave.

Hi Dave,

many thanks for the clarification. I will go again through the XFS documentation and try to "understand my numbers" as you wrote.

Thanks again,
Richard

Signature · 12 lines
Richard Ems       mail: [email protected]

Cape Horn Engineering S.L.
C/ Dr. J.J. Dómine 1, 5º piso
46011 Valencia
Tel : +34 96 3242923 / Fax 924
http://www.cape-horn-eng.com

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw
In reply to Dave Chinner
Quoted 5 lines · Dave Chinner

Understand your numbers. What frag reports is how many extents there are vs a perfect layout. It does not tell you how badly fragmented your filesystem is. Extent-based filesystems can have "fragmentation" like you see reported above, but not suffer at all because the extents are large enough not to affect IO throughput.

Hi Dave,

I think I almost got that now.
But, at which numbers should I look at before starting a defrag then?

Up to now, I ran always "echo frag | xfs_db -r /dev/..." to get a "number" that could tell me if starting a xfs_fsr was necessary.

At which other numbers should I look at to see if running a xfs_fsr defrag is necessary or not?

Many thanks,
Richard

Signature · 12 lines
Richard Ems       mail: [email protected]

Cape Horn Engineering S.L.
C/ Dr. J.J. Dómine 1, 5º piso
46011 Valencia
Tel : +34 96 3242923 / Fax 924
http://www.cape-horn-eng.com

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#8 lore raw
Quoted 1 line · On Freitag, 22. Oktober 2010 Richard Ems wrote:

But, at which numbers should I look at before starting a defrag then?

Watch the performance of your application. Record answer times with munin or something, and if you ever "feel" it's too slow, look at the recorded numbers again to see if your feelings fit the measurements. Don't be paranoid about fragmentation. The more people access a server at a time, the less important fragmentation is.

If you got 100 people streaming 100 perfect defragmented files, you still got an access pattern that needs to move the disk head to 100 different positions all the time. If your single disk can't do that many I/O's, build up a RAID, or get faster disks (10kprm, 15krpm, SSD).

Defrag is more for single threaded I/O workloads, where one stream at a time has to be read/written. Therefore it helps on a Windows PC more than on a server. Only use defrag if you really have lots of chunks per file.

Signature · 13 lines
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc

it-management Internet Services
http://proteger.at [gesprochen: Prot-e-schee]
Tel: 0660 / 415 65 31

****** Radiointerview zum Thema Spam ******
http://www.it-podcast.at/archiv.html#podcast-100716

// Wir haben im Moment zwei Häuser zu verkaufen:
// http://zmi.at/langegg/
// http://zmi.at/haus2009/

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs