Bug 450764

Summary: RFE: GFS2: mkfs.gfs2 should have an optional fs size parm
Product: Red Hat Enterprise Linux 5 Reporter: Robert Peterson <rpeterso>
Component: gfs2-utilsAssignee: Robert Peterson <rpeterso>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 5.3CC: adas, bmarzins, edamato, esandeen, swhiteho
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 20:52:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch
none
Addendum patch none

Description Robert Peterson 2008-06-10 20:49:17 UTC
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):
RHEL5.2

How reproducible:
Always

Steps to Reproduce:
1. lvcreate --name exxon_lv -l 100G /dev/exxon_vg
2. mkfs.gfs2 -p lock_nolock /dev/exxon_vg/exxon_lv
3.
  
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 17:27:19 UTC
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 20:21:03 UTC
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 Program Management 2008-06-11 20:35:52 UTC
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
release.

Comment 4 Robert Peterson 2008-06-18 20:59:17 UTC
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 04:29:08 UTC
+               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?)
 
Thanks,
-Eric

Comment 6 Eric Sandeen 2008-07-13 04:34:58 UTC
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 20:40:45 UTC
Created attachment 313847 [details]
Addendum patch

This patch fixes the problems Eric Sandeen pointed out.

Comment 8 Robert Peterson 2008-08-08 20:58:18 UTC
The addendum patch was committed to master, STABLE2 and RHEL5 branches
of git.

Comment 10 Nate Straz 2008-12-15 20:33:25 UTC
Verified w/ gfs2-utils-0.1.53-1.el5

Comment 12 errata-xmlrpc 2009-01-20 20:52:25 UTC
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.

http://rhn.redhat.com/errata/RHBA-2009-0087.html