Tech Support > Operating Systems > Linux / Variants > resize2fs and defragmentation
resize2fs and defragmentation
Posted by John Hardin on February 10th, 2004


ext2fs gurus:

Okay, so resize2fs will defrag a filesystem when you ask it to reduce the
size of the filesystem...

....but what about when you leave the size alone or expand it? Does it also
defragment files then?

Meaning: is "resize2fs /dev/whatever" essentially a defrag-only operation?

Thx.

--
John Hardin KA7OHZ <johnh@aproposretail.com>
Internal Systems Administrator/Guru voice: (425) 672-1304
Apropos Retail Management Systems, Inc. fax: (425) 672-0192
-----------------------------------------------------------------------
Failure to plan ahead on someone else's part does not constitute an
emergency on my part.
- David W. Barts in a.s.r

Posted by David on February 11th, 2004


John Hardin wrote:
Read the man page about it.
man resize2fs

Or search for it at www.google.com/linux

--
Confucius: He who play in root, eventually kill tree.
Registered with The Linux Counter. http://counter.li.org/
Slackware 9.1.0 Kernel 2.4.24 SMP i686 (GCC) 3.3.2
Uptime: 36 days, 11:16, 2 users, load average: 1.04, 0.94, 1.0

Posted by John Hardin on February 28th, 2004


David sez:

"RTFM" is only a useful answer if TFM has the answer to the question
you're asking. I did both of those before posting. Did you?

The resize2fs man page says *nothing* about defragmentation.

A google search for pages about resize2fs and defragmentation returns lots
of pages that say (with varying degrees of authority) that resize2fs
defragments files, but none that say whether it defrags when the new
filesystem size is the same as the old filesystem size.

So: does resize2fs defragment files when it would otherwise be making no
changes to the filesystem size, i.e. when the filesystem is already the
size of the partition and a new size has not been specified?

Thanks.

--
John Hardin KA7OHZ ICQ#15735746 http://www.impsec.org/~jhardin/
jhardin@impsec.org pgpk -a jhardin@impsec.org
key: 0xB8732E79 - 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
"Bother," said Pooh as he struggled with /etc/sendmail.cf, "it never
does quite what I want. I wish Christopher Robin was here."
-- Peter da Silva in a.s.r
-----------------------------------------------------------------------
37 days until the Slovakian Presidential Election


Posted by David on February 29th, 2004


John Hardin wrote:
That's because it isn't defrag tool.
It is a filesystem resizing tool.

So you can enlarge a partition then resize the filesystem to fit.
Or shrink/resize the filesystem then shrink the partition. Linux
filesystems don't fragment like Microsoft filesystems do.

--
Confucius: He who play in root, eventually kill tree.
Registered with The Linux Counter. http://counter.li.org/
Slackware 9.1.0 Kernel 2.4.25 SMP i686 (GCC) 3.3.3
Uptime: 10 days, 1:30, 1 user, load average: 1.00, 1.04, 1.17

Posted by Chris Cox on March 1st, 2004


David wrote:
....snip...
In particular, reiserfs is known to be one of the best because
of its tail packing... but you can search the web and see
benchmarks where reiserfs still leads to pack on fragmentation
even with that option disabled.... very impressive.


Posted by John Hardin on March 6th, 2004


David sez:

I'm aware of that. It has the side-effect of defragging the filesystem if
you make the filesystem smaller - at least, that's what people are
claiming. I have yet to confirm it for myself because I don't have a
fragmented ext2 filesystem to experiment on at the moment.

Can you confirm (or deny) claims that resize2fs will defragment any files
under any conditions whatsoever?

If it does defragment files under some conditions, what are those
conditions?

That is *all* I am looking for. My first post assumed that the answer to
the first question above was "yes, it does defragment", but I will discard
that assumption now.

No, they fragment like Linux filesystems do.

ext2 is subject to file fragmentation, it's just subject to it to a much
lesser degree than MS filesystems are.

--
John Hardin KA7OHZ ICQ#15735746 http://www.impsec.org/~jhardin/
jhardin@impsec.org pgpk -a jhardin@impsec.org
key: 0xB8732E79 - 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
"Bother," said Pooh as he struggled with /etc/sendmail.cf, "it never
does quite what I want. I wish Christopher Robin was here."
-- Peter da Silva in a.s.r
-----------------------------------------------------------------------
37 days until the Slovakian Presidential Election


Posted by Ed Murphy on March 7th, 2004


On Sat, 06 Mar 2004 17:04:26 +0000, John Hardin wrote:

Partly because less fragmentation occurs (due to a smarter algorithm),
and partly because the same amount of fragmentation causes less slowdown
(due to sorting disk access requests based on the physical position of
the requested blocks on the disk).



Similar Posts