mkfs.btrfs not working on an unformatted device

I read that mkfs.btrfs will work on a device that is not formatted.
I am on z/linus and I tried to execute mkfs.btrfs on a 3390 mod-9 device.
This did not work. It will default with the --mixed option.
It will work if I format and partition the device.linux140:~ # mkfs.btrfs /dev/dasdb SMALL VOLUME: forcing mixed metadata/data groups '/dev/dasdb' is too small to make a usable filesystem Minimum size for each btrfs device is 16777216.
Should this work? Are there other required options?

The Suse 12 system is installed on a 3390 mod-9 device.

Which patch of SLES 12 are you using, exactly?

How big is the device?

On my openSUSE 13x laptop (much older than SLES 12, for the record) this
seemed to work well enough. My steps were to create a 100 MiB file to use
as a device, then to use losetup to make it appear as a device, then use
mkfs.btrfs to partition it:

root@mybox:~# losetup -o 4194304 /dev/loop0 /tmp/100mib
2017-01-25 09:49:59 Jobs:0 Err:0

root@mybox:~# ll /dev/loop0
brw-rw---- 1 root disk 7, 0 Jan 25 09:49 /dev/loop0
2017-01-25 09:50:03 Jobs:0 Err:0

root@mybox:~# mkfs.btrfs /dev/loop0
SMALL VOLUME: forcing mixed metadata/data groups

WARNING! - Btrfs v3.12+20131125 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

Performing full device TRIM (96.00MiB) ...
Turning ON incompat feature 'mixed-bg': mixed data and metadata block groups
Turning ON incompat feature 'extref': increased hardlink limit per file to
65536
Created a data/metadata chunk of size 8388608
fs created label (null) on /dev/loop0
nodesize 4096 leafsize 4096 sectorsize 4096 size 96.00MiB
Btrfs v3.12+20131125
2017-01-25 09:50:11 Jobs:0 Err:0

root@mybox:~# echo $?
0


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

I am running as a guest on an IBM mainframe.
The 3390 mod-9 is 7G large.

linux140:~ # uname -a Linux linux140 3.12.67-60.64.21-default #1 SMP Fri Dec 2 07:25:10 UTC 2016 (ac54c96) s390x s390x s390x GNU/Linux
The parameters mixed-bg and extref that your system shows are not available parameters for this setup.

Hi Mike,

I read that mkfs.btrfs will work on a device that is not formatted.

It will work if I format and partition the device.

As you’re talking about DASD, which I haven’t toyed with for ages - what do you do to “format” the device?

Typically, “to format” a disk device means “to put a file system on it”. Hence to say that you can use mkfs.btrfs on an “unformatted device” is true. But since you said “to format and partition”, in that order, so I get the feeling that the DASD needs to be “prepared” to be used in the mainframe Linux environment. So if the statement about “unformatted devices” doesn’t come from someone explicitly knowing about your host environment, I’d say it’s a misunderstanding:

  • you may need to prepare (“format”) a DASD before using it in Linux mode
  • you can use mkfs.btrfs on any Linux block device, even if there’s no other file system on it yet (“unformatted device”)

You may well be able to skip creating partitions after having prepared the DASD. I wouldn’t recommend it, but that can well be a purely taste-based decision :wink:

Regards,
J

Greetings J, thank you for the reply. I just found out that you do need to format and partition a 3390 dasd on z/linux. I read this online in the “A Beginner’s Guide to btrfs”.[CODE]3 Creating btrfs File Systems (RAID0, RAID1)

One great feature of btrfs is that you can create btrfs file systems on unformatted hard drives, i.e., you don’t have to use tools like fdisk to partition a hard drive.

To create a btrfs file system on /dev/sdb, /dev/sdc, and /dev/sdd, we simply run:

mkfs.btrfs /dev/sdb /dev/sdc /dev/sdd[/CODE]

So, I believe this information is platform specific.

on unformatted hard drives, i.e., you don’t have to use tools like fdisk to partition a hard drive

and here we go, yet another definition. No, that statement doesn’t fit usual usage of terms: Technically speaking, “unformatted” is quite different from “partitioned” :smiley:

While the quoted statement sounds wrong to me, yours is right in that DASDs need to be formatted and partitioned (using DASD-specific tools, see http://www.redbooks.ibm.com/abstracts/tips0277.html) before they can be used in Linux on zseries.

Regards,
J