Red Hat Bugzilla – Bug 450764
RFE: GFS2: mkfs.gfs2 should have an optional fs size parm
Last modified: 2010-01-11 22:41:01 EST
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
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. lvcreate --name exxon_lv -l 100G /dev/exxon_vg
2. mkfs.gfs2 -p lock_nolock /dev/exxon_vg/exxon_lv
All available space of /dev/exxon_vg/exxon_lv are taken up by the
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.
Created attachment 308968 [details]
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
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)
So I went with the majority and made an optional last parameter to
specify the block count.
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.
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
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.
+ 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?)
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* :)
Created attachment 313847 [details]
This patch fixes the problems Eric Sandeen pointed out.
The addendum patch was committed to master, STABLE2 and RHEL5 branches
Verified w/ gfs2-utils-0.1.53-1.el5
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.