Red Hat Bugzilla – Bug 807905
mkfs blocksize option breaks when creating btrfs
Last modified: 2012-06-20 03:01:27 EDT
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:
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)
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
Patches posted: https://www.redhat.com/archives/libguestfs/2012-April/msg00006.html Only the first patch would be included in RHEL.
Fix is included in libguestfs-1.16.14-1.el6.
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
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.
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