RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 807905 - mkfs blocksize option breaks when creating btrfs
Summary: mkfs blocksize option breaks when creating btrfs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-29 06:01 UTC by Mohua Li
Modified: 2012-06-20 07:01 UTC (History)
4 users (show)

Fixed In Version: libguestfs-1.16.14-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed.
Clone Of:
Environment:
Last Closed: 2012-06-20 07:01:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0774 0 normal SHIPPED_LIVE Low: libguestfs security, bug fix, and enhancement update 2012-06-19 19:29:50 UTC

Description Mohua Li 2012-03-29 06:01:39 UTC
Description of problem:

for mkfs-opts, btrfs is different from ext3/ext4, "- b" doesn't mean blocksize but size in byte, so we need to split the below code for btrfs filesytem, 

//daemon/mkfs.c


136     else {
137       /* For all other filesystem types, try the -b option. */
138       snprintf (blocksize_str, sizeof blocksize_str, "%d", blocksize);
139       ADD_ARG (argv, i, "-b");
140       ADD_ARG (argv, i, blocksize_str);
141     }
142   }
143 

or mkfs-opts will fail with "File system size 4096 bytes is too small, 256M is required at least", which will treat the blocksize as filesystem size in byte, for more detail pls see below information, 



                                                                                                                                                                                                                                                                                                                                                   
--------fail to create btrfs with customize value blocksize

><fs> mkfs-opts btrfs blocksize:4096 /dev/vda
mkfs-opts: unknown optional argument "/dev/vda"
><fs> mkfs-opts btrfs /dev/vda blocksize:4096
libguestfs: send_to_daemon: 84 bytes: 00 00 00 50 | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 16 | 00 00 00 00 | ...
guestfsd: main_loop: new request, len 0x50
mkfs -t btrfs -b 4096 /dev/vda
File system size 4096 bytes is too small, 256M is required at least
guestfsd: error: btrfs: /dev/vda: File system size 4096 bytes is too small, 256M is required at least
guestfsd: main_loop: proc 278 (mkfs_opts) took 0.00 seconds
libguestfs: recv_from_daemon: 132 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 16 | 00 00 00 01 | 00 12 34 0e | ...
libguestfs: error: mkfs_opts: btrfs: /dev/vda: File system size 4096 bytes is too small, 256M is required at least

--------could succeed with ext4 with customize value
><fs> mkfs-opts ext4  /dev/vda blocksize:4096
libguestfs: send_to_daemon: 80 bytes: 00 00 00 4c | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 16 | 00 00 00 00 | ...
guestfsd: main_loop: new request, len 0x4c
mke2fs -t ext4 -F -b 4096 /dev/vda
mke2fs 1.41.12 (17-May-2010)
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 16 | 00 00 00 01 | 00 12 34 0f | ...

------could succeed with mkfs with the default value

><fs> mkfs btrfs /dev/vda
libguestfs: send_to_daemon: 68 bytes: 00 00 00 40 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 2a | 00 00 00 00 | ...
guestfsd: main_loop: proc 278 (mkfs_opts) took 2.27 seconds
guestfsd: main_loop: new request, len 0x40
mkfs -t btrfs /dev/vda



Version-Release number of selected component (if applicable):
libguestfs-1.16.12-1.el6.x86_64


How reproducible:
always

Steps to Reproduce:
1.mkfs-opts btrfs blocksize:4096 /dev/vda
2.
3.
  
Actual results:


Expected results:
mkfs-opts could create btrfs filesystem succeed with blocksize value, 



Additional info:

Comment 6 Richard W.M. Jones 2012-03-29 08:39:12 UTC
Putting back to 6.3.  As Mohua Li says, we need to fix this.

For a future feature, we should add a 'mkbtrfs' call which
contains all the specific parameters for btrfs (compare to
the various mke2fs calls:
http://libguestfs.org/guestfs.3.html#guestfs_mke2fs_J)

Comment 7 Richard W.M. Jones 2012-04-02 07:40:09 UTC
One-line reproducer:

$ guestfish -N disk mkfs-opts btrfs /dev/sda blocksize:1024
libguestfs: error: mkfs_opts: btrfs: /dev/vda: File system size 1024 bytes is too small, 256M is required at least

Comment 8 Richard W.M. Jones 2012-04-02 09:16:42 UTC
Patches posted:

https://www.redhat.com/archives/libguestfs/2012-April/msg00006.html

Only the first patch would be included in RHEL.

Comment 9 Richard W.M. Jones 2012-04-02 14:04:46 UTC
Fix is included in libguestfs-1.16.14-1.el6.

Comment 10 Mohua Li 2012-04-05 02:51:21 UTC
libguestfs-1.16.15-1.el6


as just included the first patch which just disallow the blocks option for btrfs filesystem, and i didn't see any side effect for other filesystem so far, 


[root@dhcp-93-131 RHEL-Server-6.0]# guestfish -N disk mkfs-opts btrfs /dev/sda blocksize:1024
libguestfs: error: mkfs_opts: blocksize cannot be set on btrfs filesystems
[root@dhcp-93-131 RHEL-Server-6.0]# guestfish -N disk mkfs-opts ext4 /dev/sda blocksize:1024

Comment 11 Richard W.M. Jones 2012-04-26 13:46:05 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No Documentation needed.

Comment 13 errata-xmlrpc 2012-06-20 07:01:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0774.html


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