Mkfs.btrfs on luks partition fails

I try to create a btrfs filesystem on a luks partition and it fails. Everything is properly setup and mkfs.xfs or mkfs.ext4 work fine with the luks partition but not so mkfs.btrfs:

13# mkfs.btrfs -f /dev/mapper/lukswd1
btrfs-progs v5.7 
See http://btrfs.wiki.kernel.org for more information.

ERROR: cannot check mount status of /dev/mapper/lukswd1: Not a directory

This is on Manjaro testing with btrfs-progs v5.7 and kernel 5.8. Any idea what is going wrong here?

hi,
can you please post the output of ls /dev/mapper, please?

and btw. do you run this command as root or using sudo?

This was the right question to ask! :+1:

19# ll /dev/mapper
insgesamt 0
crw------- 1 root root 10, 236  2. Sep 12:09 control
lrwxrwxrwx 1 root root       7  2. Sep 12:10 lukswd1 -> ../dm-0
lrwxrwxrwx 1 root root       7  2. Sep 12:10 lukswd2 -> ../dm-1

So /dev/mapper/lukswd1 is actually a link to /dev/dm-0.

When I use /dev/dm-0 mkfs.btrfs has no problem:

10# mkfs.btrfs -f /dev/dm-0
btrfs-progs v5.7 
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               6102f3bc-6094-4c5b-b585-40af501db349
Node size:          16384
Sector size:        4096
Filesystem size:    3.64TiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP               1.00GiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Runtime features:   
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1     3.64TiB  /dev/dm-0

Thank you. Problem solved.

1 Like

How did you create the Luks device?

I am using a keyfile instead of a password:

cryptsetup luksFormat /dev/sdg1 --key-file=my-key-file

cryptsetup open /dev/sdg1 --key-file=my-key-file lukswd1

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.