Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#594004: resize2fs(8) does not clearly specify size units

13 views
Skip to first unread message

Ben Hutchings

unread,
Aug 22, 2010, 8:20:02 PM8/22/10
to
Package: e2fsprogs
Version: 1.41.12-2
Severity: important

resize2fs(8) says:

"Optionally, the size parameter may be suffixed by one of the
following the units designators: 's', 'K', 'M', or 'G', for 512 byte
sectors, kilobytes, megabytes, or gigabytes, respectively."

In contrast to hard disk specifications, the suffixes are interpreted
as base-2 multiples, not base-10 multiples. This could lead to data
loss when shrinking a filesystem and then separately shrinking the
partition, if the partitioning tool is not filesystem-aware.

The manual page should state explicitly that the suffixes are
interpreted as base-2 multiples.

Ben.

-- System Information:
Debian Release: squeeze/sid
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages e2fsprogs depends on:
ii e2fslibs 1.41.12-2 ext2/ext3/ext4 file system librari
ii libblkid1 2.17.2-3.1 block device id library
ii libc6 2.11.2-2 Embedded GNU C Library: Shared lib
ii libcomerr2 1.41.12-2 common error description library
ii libss2 1.41.12-2 command-line interface parsing lib
ii libuuid1 2.17.2-3.1 Universally Unique ID library
ii util-linux 2.17.2-3.1 Miscellaneous system utilities

e2fsprogs recommends no packages.

Versions of packages e2fsprogs suggests:
pn e2fsck-static <none> (no description available)
pn gpart <none> (no description available)
ii parted 2.3-1 The GNU Parted disk partition resi

-- no debconf information

--
To UNSUBSCRIBE, email to debian-bugs-...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Ted Ts'o

unread,
Sep 25, 2010, 8:30:02 PM9/25/10
to
tags 594004 +pending
thanks

On Mon, Aug 23, 2010 at 01:09:46AM +0100, Ben Hutchings wrote:
> Package: e2fsprogs
> Version: 1.41.12-2
> Severity: important
>
> resize2fs(8) says:
>
> "Optionally, the size parameter may be suffixed by one of the
> following the units designators: 's', 'K', 'M', or 'G', for 512 byte
> sectors, kilobytes, megabytes, or gigabytes, respectively."
>
> In contrast to hard disk specifications, the suffixes are interpreted
> as base-2 multiples, not base-10 multiples. This could lead to data
> loss when shrinking a filesystem and then separately shrinking the
> partition, if the partitioning tool is not filesystem-aware.
>
> The manual page should state explicitly that the suffixes are
> interpreted as base-2 multiples.

Priority *important*?!?

OK, I'll check in the following patch.

- Ted

commit 63feaa13ab1011b40d59011e6ffdc1a07d3423ac
Author: Theodore Ts'o <ty...@mit.edu>
Date: Sat Sep 25 20:23:33 2010 -0400

resize2fs.8: Make it clear that power-of-2 units are meant by kilobytes

It's sad that this needs to be made clear....

Addresses-Debian-Bug: #594004

Signed-off-by: "Theodore Ts'o" <ty...@mit.edu>

diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
index 09770e1..214d43c 100644
--- a/resize/resize2fs.8.in
+++ b/resize/resize2fs.8.in
@@ -51,6 +51,14 @@ If
.I size
parameter is not specified, it will default to the size of the partition.
.PP
+Note: when kilobytes is used above, I mean
+.IR real ,
+power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct
+folks insist should be the stupid-sounding ``kibibytes''. The same
+holds true for megabytes, also sometimes known as ``mebibytes'', or
+gigabytes, as the amazingly silly ``gibibytes''. Makes you want to
+gibber, doesn't it?
+.PP
The
.B resize2fs
program does not manipulate the size of partitions. If you wish to enlarge

Ben Hutchings

unread,
Sep 25, 2010, 8:50:01 PM9/25/10
to
On Sat, 2010-09-25 at 20:24 -0400, Ted Ts'o wrote:
> tags 594004 +pending
> thanks
>
> On Mon, Aug 23, 2010 at 01:09:46AM +0100, Ben Hutchings wrote:
> > Package: e2fsprogs
> > Version: 1.41.12-2
> > Severity: important
> >
> > resize2fs(8) says:
> >
> > "Optionally, the size parameter may be suffixed by one of the
> > following the units designators: 's', 'K', 'M', or 'G', for 512 byte
> > sectors, kilobytes, megabytes, or gigabytes, respectively."
> >
> > In contrast to hard disk specifications, the suffixes are interpreted
> > as base-2 multiples, not base-10 multiples. This could lead to data
> > loss when shrinking a filesystem and then separately shrinking the
> > partition, if the partitioning tool is not filesystem-aware.
> >
> > The manual page should state explicitly that the suffixes are
> > interpreted as base-2 multiples.
>
> Priority *important*?!?
[...]

Because of the potential for data loss in case of confusion.

Ben.

--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

signature.asc

Ted Ts'o

unread,
Sep 25, 2010, 9:10:01 PM9/25/10
to
On Sun, Sep 26, 2010 at 01:45:02AM +0100, Ben Hutchings wrote:
> >
> > Priority *important*?!?
> [...]
>
> Because of the potential for data loss in case of confusion.

Umm, how? If the size specified is bigger than the device size,
resize2fs will stop and warn the user.

- Ted

Ben Hutchings

unread,
Sep 25, 2010, 9:40:02 PM9/25/10
to
On Sat, 2010-09-25 at 21:05 -0400, Ted Ts'o wrote:
> On Sun, Sep 26, 2010 at 01:45:02AM +0100, Ben Hutchings wrote:
> > >
> > > Priority *important*?!?
> > [...]
> >
> > Because of the potential for data loss in case of confusion.
>
> Umm, how? If the size specified is bigger than the device size,
> resize2fs will stop and warn the user.

But if you're shrinking, you have to resize the filesystem and then the
partition. And the partitioning tool is not so likely to know the size
of the filesystem.

signature.asc

Ted Ts'o

unread,
Sep 25, 2010, 10:00:02 PM9/25/10
to
On Sun, Sep 26, 2010 at 02:35:14AM +0100, Ben Hutchings wrote:
>
> But if you're shrinking, you have to resize the filesystem and then the
> partition. And the partitioning tool is not so likely to know the size
> of the filesystem.

And what partitioning tool uses marketing gigabytes as opposed to real
gigabytes?

This is all stupid anyway, since people who do this are more than
likely to screw up and get it wrong by typo'ing a number. Tools like
gparted are integrated with the filesystem resizers, and this is never
an issue.

Ben Hutchings

unread,
Sep 25, 2010, 10:10:02 PM9/25/10
to
On Sat, 2010-09-25 at 21:45 -0400, Ted Ts'o wrote:
> On Sun, Sep 26, 2010 at 02:35:14AM +0100, Ben Hutchings wrote:
> >
> > But if you're shrinking, you have to resize the filesystem and then the
> > partition. And the partitioning tool is not so likely to know the size
> > of the filesystem.
>
> And what partitioning tool uses marketing gigabytes as opposed to real
> gigabytes?

parted does, but it will also recognise the filesystem and refuse to
make the partititon too small (actually I think it will refuse to shrink
the partition at all).

Other than, I don't know.

signature.asc
0 new messages