#773159 mke2fs: -J device=UUID=<uuid> confused by non-filesystem devices

Package:
e2fsprogs
Source:
e2fsprogs
Description:
ext2/ext3/ext4 file system utilities
Submitter:
Elliott Mitchell
Date:
2014-12-15 06:12:07 UTC
Severity:
normal
#773159#5
Date:
2014-12-15 06:01:47 UTC
From:
To:
Interesting behavior from: `mke2fs -J device=UUID=<uuid> /dev/sda2` when
the UUID is on the device /dev/sda3, and device /dev/sda1 is swap space:

# mke2fs -j -t ext3 -O dir_index -J device=UUID=<uuid> /dev/sda2
mke2fs 1.42.5 (29-Jul-2012)
mke2fs: Bad magic number in super-block while trying to open journal device /dev/sda1
#  mke2fs -j -t ext3 -O dir_index -J device=LABEL=journal /dev/sda2
mke2fs 1.42.5 (29-Jul-2012)
Using journal device's blocksize: 4096
Filesystem label=lair-/var

I'm surprised mke2fs got confused by a swap device when telling it the
UUID, but was just fine with either the LABEL or actual device.  Oddly
`tune2fs -J device=UUID=<uuid> /dev/sda2` didn't have a problem, only
mke2fs did.  Though I suppose tune2fs might have had access to the device
number cached in the superblock (I had to reinitialize the journal, then
point back to it).