Bug 450764 - RFE: GFS2: mkfs.gfs2 should have an optional fs size parm
RFE: GFS2: mkfs.gfs2 should have an optional fs size parm
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: Robert Peterson
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2008-06-10 16:49 EDT by Robert Peterson
Modified: 2010-01-11 22:41 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-20 15:52:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Proposed patch (3.73 KB, patch)
2008-06-11 13:27 EDT, Robert Peterson
no flags Details | Diff
Addendum patch (2.15 KB, patch)
2008-08-08 16:40 EDT, Robert Peterson
no flags Details | Diff

  None (edit)
Description Robert Peterson 2008-06-10 16:49:17 EDT
Description of problem:
Many of the file system mkfs commands, such as mkfs for ext3 and xfs
have an optional parameter where the user may specify the file system
size.  Right now, mkfs.gfs2 doesn't have that; it just takes the
entire device.  This would facilitate GFS2 debugging and recreating
customer problems.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. lvcreate --name exxon_lv -l 100G /dev/exxon_vg
2. mkfs.gfs2 -p lock_nolock /dev/exxon_vg/exxon_lv
Actual results:
All available space of /dev/exxon_vg/exxon_lv are taken up by the
file system.

Expected results:
It would be nice if we had an optional parameter, such as mkfs.ext3's
"[blocks-count]" or xfs's "-d size=80G" so we don't need to use the
entire device, especially for debugging purposes.

Additional info:
Comment 1 Robert Peterson 2008-06-11 13:27:19 EDT
Created attachment 308968 [details]
Proposed patch

This is the RHEL5 version of the patch.  The upstream (master) patch
should not be too different, and I'll send that upstream when I find
the time.

This patch became a higher priority because I could not recreate the
required file system conditions with MD raid any other way for
bug #448866, which is what I've been focusing on lately.  Also, I
found some formatting inconsistencies with the mkfs.gfs2 man page
that I fixed, as long as I was editing the file.

It turns out that most of the major file systems have alternate block
count options in their respective mkfs commands.  I sampled several and
looked at how the block count was specified on the command line:

mkfs.ext3 [ blocks-count ]
mkfs.xfs -d size=X (e.g. 80G)
mkfs.ntfs [ number-of-sectors ]
mkfs.vfat [ block-count ]
mkfs.cramfs (no option available)
mkfs.reiserfs [block-count]

So I went with the majority and made an optional last parameter to
specify the block count.
Comment 2 Robert Peterson 2008-06-11 16:21:03 EDT
This patch was tested on system exxon-01 and pushed to the master and
STABLE2 branches in the upstream git tree.  Requesting ACK flags for
inclusion into 5.3.
Comment 3 RHEL Product and Program Management 2008-06-11 16:35:52 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
Comment 4 Robert Peterson 2008-06-18 16:59:17 EDT
After fixing a minor white space issue, I pushed this to the RHEL5
branch of the cluster git tree.

Someone pointed out to me that resize2fs also has an optional file
system size parameter, so we may want to do gfs2_grow as well at some
point.  I consider that a separate issue, and it should have its own bz
record.  For now, I'm marking this as modified.
Comment 5 Eric Sandeen 2008-07-13 00:29:08 EDT
+               if (sdp->orig_fssize > sdp->device.length)
+                       die("specified block count is smaller than the"
+                           "actual device.\n");

Isn't that text backwards?  (s/b larger?)
Comment 6 Eric Sandeen 2008-07-13 00:34:58 EDT
Oh and just a minor nit:

[root@east-10 ~]# mkfs.gfs2 -p lock_nolock /dev/sdb 268435456


Device Size                1024.00 GB (268435456 blocks)
Filesystem Size:           1024.00 GB (268435454 blocks)

the device size is actually 1.4T ... *shrug*  :)
Comment 7 Robert Peterson 2008-08-08 16:40:45 EDT
Created attachment 313847 [details]
Addendum patch

This patch fixes the problems Eric Sandeen pointed out.
Comment 8 Robert Peterson 2008-08-08 16:58:18 EDT
The addendum patch was committed to master, STABLE2 and RHEL5 branches
of git.
Comment 10 Nate Straz 2008-12-15 15:33:25 EST
Verified w/ gfs2-utils-0.1.53-1.el5
Comment 12 errata-xmlrpc 2009-01-20 15:52:25 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.